From: Steven Sistare <steven.sistare@oracle.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: qemu-devel@nongnu.org, Cedric Le Goater <clg@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>
Subject: Re: [PATCH V1 4/8] vfio-pci: cpr part 1 (fd and dma)
Date: Wed, 10 Jul 2024 16:32:29 -0400 [thread overview]
Message-ID: <059a1fff-901f-458e-af53-cc9910bcd80e@oracle.com> (raw)
In-Reply-To: <20240710140301.4491b9b1.alex.williamson@redhat.com>
On 7/10/2024 4:03 PM, Alex Williamson wrote:
> On Tue, 9 Jul 2024 13:58:53 -0700
> Steve Sistare <steven.sistare@oracle.com> wrote:
>
>> Enable vfio-pci devices to be saved and restored across a cpr-exec of qemu.
>>
>> At vfio creation time, save the value of vfio container, group, and device
>> descriptors in CPR state.
>>
>> In the container pre_save handler, suspend the use of virtual addresses
>> in DMA mappings with VFIO_DMA_UNMAP_FLAG_VADDR, because guest ram will
>> be remapped at a different VA after exec. DMA to already-mapped pages
>> continues. Save the msi message area as part of vfio-pci vmstate, and
>> save the interrupt and notifier eventfd's in vmstate.
>>
>> On qemu restart, vfio_realize() finds the saved descriptors, uses the
>> descriptors, and notes that the device is being reused. Device and iommu
>> state is already configured, so operations in vfio_realize that would
>> modify the configuration are skipped for a reused device, including vfio
>> ioctl's and writes to PCI configuration space. Vfio PCI device reset
>> is also suppressed. The result is that vfio_realize constructs qemu
>> data structures that reflect the current state of the device. However,
>> the reconstruction is not complete until migrate_incoming is called.
>> migrate_incoming loads the msi data, the vfio post_load handler finds
>> eventfds in CPR state, rebuilds vector data structures, and attaches the
>> interrupts to the new KVM instance. The container post_load handler then
>> invokes the main vfio listener callback, which walks the flattened ranges
>> of the vfio address space and calls VFIO_DMA_MAP_FLAG_VADDR to inform the
>> kernel of the new VA's. Lastly, migration resumes the VM.
>
> Hi Steve,
>
> What's the iommufd plan for cpr? Thanks,
I am working on vdpa and iommufd as we speak, with working prototypes for both.
I plan to submit the kernel and qemu RFC for vdpa next week, followed by vacation,
and iommfd in the weeks after that.
- Steve
next prev parent reply other threads:[~2024-07-10 20:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-09 20:58 [PATCH V1 0/8] Live update: vfio Steve Sistare
2024-07-09 20:58 ` [PATCH V1 1/8] migration: cpr_needed_for_reuse Steve Sistare
2024-07-09 20:58 ` [PATCH V1 2/8] pci: export msix_is_pending Steve Sistare
2024-07-09 20:58 ` [PATCH V1 3/8] vfio-pci: refactor for cpr Steve Sistare
2024-07-09 20:58 ` [PATCH V1 4/8] vfio-pci: cpr part 1 (fd and dma) Steve Sistare
2024-07-10 20:03 ` Alex Williamson
2024-07-10 20:32 ` Steven Sistare [this message]
2024-07-16 14:42 ` Steven Sistare
2024-07-09 20:58 ` [PATCH V1 5/8] vfio-pci: cpr part 2 (msi) Steve Sistare
2024-07-09 20:58 ` [PATCH V1 6/8] vfio-pci: cpr part 3 (intx) Steve Sistare
2024-07-09 20:58 ` [PATCH V1 7/8] vfio: vfio_find_ram_discard_listener Steve Sistare
2024-07-09 20:58 ` [PATCH V1 8/8] vfio-pci: recover from unmap-all-vaddr failure Steve Sistare
2024-08-12 18:19 ` [PATCH V1 0/8] Live update: vfio Steven Sistare
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=059a1fff-901f-458e-af53-cc9910bcd80e@oracle.com \
--to=steven.sistare@oracle.com \
--cc=alex.williamson@redhat.com \
--cc=clg@redhat.com \
--cc=farosas@suse.de \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=peterx@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).