All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 00/12] Make RamDiscardManager work with multiple sources & virtio-mem
@ 2026-06-04 13:43 Marc-André Lureau
  2026-06-04 13:43 ` [PATCH v5 01/12] system/memory: split RamDiscardManager into source and manager Marc-André Lureau
                   ` (11 more replies)
  0 siblings, 12 replies; 19+ messages in thread
From: Marc-André Lureau @ 2026-06-04 13:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Zhenzhong Duan, Michael S. Tsirkin, David Hildenbrand,
	Paolo Bonzini, Peter Xu, Philippe Mathieu-Daudé, qemu-rust,
	Alex Williamson, Cédric Le Goater, Maciej S. Szmigiero,
	Fabiano Rosas, Mark Kanda, Ben Chaney, Marcelo Tosatti, kvm,
	Dr. David Alan Gilbert, Zhao Liu, Eric Blake, Markus Armbruster,
	Marc-André Lureau, Xiaoyao Li

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/20250407074939.18657-5-chenyi.qiang@intel.com/#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/20260504-rdm5-v4-0-bdf61e57c1e1@redhat.com

[1]: https://lore.kernel.org/lkml/20260604093551.1511079-1-zhenzhong.duan@intel.com/

---
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,
--  
Marc-André Lureau <marcandre.lureau@redhat.com>



^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2026-06-08 13:36 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-04 13:43 [PATCH v5 00/12] Make RamDiscardManager work with multiple sources & virtio-mem Marc-André Lureau
2026-06-04 13:43 ` [PATCH v5 01/12] system/memory: split RamDiscardManager into source and manager Marc-André Lureau
2026-06-04 13:43 ` [PATCH v5 02/12] system/memory: move RamDiscardManager to separate compilation unit Marc-André Lureau
2026-06-04 13:43 ` [PATCH v5 03/12] system/memory: constify section arguments Marc-André Lureau
2026-06-05 11:16   ` David Hildenbrand (Arm)
2026-06-08 12:48   ` Maciej S. Szmigiero
2026-06-04 13:43 ` [PATCH v5 04/12] system/ram-discard-manager: implement replay via is_populated iteration Marc-André Lureau
2026-06-05 12:00   ` David Hildenbrand (Arm)
2026-06-04 13:43 ` [PATCH v5 05/12] virtio-mem: remove replay_populated/replay_discarded implementation Marc-André Lureau
2026-06-04 13:43 ` [PATCH v5 06/12] system/ram-discard-manager: drop replay from source interface Marc-André Lureau
2026-06-04 13:43 ` [PATCH v5 07/12] system/memory: implement RamDiscardManager multi-source aggregation Marc-André Lureau
2026-06-04 13:43 ` [PATCH v5 08/12] system/physmem: destroy ram block attributes before RCU-deferred reclaim Marc-André Lureau
2026-06-04 13:43 ` [PATCH v5 09/12] system/memory: add RamDiscardManager reference counting and cleanup Marc-André Lureau
2026-06-04 13:43 ` [PATCH v5 10/12] tests: add unit tests for RamDiscardManager multi-source aggregation Marc-André Lureau
2026-06-04 13:43 ` [PATCH v5 11/12] system/physmem: make ram_block_discard_range() handle guest_memfd Marc-André Lureau
2026-06-04 13:43 ` [PATCH v5 12/12] RFC: monitor: add 'info ramblock-attributes' command Marc-André Lureau
2026-06-05 13:28   ` Dr. David Alan Gilbert
2026-06-08 13:36     ` Markus Armbruster
2026-06-08 13:30   ` Markus Armbruster

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.