qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Marco Cavenati <Marco.Cavenati@eurecom.fr>
Cc: "Fabiano Rosas" <farosas@suse.de>,
	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: Thu, 8 May 2025 16:23:30 -0400	[thread overview]
Message-ID: <aB0Swile4IjxTUsd@x1.local> (raw)
In-Reply-To: <151d8c-680a4080-15-6f9ea10@196998929>

On Thu, Apr 24, 2025 at 03:44:49PM +0200, Marco Cavenati wrote:
> > If we decide we need to explicitly select that new code, I don't think
> > we need any new capability, because the user has no choice in it. We
> > know that loadvm needs it, but -loadvm doesn't, any other sort of
> > mapped-ram migration also doesn't need it. There is some discussion to
> > be had on whether we want to bind it to the commands themselves, or do
> > some form of detection of clean ram. I think it's best we postopone this
> > part of the discussion until Peter is back (next week), so we can have
> > more eyes on it.

Some more eyes are back, useful or not. :)

> 
> 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?
> 
> Then we can add something like this to read_ramblock_mapped_ram()
> ...
> clear_bit_idx = 0;
> for (...) {
>     // Zero pages
>     if (guest_has_ever_run()) {
>         unread = TARGET_PAGE_SIZE * (set_bit_idx - clear_bit_idx);
>         offset = clear_bit_idx << TARGET_PAGE_BITS;
>         host = host_from_ram_block_offset(block, offset);
>         if (!host) {...}
>         ram_handle_zero(host, unread);
>     }
>     // Non-zero pages
>     clear_bit_idx = find_next_zero_bit(bitmap, num_pages, set_bit_idx + 1);
> ...
> (Plus trailing zero pages handling)

[...]

> > >> > In a nutshell, I'm using dirty page tracking to load from the snapshot
> > >> > only the pages that have been dirtied between two loadvm;
> > >> > mapped-ram is required to seek and read only the dirtied pages.

I may not have the full picture here, please bare with me if so.

It looks to me the major feature here you're proposing is like a group of
snapshots in sequence, while only the 1st snapshot contains full RAM data,
the rest only contains what were dirtied?

From what I can tell, the interface will be completely different from
snapshots then - firstly the VM will be running when taking (at least the
2nd+) snapshots, meanwhile there will be an extra phase after normal save
snapshot, which is "keep saving snapshots", during the window the user is
open to snapshot at any time based on the 1st snapshot.  I'm curious what's
the interfacing for the feature.  It seems we need a separate command
saying that "finished storing the current group of snapshots", which should
stop the dirty tracking.

I'm also curious what is the use case, and I also wonder if "whether we
could avoid memset(0) on a zero page" is anything important here - maybe
you could start with simple (which is to always memset() for a zero page
when a page is dirtied)?

Thanks,

-- 
Peter Xu



  reply	other threads:[~2025-05-08 20:24 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 [this message]
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

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=aB0Swile4IjxTUsd@x1.local \
    --to=peterx@redhat.com \
    --cc=Marco.Cavenati@eurecom.fr \
    --cc=berrange@redhat.com \
    --cc=farosas@suse.de \
    --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).