On Tue, Aug 29, 2023 at 11:18:01AM -0700, Steve Sistare wrote:
> During RUN_STATE_SUSPENDED, the cpu clock remains enabled, so the
> timers_state saved to the migration stream is stale, causing time errors
> in the guest when it wakes from suspend.

Instead of having this, I'm wondering whether we should just let:

        ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);

stop the vm for suspended too - I think we reached a consensus that
SUSPENDED should be treated the same as running here (except the vcpu
beingg running or not).

So the more risky change is we should make runstate_is_running() cover
SUSPENDED, but of course that again can affect many other call sites.. and
I'm not sure whether it's 100% working everywhere.

I think I mentioned the other "easier" way, which is to modify
vm_stop_force_state() to take suspended:

int vm_stop_force_state(RunState state)
 {
-    if (runstate_is_running()) {
+    if (runstate_is_running() || runstate_is_suspended()) {
         return vm_stop(state);

That resides in cpus.c but it really only affects migration, so much less
risky.  Do you think this should be the better (and correct) way to go?

-- 
Peter Xu


Reply via email to