public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Chenyi Qiang <chenyi.qiang@intel.com>
To: <marcandre.lureau@redhat.com>, <qemu-devel@nongnu.org>
Cc: "Ben Chaney" <bchaney@akamai.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Cédric Le Goater" <clg@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Alex Williamson" <alex@shazbot.org>,
	"Fabiano Rosas" <farosas@suse.de>,
	"David Hildenbrand" <david@kernel.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Peter Xu" <peterx@redhat.com>,
	kvm@vger.kernel.org, "Mark Kanda" <mark.kanda@oracle.com>
Subject: Re: [PATCH v3 00/15] Make RamDiscardManager work with multiple sources
Date: Tue, 10 Mar 2026 10:35:25 +0800	[thread overview]
Message-ID: <ce681660-d47c-4ba6-9237-eef55a87493c@intel.com> (raw)
In-Reply-To: <20260226140001.3622334-1-marcandre.lureau@redhat.com>



On 2/26/2026 9:59 PM, marcandre.lureau@redhat.com wrote:
> 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!

Is this series aimed to enable virtio-mem (memory hotplug) in a confidential VM?
I tested it within a TD guest using the qemu command:

qemu-system-x86_64
	...
        -m 2G,maxmem=10G \
        -smp sockets=1,cores=2 \
        -object memory-backend-ram,id=mem0,size=2G \
        -numa node,nodeid=0,cpus=0-1,memdev=mem0 \
        -object memory-backend-ram,id=vmem0,size=8G \
        -device virtio-mem-pci,id=vm0,memdev=vmem0,node=0,requested-size=300M \
        -object tdx-guest,id=tdx \
        -machine q35,kernel_irqchip=split,hpet=off,memory-encryption=tdx \
        ...

The TD VM will exit with the error when the guest kernel loads the virtio-mem driver:

    kvm_intel: Guest access before accepting 0x108008000 on vCPU 0

I think it still lacks some support to accept the TD guest memory before using it.

> 
> (should fix https://issues.redhat.com/browse/RHEL-131968)
> 
> 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
> 
> thanks
> 
> Marc-André Lureau (15):
>   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
>   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
> 
>  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                     |  287 +----
>  include/system/ram-discard-manager.h        |  358 ++++++
>  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                      |  290 +----
>  migration/ram.c                             |    6 +-
>  system/memory.c                             |   83 +-
>  system/memory_mapping.c                     |    4 +-
>  system/physmem.c                            |    2 +-
>  system/ram-block-attributes.c               |  279 +----
>  system/ram-discard-manager.c                |  612 +++++++++
>  tests/unit/test-ram-discard-manager-stubs.c |   48 +
>  tests/unit/test-ram-discard-manager.c       | 1234 +++++++++++++++++++
>  system/meson.build                          |    1 +
>  tests/unit/meson.build                      |    8 +-
>  20 files changed, 2361 insertions(+), 879 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
> 


  parent reply	other threads:[~2026-03-10  2:35 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-26 13:59 [PATCH v3 00/15] Make RamDiscardManager work with multiple sources marcandre.lureau
2026-02-26 13:59 ` [PATCH v3 01/15] system/rba: use DIV_ROUND_UP marcandre.lureau
2026-03-03 18:57   ` Peter Xu
2026-02-26 13:59 ` [PATCH v3 02/15] memory: drop RamDiscardListener::double_discard_supported marcandre.lureau
2026-02-26 15:58   ` David Hildenbrand
2026-03-03 18:57   ` Peter Xu
2026-02-26 13:59 ` [PATCH v3 03/15] virtio-mem: use warn_report_err_once() marcandre.lureau
2026-02-26 15:57   ` David Hildenbrand
2026-03-03 18:58   ` Peter Xu
2026-02-26 13:59 ` [PATCH v3 04/15] system/memory: minor doc fix marcandre.lureau
2026-02-26 15:58   ` David Hildenbrand
2026-03-03 18:59   ` Peter Xu
2026-02-26 13:59 ` [PATCH v3 05/15] kvm: replace RamDicardManager by the RamBlockAttribute marcandre.lureau
2026-03-03 18:59   ` Peter Xu
2026-03-04  9:09   ` Chenyi Qiang
2026-02-26 13:59 ` [PATCH v3 06/15] system/memory: split RamDiscardManager into source and manager marcandre.lureau
2026-03-03 19:45   ` Peter Xu
2026-03-04  9:51   ` Chenyi Qiang
2026-02-26 13:59 ` [PATCH v3 07/15] system/memory: move RamDiscardManager to separate compilation unit marcandre.lureau
2026-03-03 19:47   ` Peter Xu
2026-02-26 13:59 ` [PATCH v3 08/15] system/memory: constify section arguments marcandre.lureau
2026-03-03 19:48   ` Peter Xu
2026-02-26 13:59 ` [PATCH v3 09/15] system/ram-discard-manager: implement replay via is_populated iteration marcandre.lureau
2026-02-26 16:01   ` David Hildenbrand
2026-03-03 10:47     ` Marc-André Lureau
2026-03-03 20:27       ` Peter Xu
2026-02-26 13:59 ` [PATCH v3 10/15] virtio-mem: remove replay_populated/replay_discarded implementation marcandre.lureau
2026-02-26 13:59 ` [PATCH v3 11/15] system/ram-discard-manager: drop replay from source interface marcandre.lureau
2026-02-26 13:59 ` [PATCH v3 12/15] system/memory: implement RamDiscardManager multi-source aggregation marcandre.lureau
2026-03-03 21:16   ` Peter Xu
2026-02-26 13:59 ` [PATCH v3 13/15] system/physmem: destroy ram block attributes before RCU-deferred reclaim marcandre.lureau
2026-03-03 21:31   ` Peter Xu
2026-02-26 13:59 ` [PATCH v3 14/15] system/memory: add RamDiscardManager reference counting and cleanup marcandre.lureau
2026-03-03 21:33   ` Peter Xu
2026-02-26 14:00 ` [PATCH v3 15/15] tests: add unit tests for RamDiscardManager multi-source aggregation marcandre.lureau
2026-03-03 21:28 ` [PATCH v3 00/15] Make RamDiscardManager work with multiple sources Peter Xu
2026-03-03 22:33   ` Marc-André Lureau
2026-03-09 18:25 ` Peter Xu
2026-03-10  2:35 ` Chenyi Qiang [this message]
2026-03-10 16:09   ` Marc-André Lureau
2026-03-11  7:17     ` Chenyi Qiang
2026-03-11 14:12       ` Marc-André Lureau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ce681660-d47c-4ba6-9237-eef55a87493c@intel.com \
    --to=chenyi.qiang@intel.com \
    --cc=alex@shazbot.org \
    --cc=bchaney@akamai.com \
    --cc=clg@redhat.com \
    --cc=david@kernel.org \
    --cc=farosas@suse.de \
    --cc=kvm@vger.kernel.org \
    --cc=marcandre.lureau@redhat.com \
    --cc=mark.kanda@oracle.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox