Make RamDiscardManager work with multiple sources & virtio-mem
Status from this message: I queued patch 1-11, will send a pull this week. Thanks for all the
Get series with b4
b4 am [email protected] change-id 20260414-rdm5-b6df2366d603Versions newest first
- v5 Latest12 patches 15 repliesApplied
- v413 patches 28 repliesSuperseded inferred link
- v315 patches 26 repliesSuperseded inferred link
Earlier versions · 2
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v2 | 14 patches | 2 replies | Superseded inferred link | |
| v1 | 10 patches | 9 replies | Superseded |
Changes in v5 from the cover letter
- explain why InterfaceClass in rust binding is not needed after moving RamDiscardSource
- drop extraneous added blank line
- replaced a runtime "if (has_rdm)"" with an assert()
- dropped "RFC: hw/virtio: start virtio-mem guest_memfd regions as shared", in favour of start-private memory approach from "[RFC PATCH 0/6] Support virtio-mem memory hotplug in TDX guests" [1]
- demote "monitor: add 'info ramblock-attributes'" as RFC
- rebased and collected trailers
Patches in v5 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/12 | system/memory: split RamDiscardManager into source and managerhw/ include/ include/ +3 more | +385 | 1 reply | |
| 2/12 | system/memory: move RamDiscardManager to separate compilation unitMAINTAINERS include/ include/ +4 more | +542 | 1 reply | |
| 3/12 | system/memory: constify section argumentshw/ hw/ hw/ +7 more | +35 | 3 replies | |
| 4/12 | system/ram-discard-manager: implement replay via is_populated iterationsystem/ | +61 | 1 reply | |
| 5/12 | virtio-mem: remove replay_populated/replay_discarded implementationhw/ | +0 | 0 replies | |
| 6/12 | system/ram-discard-manager: drop replay from source interfaceinclude/ system/ | +10 | 0 replies | |
| 7/12 | system/memory: implement RamDiscardManager multi-source aggregationhw/ include/ include/ +3 more | +518 | 0 replies | |
| 8/12 | system/physmem: destroy ram block attributes before RCU-deferred reclaimsystem/ | +1 | 0 replies | |
| 9/12 | system/memory: add RamDiscardManager reference counting and cleanupsystem/ system/ | +13 | 0 replies | |
| 10/12 | tests: add unit tests for RamDiscardManager multi-source aggregationMAINTAINERS tests/ tests/ +1 more | +1292 | 0 replies | |
| 11/12 | system/physmem: make ram_block_discard_range() handle guest_memfdaccel/ include/ system/ +2 more | +26 | 0 replies | |
| 12/12 | RFC: monitor: add 'info ramblock-attributes' commandhmp-commands-info.hx hw/ include/ +2 more | +173 | 3 replies |
Reviews trailers per patch
11 of 12 patches have a Reviewed-by or Acked-by.
| Patch | Peter Xu | David Hildenbrand | Cédric Le Goater | Xiaoyao Li | Dr. David Alan Gilbert | Maciej S. Szmigiero | Philippe Mathieu-Daudé |
|---|---|---|---|---|---|---|---|
| 1/12 | R-b | A-b | R-b | ||||
| 2/12 | R-b | A-b | R-b | ||||
| 3/12 | R-b | A-b | R-b | A-b | R-b | ||
| 4/12 | R-b | A-b | |||||
| 5/12 | R-b | A-b | |||||
| 6/12 | R-b | A-b | |||||
| 7/12 | R-b | ||||||
| 8/12 | R-b | ||||||
| 9/12 | R-b | ||||||
| 10/12 | |||||||
| 11/12 | R-b | R-b | |||||
| 12/12 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 7 reviewers.
Cover letter [PATCH v5 00/12] Make RamDiscardManager work with multiple sources & virtio-mem
Hi,
This is an attempt to fix the incompatibility of virtio-mem with confidential VMs. The solution implements what was discussed earlier with D. Hildenbrand:
https://patchwork.ozlabs.org/project/qemu-devel/patch/[email protected]/#3502238
The first patches are misc cleanups. Then some code refactoring to have split a manager/source. And finally, the manager learns to deal with multiple sources.
This has been tested together with the Linux kernel series from Zhenzhong Duan [1] for TDX guests.
(help fix https://issues.redhat.com/browse/RHEL-131968)
v5:
- explain why InterfaceClass in rust binding is not needed after moving RamDiscardSource
- drop extraneous added blank line
- replaced a runtime "if (has_rdm)"" with an assert()
- dropped "RFC: hw/virtio: start virtio-mem guest_memfd regions as shared", in favour of start-private memory approach from "[RFC PATCH 0/6] Support virtio-mem memory hotplug in TDX guests" [1]
- demote "monitor: add 'info ramblock-attributes'" as RFC
- rebased and collected trailers
v4:
- added "system/physmem: make ram_block_discard_range() handle guest_memfd"
- added "monitor: add 'info ramblock-attributes' command"
- added "RFC: hw/virtio: start virtio-mem guest_memfd regions as shared"
- skip calling source in notify_populate (it may not have updated its internal state)
- rebased, collected trailer tags
v3: issues found by Cédric
- fix assertion error on shutdown, due to rcu-defer cleanup
- fix API doc warnings
v2:
- drop replay_{populated,discarded} from source, suggested by Peter Xu
- add extra manager cleanup
- add r-b tags for preliminary patches
- Link to v4: https://lore.kernel.org/qemu-devel/[email protected]
[1]: https://lore.kernel.org/lkml/[email protected]/
---
Marc-André Lureau (12):
system/memory: split RamDiscardManager into source and manager system/memory: move RamDiscardManager to separate compilation unit system/memory: constify section arguments system/ram-discard-manager: implement replay via is_populated iteration
virtio-mem: remove replay_populated/replay_discarded implementation system/ram-discard-manager: drop replay from source interface system/memory: implement RamDiscardManager multi-source aggregation system/physmem: destroy ram block attributes before RCU-deferred reclaim system/memory: add RamDiscardManager reference counting and cleanup
tests: add unit tests for RamDiscardManager multi-source aggregation system/physmem: make ram_block_discard_range() handle guest_memfd
RFC: monitor: add 'info ramblock-attributes' command
MAINTAINERS | 4 + qapi/machine.json | 56 ++ include/hw/vfio/vfio-container.h | 2 +- include/hw/vfio/vfio-cpr.h | 2 +- include/hw/virtio/virtio-mem.h | 3 - include/monitor/hmp.h | 1 + include/system/memory.h | 279 +----- include/system/ram-discard-manager.h | 358 ++++++++ include/system/ramblock.h | 5 +- accel/kvm/kvm-all.c | 2 +- hw/core/machine-hmp-cmds.c | 32 + hw/vfio/cpr-legacy.c | 4 +- hw/vfio/listener.c | 10 +- hw/virtio/virtio-mem.c | 259 +----- migration/ram.c | 6 +- system/memory.c | 88 +- system/memory_mapping.c | 4 +- system/physmem.c | 27 +- system/ram-block-attributes.c | 328 +++---- system/ram-discard-manager.c | 612 +++++++++++++ target/i386/kvm/tdx.c | 2 +- tests/unit/test-ram-discard-manager-stubs.c | 48 ++ tests/unit/test-ram-discard-manager.c | 1235 +++++++++++++++++++++++++++ hmp-commands-info.hx | 13 + rust/bindings/system-sys/lib.rs | 2 +- system/meson.build | 1 + system/trace-events | 2 +- tests/unit/meson.build | 8 +- 28 files changed, 2569 insertions(+), 824 deletions(-)
---
base-commit: 405c32d2b18a683ba36301351af75125d9afda08
change-id: 20260414-rdm5-b6df2366d603
Best regards,
Signature · 1 line
Marc-André Lureau <[email protected]>