]> git.proxmox.com Git - mirror_qemu.git/commitdiff
cpus: check running not RUN_STATE_RUNNING
authorSteve Sistare <steven.sistare@oracle.com>
Wed, 3 Jan 2024 20:05:32 +0000 (12:05 -0800)
committerPeter Xu <peterx@redhat.com>
Thu, 4 Jan 2024 01:52:42 +0000 (09:52 +0800)
When a vm transitions from running to suspended, runstate notifiers are
not called, so the notifiers still think the vm is running.  Hence, when
we call vm_start to restore the suspended state, we call vm_state_notify
with running=1.  However, some notifiers check for RUN_STATE_RUNNING.
They must check the running boolean instead.

No functional change.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Link: https://lore.kernel.org/r/1704312341-66640-4-git-send-email-steven.sistare@oracle.com
Signed-off-by: Peter Xu <peterx@redhat.com>
backends/tpm/tpm_emulator.c
hw/usb/hcd-ehci.c
hw/usb/redirect.c
hw/xen/xen-hvm-common.c

index f7f1b4ad7a80588c747883fe212d1207687728ed..254fce776424034eae5fab39000a9c1d4652c35d 100644 (file)
@@ -904,7 +904,7 @@ static void tpm_emulator_vm_state_change(void *opaque, bool running,
 
     trace_tpm_emulator_vm_state_change(running, state);
 
-    if (!running || state != RUN_STATE_RUNNING || !tpm_emu->relock_storage) {
+    if (!running || !tpm_emu->relock_storage) {
         return;
     }
 
index 19b4534c20c10d78d5e3d1fdca7aefc168e9265a..10c82ce4728880eda74dfb6f66c76f08674e7475 100644 (file)
@@ -2451,7 +2451,7 @@ static void usb_ehci_vm_state_change(void *opaque, bool running, RunState state)
      * USB-devices which have async handled packages have a packet in the
      * ep queue to match the completion with.
      */
-    if (state == RUN_STATE_RUNNING) {
+    if (running) {
         ehci_advance_async_state(ehci);
     }
 
index c9893df86778096cb992ad1cebbe02018f572bcf..3785bb057b222fc4615119fd2cbfe40226f08551 100644 (file)
@@ -1403,7 +1403,7 @@ static void usbredir_vm_state_change(void *priv, bool running, RunState state)
 {
     USBRedirDevice *dev = priv;
 
-    if (state == RUN_STATE_RUNNING && dev->parser != NULL) {
+    if (running && dev->parser != NULL) {
         usbredirparser_do_write(dev->parser); /* Flush any pending writes */
     }
 }
index 565dc39c8f622c05db37eea40f4391dc640d6ff6..47e6cb1db3ab19860653ffa8e2a9cd65b26bb986 100644 (file)
@@ -623,7 +623,7 @@ void xen_hvm_change_state_handler(void *opaque, bool running,
 
     xen_set_ioreq_server_state(xen_domid,
                                state->ioservid,
-                               (rstate == RUN_STATE_RUNNING));
+                               running);
 }
 
 void xen_exit_notifier(Notifier *n, void *data)