qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fabiano Rosas <farosas@suse.de>
To: Marco Cavenati <Marco.Cavenati@eurecom.fr>
Cc: "Peter Xu" <peterx@redhat.com>,
	qemu-devel@nongnu.org, "Daniel P. Berrangé" <berrange@redhat.com>,
	"Prasad Pandit" <ppandit@redhat.com>
Subject: Re: [PATCH] migration: add   FEATURE_SEEKABLE to QIOChannelBlock
Date: Tue, 30 Sep 2025 17:12:19 -0300	[thread overview]
Message-ID: <877bxfvgws.fsf@suse.de> (raw)
In-Reply-To: <1b7bdf-68d17080-aab-3c30b780@82293076>

"Marco Cavenati" <Marco.Cavenati@eurecom.fr> writes:

> On Friday, September 19, 2025 23:24 CEST, Fabiano Rosas <farosas@suse.de> wrote:
>
>> "Marco Cavenati" <Marco.Cavenati@eurecom.fr> writes:
>> 
>> > Hello Fabiano,
>> >
>> > On Thursday, April 10, 2025 21:52 CEST, Fabiano Rosas <farosas@suse.de> wrote:
>> >
>> >> Marco Cavenati <Marco.Cavenati@eurecom.fr> writes:
>> >> 
>> >> > Enable the use of the mapped-ram migration feature with savevm/loadvm
>> >> > snapshots by adding the QIO_CHANNEL_FEATURE_SEEKABLE feature to
>> >> > QIOChannelBlock. Implement io_preadv and io_pwritev methods to provide
>> >> > positioned I/O capabilities that don't modify the channel's position
>> >> > pointer.
>> >> 
>> >> We'll need to add the infrastructure to reject multifd and direct-io
>> >> before this. The rest of the capabilities should not affect mapped-ram,
>> >> so it's fine (for now) if we don't honor them.
>> >
>> > Do you have any status update on this infrastructure you mentioned?
>> >
>> 
>> I'm doing the work suggested by Daniel of passing migration
>> configuration options via the commands themselves. When that is ready we
>> can include savevm and have it only accept mapped-ram and clear all
>> other options.
>> 
>> But don't worry about that, propose your changes and I'll make sure to
>> have *something* ready before it merges. I don't see an issue with
>> merging this single patch, for instance:
>> https://lore.kernel.org/r/20250327143934.7935-2-farosas@suse.de
>
> Perfect!
>
>> >> What about zero page handling? Mapped-ram doesn't send zero pages
>> >> because the file will always have zeroes in it and the migration
>> >> destination is guaranteed to not have been running previously. I believe
>> >> loading a snapshot in a VM that's already been running would leave stale
>> >> data in the guest's memory.
>> >
>> > About the zero handling I'd like to hear your opinion about this idea I
>> > proposed a while back:
>> > The scenarios where zeroing is not required (incoming migration and
>> > -loadvm) share a common characteristic: the VM has not yet run in the
>> > current QEMU process.
>> > To avoid splitting read_ramblock_mapped_ram(), could we implement
>> > a check to determine if the VM has ever run and decide whether to zero
>> > the memory based on that? Maybe using RunState?
>> >
>> 
>> We could just as well add some flag to load_snapshot() since we know
>> which invocations are guaranteed to happen with clean memory.
>> 
>> But if you can use existing code for that it would be great. Adding a
>> global guest_has_ever_run flag, not so much. What's the MachineInitPhase
>> before -loadvm?
>
> MachineInitPhase is set to PHASE_MACHINE_READY during ram_load() for
> both -loadvm and HMP loadvm, so unfortunately that isn’t an option.
>
> RunState during ram_load() is
> - RUN_STATE_INMIGRATE for -incoming,
> - RUN_STATE_PRELAUNCH for -loadvm
> - RUN_STATE_RESTORE_VM for HMP loadvm.
> But I’m not sure how reliable (or unreliable) it would be to depend on this
> to infer that RAM is zero.
>

I wouldn't mind using INMIGRATE and PRELAUNCH, seeing how INMIGRATE is
used indiscriminately around the codebase. And PRELAUNCH is actually
descriptive.

Maybe it's best if you pick an easy method, such as this one, and we'll
iterate on it once you send a patch.

> As for using a flag, I don’t see an obvious way to pass one down through
> load_snapshot -> qemu_loadvm_state -> ... -> read_ramblock_mapped_ram.
> Do you already have something in mind?
>

MigrateIncomingState

> Thank you
> Marco


      reply	other threads:[~2025-09-30 20:14 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-27 14:14 [PATCH] migration: add FEATURE_SEEKABLE to QIOChannelBlock Marco Cavenati
2025-04-04  8:19 ` Prasad Pandit
2025-04-04  9:04   ` Marco Cavenati
2025-04-04 10:14     ` Prasad Pandit
2025-04-04 12:05       ` Marco Cavenati
2025-04-07  6:47         ` Prasad Pandit
2025-04-07  9:00           ` Marco Cavenati
2025-04-08  5:25             ` Prasad Pandit
2025-04-08 15:03               ` Marco Cavenati
2025-04-15 10:21   ` Daniel P. Berrangé
2025-04-15 10:44     ` Prasad Pandit
2025-04-15 11:03       ` Daniel P. Berrangé
2025-04-15 11:57         ` Prasad Pandit
2025-04-15 12:03           ` Daniel P. Berrangé
2025-04-10 19:52 ` Fabiano Rosas
2025-04-11  8:48   ` Marco Cavenati
2025-04-11 12:24     ` Fabiano Rosas
2025-04-15 10:15       ` Marco Cavenati
2025-04-15 13:50         ` Fabiano Rosas
2025-04-17  9:10           ` Marco Cavenati
2025-04-17 15:12             ` Fabiano Rosas
2025-04-24 13:44               ` Marco Cavenati
2025-05-08 20:23                 ` Peter Xu
2025-05-09 12:51                   ` Marco Cavenati
2025-05-09 16:21                     ` Peter Xu
2025-05-09 21:14                       ` Marco Cavenati
2025-05-09 22:04                         ` Peter Xu
2025-09-16 16:06   ` Marco Cavenati
2025-09-19 21:24     ` Fabiano Rosas
2025-09-22 15:51       ` Marco Cavenati
2025-09-30 20:12         ` Fabiano Rosas [this message]

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=877bxfvgws.fsf@suse.de \
    --to=farosas@suse.de \
    --cc=Marco.Cavenati@eurecom.fr \
    --cc=berrange@redhat.com \
    --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 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).