From: Peter Xu <peterx@redhat.com>
To: Junjie Cao <junjie.cao@intel.com>
Cc: qemu-devel@nongnu.org, stefanha@gmail.com, marco.cavenati@music.ethz.ch
Subject: Re: Call for GSoC internship project ideas
Date: Mon, 16 Mar 2026 11:17:43 -0400 [thread overview]
Message-ID: <abgfF1HP3LX8rSkh@x1.local> (raw)
In-Reply-To: <20260314194706.637-1-junjie.cao@intel.com>
On Sun, Mar 15, 2026 at 03:47:06AM +0800, Junjie Cao wrote:
> Hi Peter, Marco, and QEMU community,
Hi, Junjie,
>
> I'm Junjie Cao -- I graduated from the National University of Singapore
> last year and am currently working at Intel. I'd like to express my
> interest in the GSoC 2026 Fast Snapshot Load project.
>
> Much of my background is in network device virtualization -- specifically
> the QEMU/DPDK/Virtio-net/VHost stack (emulation and tuning). This has
> given me hands-on experience with QEMU's guest memory management and
> device state serialization, and helps me appreciate how practical the
> problem this project aims to solve really is -- Marco's fuzzing use case
> of loading snapshots frequently is a great example.
>
> == Preparation so far ==
>
> - Built QEMU from latest master; will be sending a small fix patch soon to
> get familiar with the QEMU community workflow.
>
> - Read Peter's original proposal and the follow-up discussion with Marco;
> read mapped-ram.rst -- the fixed-offset format allows pread() of any page
> by RAMBlock+offset directly from the snapshot file, which is the
> prerequisite for demand paging to work.
>
> - On the source level, focused on two paths: the uffd infrastructure in
> migration/postcopy-ram.c (postcopy_ram_fault_thread,
> postcopy_ram_incoming_setup, ram_block_enable_notify) to understand how
> postcopy registers and handles page faults; and ram_load() in
> migration/ram.c to understand RAM section deserialization during loadvm.
> The intersection of these two paths is where the core changes for this
> project would go.
>
> == Implementation path as I understand it ==
>
> The core idea: split loadvm into "device state loading" and "RAM
> loading", bridged by uffd. Based on file: migration + mapped-ram:
>
> - Modify the ram_load() path: parse_ramblock_mapped_ram() reads the
> MappedRamHeader and bitmap but skips read_ramblock_mapped_ram(), building
> an offset table for on-demand pread() instead. Other device states load
> normally.
>
> - Register userfaultfd (MISSING mode) on all migratable RAMBlocks.
> postcopy-ram.c has similar infrastructure; the difference is we don't
> need discard logic or the source-side page request protocol.
>
> - Start vCPUs with two threads populating RAM in parallel: a background
> loader doing sequential pread() + UFFDIO_COPY for bulk prefetch, and a
> fault handler resolving vCPU-triggered page faults on demand. A
> per-RAMBlock atomic bitmap with test_and_set coordinates the two to
> avoid double-copy. Once all pages are loaded, unregister uffd. Loadvm is
> complete.
>
> Peter mentioned that the MVP could start with no multifd and anonymous
> memory only -- I think that would be a great approach. Since mapped-ram
> and postcopy are currently mutually exclusive in migrate_caps_check(),
> a new capability will likely be needed for this feature.
Thanks for your interest. Yes above all look sane. We may also consider
reusing postcopy-ram + mapped-ram only on incoming side, so as to avoid a
new feature bit.
>
> == A thought and a question ==
>
> Some devices' load_state handlers access guest RAM during restore.
> Postcopy handles this by registering uffd before device state loading
> (inside the POSTCOPY_LISTEN handler, before device sections in the
> CMD_PACKAGED blob). The same ordering applies here: register uffd, start
> the fault handler, then load device states -- any RAM touch is
> intercepted and resolved via pread().
Note that we can't resolve page faults using pread(). One thing is because
it is not atomic, hence vCPU can see partially copied pages. The other
thing is pread*() won't kick blocked threads properly. We need to use
something like postcopy_place_page() through the userfaultfd facilities.
>
> This relies on the kernel queuing faults between UFFDIO_REGISTER and the
> first poll(). I noticed postcopy_ram_incoming_setup() has a similar
> window (fault thread created before blocks registered) -- is this the
> same guarantee we'd rely on here?
The kernel must be able to queue requests right after REGISTER, OTOH poll()
can happen whenever late it is. From kernel's POV, REGISTER enables this
feature already. Whether someone will be polling or reading the fd (for
further fault resolution) will not stop the kernel from trapping memory
faults.
So yes, this should work similarly like original postcopy.
>
> == Next steps ==
>
> Besides attempting a QEMU patch submission and working on my proposal,
> is there anything else you'd suggest I prepare?
Feel free to apply via GSoC official website, it should open shortly today
and the deadline is March 31th.
Thanks,
>
> Any feedback or guidance would be very much appreciated!
>
> Best regards,
> Junjie Cao
> junjie.cao@intel.com
>
--
Peter Xu
next prev parent reply other threads:[~2026-03-16 15:18 UTC|newest]
Thread overview: 88+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-05 21:47 Call for GSoC internship project ideas Stefan Hajnoczi
2026-01-13 15:29 ` Peter Xu
2026-01-13 16:16 ` Stefan Hajnoczi
2026-01-13 16:30 ` Peter Xu
2026-01-14 10:16 ` Marco Cavenati
2026-01-14 14:48 ` Peter Xu
2026-01-15 17:13 ` Marco Cavenati
2026-03-14 19:47 ` Junjie Cao
2026-03-16 15:17 ` Peter Xu [this message]
2026-01-14 18:00 ` Marc-André Lureau
2026-01-14 19:26 ` Stefan Hajnoczi
2026-01-20 21:42 ` Stefan Hajnoczi
2026-01-20 21:50 ` Daniel P. Berrangé
2026-01-22 10:49 ` Thomas Huth
2026-01-22 10:14 ` Daniel P. Berrangé
2026-01-22 10:22 ` Marc-André Lureau
2026-01-22 10:39 ` Daniel P. Berrangé
2026-01-22 10:54 ` Peter Maydell
2026-01-22 10:57 ` Daniel P. Berrangé
2026-01-22 11:28 ` Marc-André Lureau
2026-01-22 11:40 ` Daniel P. Berrangé
2026-01-22 12:02 ` Alex Bennée
2026-01-22 15:46 ` Pierrick Bouvier
2026-01-23 8:44 ` Marc-André Lureau
2026-01-23 15:56 ` Pierrick Bouvier
2026-01-26 22:29 ` Stefan Hajnoczi
2026-01-27 8:06 ` Helge Deller
2026-01-27 14:18 ` Stefan Hajnoczi
2026-02-10 17:45 ` Helge Deller
2026-02-10 18:23 ` Stefan Hajnoczi
2026-02-10 20:43 ` Helge Deller
2026-02-15 18:25 ` Helge Deller
2026-02-15 20:31 ` Stefan Hajnoczi
2026-02-16 2:21 ` Helge Deller
2026-01-27 8:34 ` Stefano Garzarella
2026-01-27 14:19 ` Stefan Hajnoczi
2026-01-22 10:43 ` Thomas Huth
2026-01-22 10:48 ` Daniel P. Berrangé
2026-01-22 11:05 ` Thomas Huth
2026-01-22 11:24 ` Daniel P. Berrangé
2026-01-22 11:58 ` Alex Bennée
2026-01-22 19:14 ` Stefan Hajnoczi
2026-01-22 11:55 ` Alex Bennée
2026-01-20 22:00 ` John Levon
2026-01-20 21:44 ` Stefan Hajnoczi
2026-01-22 9:38 ` Modern HMP (was: Call for GSoC internship project ideas) Markus Armbruster
2026-01-22 10:00 ` Daniel P. Berrangé
2026-01-22 12:07 ` Modern HMP Markus Armbruster
2026-01-22 12:21 ` Daniel P. Berrangé
2026-01-22 13:07 ` Markus Armbruster
2026-01-22 14:03 ` Daniel P. Berrangé
2026-01-22 15:47 ` Fabiano Rosas
2026-01-22 16:00 ` Daniel P. Berrangé
2026-01-27 11:17 ` Kevin Wolf
2026-02-01 18:29 ` Dr. David Alan Gilbert
2026-02-04 8:08 ` Markus Armbruster
2026-02-04 9:07 ` Daniel P. Berrangé
2026-02-04 9:44 ` Markus Armbruster
2026-02-05 1:15 ` Dr. David Alan Gilbert
2026-02-05 6:52 ` Markus Armbruster
2026-02-05 12:50 ` Dr. David Alan Gilbert
2026-01-27 9:27 ` Call for GSoC internship project ideas Matias Ezequiel Vara Larsen
2026-01-27 14:15 ` Stefan Hajnoczi
2026-01-29 10:46 ` COCONUT-SVSM project ideas for GSoC 2026 Jörg Rödel
2026-01-29 14:18 ` Stefan Hajnoczi
2026-02-04 13:24 ` Jörg Rödel
2026-02-04 16:12 ` Stefan Hajnoczi
-- strict thread matches above, loose matches on Subject: below --
2026-02-23 16:18 Call for GSoC internship project ideas Arun Krishna K
2026-02-23 19:18 ` Stefan Hajnoczi
2026-02-23 23:26 ` Warner Losh
2025-01-28 16:16 Stefan Hajnoczi
2025-01-29 17:44 ` Stefano Garzarella
2025-02-03 1:42 ` Jamin Lin
2025-02-10 14:55 ` Stefano Garzarella
2025-02-10 15:54 ` Stefan Hajnoczi
2025-02-06 9:34 ` Matias Ezequiel Vara Larsen
2025-02-06 15:02 ` Stefan Hajnoczi
2025-02-07 13:57 ` Matias Ezequiel Vara Larsen
2025-02-06 15:10 ` Stefan Hajnoczi
2025-02-07 13:58 ` Matias Ezequiel Vara Larsen
2025-02-07 12:35 ` Hanna Czenczek
2025-02-07 13:41 ` Stefan Hajnoczi
2025-02-07 13:48 ` Hanna Czenczek
2025-02-07 13:53 ` Stefan Hajnoczi
2025-02-07 14:39 ` Helge Deller
2025-02-07 14:47 ` Stefan Hajnoczi
2025-02-07 15:34 ` Helge Deller
2025-02-07 16:01 ` Stefan Hajnoczi
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=abgfF1HP3LX8rSkh@x1.local \
--to=peterx@redhat.com \
--cc=junjie.cao@intel.com \
--cc=marco.cavenati@music.ethz.ch \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.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 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.