On 09.05.25 12:04, Chenyi Qiang wrote:
On 5/9/2025 4:22 PM, Baolu Lu wrote:
On 4/27/2025 10:26 AM, Chenyi Qiang wrote:
Hi David,
Any thought on patch 10-12, which is to move the change attribute into a
priority listener. A problem is how to handle the error handling of
private_to_shared failure. Previously, we thought it would never be able
to fail, but right now, it is possible in corner cases (e.g. -ENOMEM) in
set_attribute_private(). At present, I simply raise an assert instead of
adding any rollback work (see patch 11).
Do the pages need to be pinned when converting them to a shared state
and unpinned when converting to a private state? Or is this handled
within the vfio_state_change_notify callbacks?
I think it is handled in vfio_state_change_notify(). Just like the
device passthrough in legacy VM, the shared memory will be pinned during
vfio dma-map and unpin during unmap.
We'll have to "unmap/unpin before shared->private" and "map/pin after
private->shared" conversion.
vfio cannot fail unmap/unpin, but guest_memfd will be able to "easily"
fail shared->private. But in that case (temporary references) we'll
likely have to retry the conversion until it works.
guest_memfd cannot "easily" fail private->shared conversion, but vfio
can fail map/pin, in which case we probably have to abort the conversion.
Error handling/recovery will be a bit more tricky than it is today.
--
Cheers,
David / dhildenb