All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabiano Rosas <farosas@suse.de>
To: Peter Xu <peterx@redhat.com>
Cc: qemu-devel@nongnu.org, Prasad Pandit <ppandit@redhat.com>,
	Lukas Straub <lukasstraub2@web.de>,
	Juraj Marcin <jmarcin@redhat.com>
Subject: Re: [PATCH 04/10] migration/savevm: Remove SaveStateEntry.is_ram
Date: Mon, 26 Jan 2026 19:00:10 -0300	[thread overview]
Message-ID: <874io8ghlh.fsf@suse.de> (raw)
In-Reply-To: <aXfEMcFNL_YPjgzg@x1.local>

Peter Xu <peterx@redhat.com> writes:

> On Fri, Jan 23, 2026 at 10:47:10AM -0300, Fabiano Rosas wrote:
>> Peter Xu <peterx@redhat.com> writes:
>> 
>> > It's neither accurate nor necessary.  Use a proper helper to detect if it's
>> > an iterable savevm state entry instead.
>> 
>> Could you explain what exactly is_ram was supposed to mean?
>
> IIUC when introduced it was trying to capture the ram only, and that's also
> why I said it's inaccurate, because ram is not the only thing that can
> provide a save_setup() nowadays..
>
>> 
>> >
>> > Signed-off-by: Peter Xu <peterx@redhat.com>
>> > ---
>> >  migration/savevm.c | 15 ++++++++-------
>> >  1 file changed, 8 insertions(+), 7 deletions(-)
>> >
>> > diff --git a/migration/savevm.c b/migration/savevm.c
>> > index 61e873d90c..f1cd8c913d 100644
>> > --- a/migration/savevm.c
>> > +++ b/migration/savevm.c
>> > @@ -249,7 +249,6 @@ typedef struct SaveStateEntry {
>> >      const VMStateDescription *vmsd;
>> >      void *opaque;
>> >      CompatEntry *compat;
>> > -    int is_ram;
>> >  } SaveStateEntry;
>> >  
>> >  typedef struct SaveState {
>> > @@ -816,10 +815,6 @@ int register_savevm_live(const char *idstr,
>> >      se->ops = ops;
>> >      se->opaque = opaque;
>> >      se->vmsd = NULL;
>> > -    /* if this is a live_savem then set is_ram */
>> > -    if (ops->save_setup != NULL) {
>> > -        se->is_ram = 1;
>> > -    }
>> >  
>> >      pstrcat(se->idstr, sizeof(se->idstr), idstr);
>> >  
>> > @@ -1866,6 +1861,12 @@ void qemu_savevm_live_state(QEMUFile *f)
>> >      qemu_put_byte(f, QEMU_VM_EOF);
>> >  }
>> >  
>> > +/* Is a save state entry iterable (e.g. RAM)? */
>> > +static bool qemu_savevm_se_iterable(SaveStateEntry *se)
>> > +{
>> > +    return se->ops && se->ops->save_setup;
>> 
>> So it could be iterable and not have .save_live_iterate?
>> 
>> Also, what's the deal with slirp? AIUI, it would be considered is_ram?
>
> I guess no. Either in term of when it's introduced, or in theory of how I
> understand this piece of code should work.. Because savevm_slirp_state
> doesn't provide save_setup().
>

Oops, I misread save_state vs. save_setup.

> Note that this patch didn't really change the fact on how it works, even if
> I _think_ this is broken..  I want to leave it for later, making sure this
> patch (while doing the cleanup) doesn't introduce functional changes.
>

That's always fine.

> So I expect things to break if e.g. COLO is used with VFIO devices (that
> supports migrations), where it also provides save_setup(), but actually
> COLO will not properly sync VFIO states.  Likely nobody is using it anyway.
>
> It's also the same to Xen's xen-save-devices-state QMP command.  It looks
> to me Xen is playing some "split savevm" work here, however I don't know
> whether it'll always workout these days when there're special devices that
> provide save_setup().
>

Hm, ok. Let's leave it then.

>> 
>> > +}
>> > +
>> >  int qemu_save_device_state(QEMUFile *f)
>> >  {
>> >      Error *local_err = NULL;
>> > @@ -1876,7 +1877,7 @@ int qemu_save_device_state(QEMUFile *f)
>> >      QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
>> >          int ret;
>> >  
>> > -        if (se->is_ram) {
>> > +        if (qemu_savevm_se_iterable(se)) {
>> 
>> Hmm, qemu_savevm_state_setup has:
>> 
>>     if (!se->ops || !se->ops->save_setup) {
>>             continue;
>>     }
>> 
>> therefore:
>> 
>>     if (!qemu_savevm_se_iterable(se)) {
>>             continue;
>>     }
>> 
>> Maybe it would be more practical to put these in a separate list already
>> while registering.
>
> This is a question about performance, my gut feeling is looping over with
> one queue would be fine for now, but even if not, it'll be further question
> to ask after above (on correctness..).
>
> So I plan to be focused on the cleanup part for now in this series..
>

Reviewed-by: Fabiano Rosas <farosas@suse.de>


  reply	other threads:[~2026-01-26 22:00 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-21 22:33 [PATCH 00/10] migration/colo: small cleanup series Peter Xu
2026-01-21 22:33 ` [PATCH 01/10] migration: Introduce qemu_savevm_send_* helpers Peter Xu
2026-01-23 13:23   ` Fabiano Rosas
2026-01-21 22:33 ` [PATCH 02/10] migration: Use qemu_savevm_send_header() in qemu_save_device_state() Peter Xu
2026-01-23 13:23   ` Fabiano Rosas
2026-01-21 22:33 ` [PATCH 03/10] migration: Remove one migration_in_colo_state() occurance Peter Xu
2026-01-23 13:32   ` Fabiano Rosas
2026-01-26 19:23     ` Peter Xu
2026-01-21 22:33 ` [PATCH 04/10] migration/savevm: Remove SaveStateEntry.is_ram Peter Xu
2026-01-23 13:47   ` Fabiano Rosas
2026-01-26 19:44     ` Peter Xu
2026-01-26 22:00       ` Fabiano Rosas [this message]
2026-01-21 22:33 ` [PATCH 05/10] migration/colo: Unwrap qemu_savevm_live_state() Peter Xu
2026-01-23 13:48   ` Fabiano Rosas
2026-01-26 20:44     ` Peter Xu
2026-01-21 22:33 ` [PATCH 06/10] migration/colo: Remove call to send switchover start event Peter Xu
2026-01-23 13:49   ` Fabiano Rosas
2026-01-21 22:33 ` [PATCH 07/10] colo: Forbid VM resume during checkpointing Peter Xu
2026-01-23 13:49   ` Fabiano Rosas
2026-01-21 22:33 ` [PATCH 08/10] migration/colo: Use the RAM iterable helper directly Peter Xu
2026-01-23 14:00   ` Fabiano Rosas
2026-01-21 22:33 ` [PATCH 09/10] migration/colo: Move qemu_fflush() closer to its user for fb Peter Xu
2026-01-23 14:10   ` Fabiano Rosas
2026-01-26 21:06     ` Peter Xu
2026-01-21 22:33 ` [PATCH 10/10] migration: Drop iterable_only in qemu_savevm_state_complete_precopy Peter Xu
2026-01-23 14:11   ` Fabiano Rosas
2026-01-25 19:29 ` [PATCH 00/10] migration/colo: small cleanup series Lukas Straub
2026-01-26 17:23   ` Peter Xu

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=874io8ghlh.fsf@suse.de \
    --to=farosas@suse.de \
    --cc=jmarcin@redhat.com \
    --cc=lukasstraub2@web.de \
    --cc=peterx@redhat.com \
    --cc=ppandit@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.