From: Steven Sistare <steven.sistare@oracle.com>
To: Peter Xu <peterx@redhat.com>
Cc: qemu-devel@nongnu.org, "Juan Quintela" <quintela@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Fabiano Rosas" <farosas@suse.de>,
"Leonardo Bras" <leobras@redhat.com>
Subject: Re: [PATCH V7 05/12] migration: propagate suspended runstate
Date: Mon, 11 Dec 2023 08:23:13 -0500 [thread overview]
Message-ID: <1215e673-83c0-403b-b01a-50d7da756ed2@oracle.com> (raw)
In-Reply-To: <ZXawLKhxgJiPYfdX@x1n>
On 12/11/2023 1:46 AM, Peter Xu wrote:
> On Wed, Dec 06, 2023 at 09:23:30AM -0800, Steve Sistare wrote:
>> If the outgoing machine was previously suspended, propagate that to the
>> incoming side via global_state, so a subsequent vm_start restores the
>> suspended state. To maintain backward and forward compatibility, reclaim
>> some space from the runstate member.
>>
>> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
>
> Reviewed-by: Peter Xu <peterx@redhat.com>
>
> One nitpick below.
>
>> ---
>> migration/global_state.c | 35 +++++++++++++++++++++++++++++++++--
>> 1 file changed, 33 insertions(+), 2 deletions(-)
>>
>> diff --git a/migration/global_state.c b/migration/global_state.c
>> index 4e2a9d8..d4f61a1 100644
>> --- a/migration/global_state.c
>> +++ b/migration/global_state.c
>> @@ -22,7 +22,16 @@
>>
>> typedef struct {
>> uint32_t size;
>> - uint8_t runstate[100];
>> +
>> + /*
>> + * runstate was 100 bytes, zero padded, but we trimmed it to add a
>> + * few fields and maintain backwards compatibility.
>> + */
>> + uint8_t runstate[32];
>> + uint8_t has_vm_was_suspended;
>> + uint8_t vm_was_suspended;
>> + uint8_t unused[66];
>> +
>> RunState state;
>> bool received;
>> } GlobalState;
>> @@ -35,6 +44,10 @@ static void global_state_do_store(RunState state)
>> assert(strlen(state_str) < sizeof(global_state.runstate));
>> strpadcpy((char *)global_state.runstate, sizeof(global_state.runstate),
>> state_str, '\0');
>> + global_state.has_vm_was_suspended = true;
>> + global_state.vm_was_suspended = vm_get_suspended();
>> +
>> + memset(global_state.unused, 0, sizeof(global_state.unused));
>> }
>>
>> void global_state_store(void)
>> @@ -68,6 +81,12 @@ static bool global_state_needed(void *opaque)
>> return true;
>> }
>>
>> + /* If the suspended state must be remembered, it is needed */
>> +
>> + if (vm_get_suspended()) {
>> + return true;
>> + }
>
> Can we drop this section?
>
> I felt unsafe when QEMU can overwrite the option even if user explicitly
> specified store-global-state=off but we still send this.. Ideally I think
> it's better if it's as simple as:
>
> static bool global_state_needed(void *opaque)
> {
> return migrate_get_current()->store_global_state;
> }
I agree, I also did not see the point of dropping global_state for some states.
I will simplify it to this.
- Steve
> I don't think we can remove the old trick due to compatibility reasons, but
> maybe nice to not add new ones to make this section more unpredictable in
> the migration stream?
>
> IMHO it shouldn't matter in reality for the current use case even dropping
> it, as I don't expect any non-Xen QEMU VMs migrates without having the
> option turned on (store-global-state=on) after QEMU 2.4.
>
> Thanks,
>
next prev parent reply other threads:[~2023-12-11 13:24 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-06 17:23 [PATCH V7 00/12] fix migration of suspended runstate Steve Sistare
2023-12-06 17:23 ` [PATCH V7 01/12] cpus: vm_was_suspended Steve Sistare
2023-12-06 17:23 ` [PATCH V7 02/12] cpus: stop vm in suspended runstate Steve Sistare
2023-12-06 18:45 ` Philippe Mathieu-Daudé
2023-12-06 19:19 ` Steven Sistare
2023-12-06 20:48 ` Philippe Mathieu-Daudé
2023-12-06 21:09 ` Philippe Mathieu-Daudé
2023-12-11 6:25 ` Peter Xu
2023-12-11 13:37 ` Steven Sistare
2023-12-06 17:23 ` [PATCH V7 03/12] cpus: check running not RUN_STATE_RUNNING Steve Sistare
2023-12-06 17:23 ` [PATCH V7 04/12] cpus: vm_resume Steve Sistare
2023-12-06 17:23 ` [PATCH V7 05/12] migration: propagate suspended runstate Steve Sistare
2023-12-08 16:37 ` Fabiano Rosas
2023-12-08 17:28 ` Steven Sistare
2023-12-11 6:46 ` Peter Xu
2023-12-11 13:23 ` Steven Sistare [this message]
2023-12-06 17:23 ` [PATCH V7 06/12] migration: preserve " Steve Sistare
2023-12-06 17:23 ` [PATCH V7 07/12] migration: preserve suspended for snapshot Steve Sistare
2023-12-06 17:23 ` [PATCH V7 08/12] migration: preserve suspended for bg_migration Steve Sistare
2023-12-06 17:23 ` [PATCH V7 09/12] tests/qtest: migration events Steve Sistare
2023-12-06 17:23 ` [PATCH V7 10/12] tests/qtest: option to suspend during migration Steve Sistare
2023-12-06 17:23 ` [PATCH V7 11/12] tests/qtest: precopy migration with suspend Steve Sistare
2023-12-08 16:37 ` Fabiano Rosas
2023-12-11 6:54 ` Peter Xu
2023-12-06 17:23 ` [PATCH V7 12/12] tests/qtest: postcopy " Steve Sistare
2023-12-11 6:54 ` Peter Xu
2023-12-06 17:30 ` [PATCH V7 00/12] fix migration of suspended runstate Steven Sistare
2023-12-11 6:56 ` Peter Xu
2023-12-11 13:31 ` Steven Sistare
2023-12-12 8:54 ` Peter Xu
-- strict thread matches above, loose matches on Subject: below --
2023-12-06 17:12 Steve Sistare
2023-12-06 17:12 ` [PATCH V7 05/12] migration: propagate " Steve Sistare
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1215e673-83c0-403b-b01a-50d7da756ed2@oracle.com \
--to=steven.sistare@oracle.com \
--cc=berrange@redhat.com \
--cc=farosas@suse.de \
--cc=leobras@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).