Skip to content

guest_memfd: Fix handling for conversions of MMIO ranges

Michael Roth qemu-devel 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4accel/kvm: Add helper for handling conversions of MMIO holesaccel/kvm/kvm-all.c+64 -320 replies
2/4accel/kvm: Fix kvm_convert_memory() calls crossing memory regionsaccel/kvm/kvm-all.c+63 -310 replies
3/4accel/kvm: Fix handling of MMIO holes at start of conversion rangesaccel/kvm/kvm-all.c+16 -20 replies
4/4accel/kvm: Fix handling of conversion ranges with multiple MMIO holesaccel/kvm/kvm-all.c+6 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] guest_memfd: Fix handling for conversions of MMIO ranges

This patchset is also available at:

https://github.com/amdese/qemu/commits/gmem-fix-mmio-conversions-v1

and is based on top of qemu master (3f89b5de5b)

Overview
--------

Calls to kvm_convert_memory() currently only produce the intended behavior if the entire range is within an MMIO hole/region, or is completely covered by a guest_memfd-backed region.

In reality this is not the case:

1) some ranges contain multiple regions (e.g. multiple guest NUMA nodes backed by separate guest_memfd backends).
2) some ranges contain multiple MMIO holes (e.g. a range that contains 2 non-adjacent regions, or a single region followed by a hole)

These scenarios bring about multiple unhandled corner cases that this series is meant to address.

The section-by-section processing is also heavily guided by requirements that will come about when enabling in-place conversion support (where memory attribute tracking will move down into each guest_memfd instance and further require region-by-region processing of each range). That will be posted as a follow-up series based on this patchset.

NOTES/TODO
----------

- If TDX folks could test this that would be appreciated as SNP guests don't seem to trigger some of the original cases that were introduced for TDX guests and I only have access to SNP systems atm.

Thanks,

Mike

----------------------------------------------------------------
Ashish Kalra (1):
accel/kvm: Fix kvm_convert_memory() calls crossing memory regions

Michael Roth (3):
accel/kvm: Add helper for handling conversions of MMIO holes accel/kvm: Fix handling of MMIO holes at start of conversion ranges accel/kvm: Fix handling of conversion ranges with multiple MMIO holes

 accel/kvm/kvm-all.c | 167 +++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 125 insertions(+), 42 deletions(-)