From: Peter Xu <peterx@redhat.com>
To: "Maciej S. Szmigiero" <mail@maciej.szmigiero.name>
Cc: "Fabiano Rosas" <farosas@suse.de>,
"Alex Williamson" <alex@shazbot.org>,
"Cédric Le Goater" <clg@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Avihai Horon" <avihaih@nvidia.com>,
qemu-devel@nongnu.org
Subject: Re: [PATCH 2/2] vfio/migration: Parallelize device state transitions
Date: Mon, 6 Jul 2026 12:23:49 -0400 [thread overview]
Message-ID: <akvWlciUvxjDbBBZ@x1.local> (raw)
In-Reply-To: <e79a3746-9c7e-46a5-ad81-537b9d3affdb@maciej.szmigiero.name>
On Thu, Jul 02, 2026 at 08:36:32PM +0200, Maciej S. Szmigiero wrote:
> I looked more deeply into this and even prototyped a similar new design.
Sorry for a late response; off work most of last week.
>
> However, in the end I think that running VFIO state transitions in
> parallel with other non-VFIO cb() handlers just isn't safe.
>
> For example, on the migration source, the second transition is
> PRE_COPY_P2P -> STOP_COPY.
> PRE_COPY_P2P is the last state during migration that still allows the
> device to accept DMA and similar interactions, while STOP_COPY is
> already the "quiescent" state.
>
> So if a VFIO has already reached STOP_COPY but a non-VFIO device
> callback still hasn't finished, then any DMA/MMIO/P2P transaction from
> that "unfinished" device to the VFIO device would now hit a VFIO device
> that no longer can accept such transactions.
> This may result in hard-to-debug memory corruption during live migration.
Do you have any solid example of this problem?
AFAIU, P2P in VFIO state's term only means P2P DMAs _between_ host VFIO
devices, nothing to do with emulated.
I am not aware of any P2P that can be initiated from emulated devices, even
if it exists, it is only P2P from guest perspective not host: it will
become host operations finally from processor side. I really don't think
it's a concern.
My limited understanding of VFIO's P2P state is: when switching to P2P
state, the VFIO device can still accept P2P DMA from other devices, but
never initiating P2P DMAs, and the latter sentence is critical, it means
the real quiecent state of the whole system happens after the last VFIO
device switching to P2P state: then it means none of the VFIO devices can
initiate P2P DMA anymore, whole system is quiesced. That happens earlier
than reaching any of the cb()s here, because VFIO's prepare_cb() does that
P2P state switch.
Thanks,
--
Peter Xu
next prev parent reply other threads:[~2026-07-06 16:24 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 14:41 [PATCH 0/2] VFIO device migration parallel state transitions Maciej S. Szmigiero
2026-05-20 14:41 ` [PATCH 1/2] system/runstate: Allow adjustment of priority for VM state change handlers Maciej S. Szmigiero
2026-06-01 13:26 ` Fabiano Rosas
2026-05-20 14:41 ` [PATCH 2/2] vfio/migration: Parallelize device state transitions Maciej S. Szmigiero
2026-06-01 13:39 ` Fabiano Rosas
2026-06-01 19:33 ` Peter Xu
2026-06-02 10:01 ` Maciej S. Szmigiero
2026-06-02 20:17 ` Peter Xu
2026-06-03 21:34 ` Maciej S. Szmigiero
2026-07-02 18:36 ` Maciej S. Szmigiero
2026-07-06 16:23 ` Peter Xu [this message]
2026-07-13 20:23 ` Maciej S. Szmigiero
2026-07-14 17:06 ` Peter Xu
2026-07-14 20:23 ` Maciej S. Szmigiero
2026-07-15 15:30 ` Peter Xu
2026-07-16 12:18 ` Maciej S. Szmigiero
2026-07-16 13:30 ` 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=akvWlciUvxjDbBBZ@x1.local \
--to=peterx@redhat.com \
--cc=alex@shazbot.org \
--cc=avihaih@nvidia.com \
--cc=clg@redhat.com \
--cc=farosas@suse.de \
--cc=mail@maciej.szmigiero.name \
--cc=pbonzini@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.