From: Peter Xu <peterx@redhat.com>
To: Aadeshveer Singh <aadeshveer07@gmail.com>
Cc: qemu-devel@nongnu.org, farosas@suse.de, pbonzini@redhat.com,
philmd@mailo.com, lvivier@redhat.com, ayoub@saferwall.com
Subject: Re: [RFC PATCH v2 6/7] migration: add support for fault thread to load pages from disk
Date: Wed, 8 Jul 2026 11:02:17 -0400 [thread overview]
Message-ID: <ak5meTFBIDCAyYF8@x1.local> (raw)
In-Reply-To: <CA++cPvJ2N_oke1iMP083MDKxeV-YoKDZuWFtAfwoYKwoR65ocA@mail.gmail.com>
On Wed, Jul 08, 2026 at 08:01:34PM +0530, Aadeshveer Singh wrote:
> > > +static bool postcopy_mapped_ram_load_page(MigrationIncomingState *mis,
> > > + RAMBlock *rb, ram_addr_t rb_offset,
> > > + uint64_t haddr, int channel,
> > > + Error **errp)
> > > +{
> > > + void *place_source = mis->postcopy_tmp_pages[channel].tmp_huge_page;
> > > + size_t page;
> > > + size_t read;
> > > +
> > > + page = rb_offset / qemu_ram_pagesize(rb);
> >
> > Yes, here it is correct to use qemu_ram_pagesize().
> >
> > > +
> > > + if (bitmap_test_and_clear_atomic(rb->pending_bmap, page, 1)) {
> > > + if (test_bit(page, rb->file_bmap)) {
> >
> > We'll need to be careful here when you add huge page support, because
> > file_bmap so far is guest-psize based. This line will start to break for
> > huge pages, I am not sure if this is the bug you hit when developing huge
> > page support, maybe yes?
> >
> > Not sure how you resolved it there if this is the case, but one idea is
> > when postcopy-ram is enabled, you can convert the per-guest-psize bitmap
> > into per-host-psize bitmap (when any bit set within the huge page range,
> > set the bit in the new bitmap), then here it will be correct.
> >
>
> For hugepages, I replaced this test_bit() with a ranged check. I felt
> changing the semantics of file_bmap for when postcopy-ram is enabled
When support huge pages, in previous patch if you will already switch to
using ramblock page size for pending_bmap then I think we should indeed be
good here.
With that, actually file_bmap to be guest-psize is definitely
better.. please ignore my above suggestion on bitmap conversions. We just
need to loop over all the bits of the huge page, when the bit is clear,
instead of UFFDIO_ZEROPAGE, we should just do memset(0) for 4k (the tmp
page may have been non-zero prefilled).
I'll wait to see the new version when huge page support is there.
Thanks,
--
Peter Xu
next prev parent reply other threads:[~2026-07-08 15:02 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 8:19 [RFC PATCH v2 0/7] migration: fast snapshot load Aadeshveer Singh
2026-06-30 8:19 ` [RFC PATCH v2 1/7] migration/tests: remove capability conflict test postcopy-ram+mapped-ram Aadeshveer Singh
2026-07-06 19:02 ` Peter Xu
2026-06-30 8:19 ` [RFC PATCH v2 2/7] migration: Propagate error in postcopy setup functions Aadeshveer Singh
2026-07-06 19:13 ` Peter Xu
2026-06-30 8:19 ` [RFC PATCH v2 3/7] migration: Use file_bmap for RAMBlock during incoming file load Aadeshveer Singh
2026-07-06 19:29 ` Peter Xu
2026-07-08 14:24 ` Aadeshveer Singh
2026-07-08 14:56 ` Peter Xu
2026-06-30 8:19 ` [RFC PATCH v2 4/7] migration: Make qemu_get_buffer_at() thread-safe Aadeshveer Singh
2026-07-06 19:34 ` Peter Xu
2026-06-30 8:19 ` [RFC PATCH v2 5/7] migration: add RAMBlock field and helper for fast snapshot load Aadeshveer Singh
2026-07-06 20:03 ` Peter Xu
2026-06-30 8:19 ` [RFC PATCH v2 6/7] migration: add support for fault thread to load pages from disk Aadeshveer Singh
2026-07-06 20:35 ` Peter Xu
2026-07-08 14:31 ` Aadeshveer Singh
2026-07-08 15:02 ` Peter Xu [this message]
2026-06-30 8:19 ` [RFC PATCH v2 7/7] migration: add eager load thread and setup for fast snapshot load Aadeshveer Singh
2026-07-06 21:07 ` Peter Xu
2026-07-06 19:16 ` [RFC PATCH v2 0/7] migration: " Peter Xu
2026-07-08 14:35 ` Aadeshveer Singh
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=ak5meTFBIDCAyYF8@x1.local \
--to=peterx@redhat.com \
--cc=aadeshveer07@gmail.com \
--cc=ayoub@saferwall.com \
--cc=farosas@suse.de \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@mailo.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.