[PATCH 00/10] RFC: make RamDiscardManager work with multiple sources

marcandre.lureau@redhat.com posted 10 patches 2 days, 18 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260204100708.724800-1-marcandre.lureau@redhat.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>, Mark Kanda <mark.kanda@oracle.com>, Ben Chaney <bchaney@akamai.com>, Alex Williamson <alex@shazbot.org>, "Cédric Le Goater" <clg@redhat.com>, David Hildenbrand <david@kernel.org>, "Michael S. Tsirkin" <mst@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>
include/hw/vfio/vfio-container.h            |    2 +-
include/hw/vfio/vfio-cpr.h                  |    2 +-
include/hw/virtio/virtio-mem.h              |    3 -
include/system/memory.h                     |  285 +---
include/system/ram-discard-manager.h        |  394 ++++++
include/system/ramblock.h                   |    3 +-
accel/kvm/kvm-all.c                         |    2 +-
hw/vfio/cpr-legacy.c                        |    4 +-
hw/vfio/listener.c                          |   12 +-
hw/virtio/virtio-mem.c                      |  204 +--
migration/ram.c                             |    6 +-
system/memory.c                             |   78 +-
system/memory_mapping.c                     |    4 +-
system/ram-block-attributes.c               |  205 +--
system/ram-discard-manager.c                |  590 +++++++++
tests/unit/test-ram-discard-manager-stubs.c |   48 +
tests/unit/test-ram-discard-manager.c       | 1313 +++++++++++++++++++
system/meson.build                          |    1 +
tests/unit/meson.build                      |    8 +-
19 files changed, 2489 insertions(+), 675 deletions(-)
create mode 100644 include/system/ram-discard-manager.h
create mode 100644 system/ram-discard-manager.c
create mode 100644 tests/unit/test-ram-discard-manager-stubs.c
create mode 100644 tests/unit/test-ram-discard-manager.c
[PATCH 00/10] RFC: make RamDiscardManager work with multiple sources
Posted by marcandre.lureau@redhat.com 2 days, 18 hours ago
From: Marc-André Lureau <marcandre.lureau@redhat.com>

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.

I haven't done thorough testing. I only launched a SEV guest with a virtio-mem
device. It would be nice to have more tests for those scenarios with
VFIO/virtio-mem/confvm.. In any case, review & testing needed!

(should fix https://issues.redhat.com/browse/RHEL-131968)

thanks

Marc-André Lureau (10):
  system/rba: use DIV_ROUND_UP
  memory: drop RamDiscardListener::double_discard_supported
  virtio-mem: use warn_report_err_once()
  system/memory: minor doc fix
  kvm: replace RamDicardManager by the RamBlockAttribute
  system/memory: split RamDiscardManager into source and manager
  system/memory: move RamDiscardManager to separate compilation unit
  system/memory: constify section arguments
  memory: implement RamDiscardManager multi-source aggregation
  tests: add unit tests for RamDiscardManager multi-source aggregation

 include/hw/vfio/vfio-container.h            |    2 +-
 include/hw/vfio/vfio-cpr.h                  |    2 +-
 include/hw/virtio/virtio-mem.h              |    3 -
 include/system/memory.h                     |  285 +---
 include/system/ram-discard-manager.h        |  394 ++++++
 include/system/ramblock.h                   |    3 +-
 accel/kvm/kvm-all.c                         |    2 +-
 hw/vfio/cpr-legacy.c                        |    4 +-
 hw/vfio/listener.c                          |   12 +-
 hw/virtio/virtio-mem.c                      |  204 +--
 migration/ram.c                             |    6 +-
 system/memory.c                             |   78 +-
 system/memory_mapping.c                     |    4 +-
 system/ram-block-attributes.c               |  205 +--
 system/ram-discard-manager.c                |  590 +++++++++
 tests/unit/test-ram-discard-manager-stubs.c |   48 +
 tests/unit/test-ram-discard-manager.c       | 1313 +++++++++++++++++++
 system/meson.build                          |    1 +
 tests/unit/meson.build                      |    8 +-
 19 files changed, 2489 insertions(+), 675 deletions(-)
 create mode 100644 include/system/ram-discard-manager.h
 create mode 100644 system/ram-discard-manager.c
 create mode 100644 tests/unit/test-ram-discard-manager-stubs.c
 create mode 100644 tests/unit/test-ram-discard-manager.c

-- 
2.52.0