nutanix / libvfio-user

framework for emulating devices in userspace
BSD 3-Clause "New" or "Revised" License
166 stars 51 forks source link

allow concurrent dirty bitmap get #677

Closed jlevon closed 2 years ago

jlevon commented 2 years ago

Use atomic operations to allow concurrent bitmap updates with VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP operations.

Dirtying clients can race against each other, so we must use atomic or when marking dirty: we do this byte-by-byte.

When reading the dirty bitmap, we must be careful to not race and lose any set bits within the same byte. If we miss an update, we'll catch it the next time around, presuming that before the final pass we'll have quiesced all I/O.

Signed-off-by: John Levon <john.levon@nutanix.com>

jlevon commented 2 years ago

could read a little cleaner

you could well be correct, but I've struggled to do so - do you have a suggestion?

jlevon commented 2 years ago

in the meantime I will merge