Introduce new RanState RAN_STATE_MEMORY_STALE and add it to runstate_needs_reset().
Signed-off-by: Lei Li <li...@linux.vnet.ibm.com> --- qapi-schema.json | 7 +++++-- vl.c | 13 ++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/qapi-schema.json b/qapi-schema.json index b290a0f..4d9e712 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -176,12 +176,15 @@ # @watchdog: the watchdog action is configured to pause and has been triggered # # @guest-panicked: guest has been panicked as a result of guest OS panic +# +# @memory-stale: guest is paused to start unix_page_flipping migration +# process, the destination QEMU will has the newer contents of the memory ## { 'enum': 'RunState', 'data': [ 'debug', 'inmigrate', 'internal-error', 'io-error', 'paused', 'postmigrate', 'prelaunch', 'finish-migrate', 'restore-vm', - 'running', 'save-vm', 'shutdown', 'suspended', 'watchdog', - 'guest-panicked' ] } + 'running', 'save-vm', 'shutdown', 'suspended', 'memory-stale', + 'watchdog', 'guest-panicked' ] } ## # @SnapshotInfo diff --git a/vl.c b/vl.c index 8d5d874..3ea96b2 100644 --- a/vl.c +++ b/vl.c @@ -601,6 +601,7 @@ static const RunStateTransition runstate_transitions_def[] = { { RUN_STATE_PAUSED, RUN_STATE_RUNNING }, { RUN_STATE_PAUSED, RUN_STATE_FINISH_MIGRATE }, + { RUN_STATE_PAUSED, RUN_STATE_MEMORY_STALE }, { RUN_STATE_POSTMIGRATE, RUN_STATE_RUNNING }, { RUN_STATE_POSTMIGRATE, RUN_STATE_FINISH_MIGRATE }, @@ -608,6 +609,7 @@ static const RunStateTransition runstate_transitions_def[] = { { RUN_STATE_PRELAUNCH, RUN_STATE_RUNNING }, { RUN_STATE_PRELAUNCH, RUN_STATE_FINISH_MIGRATE }, { RUN_STATE_PRELAUNCH, RUN_STATE_INMIGRATE }, + { RUN_STATE_PRELAUNCH, RUN_STATE_MEMORY_STALE }, { RUN_STATE_FINISH_MIGRATE, RUN_STATE_RUNNING }, { RUN_STATE_FINISH_MIGRATE, RUN_STATE_POSTMIGRATE }, @@ -624,23 +626,31 @@ static const RunStateTransition runstate_transitions_def[] = { { RUN_STATE_RUNNING, RUN_STATE_SHUTDOWN }, { RUN_STATE_RUNNING, RUN_STATE_WATCHDOG }, { RUN_STATE_RUNNING, RUN_STATE_GUEST_PANICKED }, + { RUN_STATE_RUNNING, RUN_STATE_MEMORY_STALE }, { RUN_STATE_SAVE_VM, RUN_STATE_RUNNING }, { RUN_STATE_SHUTDOWN, RUN_STATE_PAUSED }, { RUN_STATE_SHUTDOWN, RUN_STATE_FINISH_MIGRATE }, + { RUN_STATE_SHUTDOWN, RUN_STATE_MEMORY_STALE }, { RUN_STATE_DEBUG, RUN_STATE_SUSPENDED }, + { RUN_STATE_DEBUG, RUN_STATE_MEMORY_STALE }, { RUN_STATE_RUNNING, RUN_STATE_SUSPENDED }, { RUN_STATE_SUSPENDED, RUN_STATE_RUNNING }, { RUN_STATE_SUSPENDED, RUN_STATE_FINISH_MIGRATE }, + { RUN_STATE_SUSPENDED, RUN_STATE_MEMORY_STALE }, { RUN_STATE_WATCHDOG, RUN_STATE_RUNNING }, { RUN_STATE_WATCHDOG, RUN_STATE_FINISH_MIGRATE }, + { RUN_STATE_WATCHDOG, RUN_STATE_MEMORY_STALE }, { RUN_STATE_GUEST_PANICKED, RUN_STATE_RUNNING }, { RUN_STATE_GUEST_PANICKED, RUN_STATE_FINISH_MIGRATE }, + { RUN_STATE_GUEST_PANICKED, RUN_STATE_MEMORY_STALE }, + { RUN_STATE_MEMORY_STALE, RUN_STATE_RUNNING }, + { RUN_STATE_MEMORY_STALE, RUN_STATE_POSTMIGRATE }, { RUN_STATE_MAX, RUN_STATE_MAX }, }; @@ -685,7 +695,8 @@ int runstate_is_running(void) bool runstate_needs_reset(void) { return runstate_check(RUN_STATE_INTERNAL_ERROR) || - runstate_check(RUN_STATE_SHUTDOWN); + runstate_check(RUN_STATE_SHUTDOWN) || + runstate_check(RUN_STATE_MEMORY_STALE); } StatusInfo *qmp_query_status(Error **errp) -- 1.7.7.6