All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chenyi Qiang <chenyi.qiang@intel.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: qemu-devel@nongnu.org, "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: Wed, 11 Mar 2026 15:17:11 +0800	[thread overview]
Message-ID: <cf341392-bb32-4497-997e-a46902da56c5@intel.com> (raw)
In-Reply-To: <CAMxuvaycCnFjhqtv5Gvi93W-ndEDqFbdgTn-pmYbyMAOW-v7CQ@mail.gmail.com>



On 3/11/2026 12:09 AM, Marc-André Lureau wrote:
> Hi
> 
> On Tue, Mar 10, 2026 at 6:35 AM Chenyi Qiang <chenyi.qiang@intel.com> wrote:
>>
>>
>>
>> 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.
>>
> 
> It becomes increasingly hard to provide easy to setup reproducibe
> environments.. but here is the libvirt qemu command I just tested
> succesfully against:
> 
> qemu-system-x86_64 -name guest=rhel10,debug-threads=on -S -object
> {"qom-type":"secret","id":"masterKey0","format":"raw","file":"/home/elmarco/.config/libvirt/qemu/lib/domain-3-rhel10/master-key.aes"}
> -machine pc-q35-10.1,usb=off,smm=off,dump-guest-core=off,confidential-guest-support=lsec0,hpet=off,acpi=on
> -accel kvm -cpu host,migratable=on -bios
> /usr/share/edk2/ovmf/OVMF.inteltdx.fd -m
> size=4096000k,slots=1,maxmem=8192000k -overcommit mem-lock=off -smp
> 2,sockets=2,cores=1,threads=1 -object
> {"qom-type":"memory-backend-ram","id":"ram-node0","size":4194304000}
> -numa node,nodeid=0,cpus=0-1,memdev=ram-node0 -uuid
> 0f3e6b74-80e3-45e7-a0e6-ae7dfc897606 -display none -no-user-config
> -nodefaults -chardev socket,id=charmonitor,fd=23,server=on,wait=off
> -mon chardev=charmonitor,id=monitor,mode=control -rtc
> base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=delay
> -no-shutdown -global ICH9-LPC.disable_s3=1 -global
> ICH9-LPC.disable_s4=1 -boot strict=on -device
> {"driver":"pcie-root-port","port":8,"chassis":1,"id":"pci.1","bus":"pcie.0","multifunction":true,"addr":"0x1"}
> -device {"driver":"pcie-root-port","port":9,"chassis":2,"id":"pci.2","bus":"pcie.0","addr":"0x1.0x1"}
> -device {"driver":"pcie-root-port","port":10,"chassis":3,"id":"pci.3","bus":"pcie.0","addr":"0x1.0x2"}
> -device {"driver":"pcie-root-port","port":11,"chassis":4,"id":"pci.4","bus":"pcie.0","addr":"0x1.0x3"}
> -device {"driver":"pcie-root-port","port":12,"chassis":5,"id":"pci.5","bus":"pcie.0","addr":"0x1.0x4"}
> -device {"driver":"pcie-root-port","port":13,"chassis":6,"id":"pci.6","bus":"pcie.0","addr":"0x1.0x5"}
> -device {"driver":"pcie-root-port","port":14,"chassis":7,"id":"pci.7","bus":"pcie.0","addr":"0x1.0x6"}
> -device {"driver":"pcie-root-port","port":15,"chassis":8,"id":"pci.8","bus":"pcie.0","addr":"0x1.0x7"}
> -device {"driver":"pcie-root-port","port":16,"chassis":9,"id":"pci.9","bus":"pcie.0","multifunction":true,"addr":"0x2"}
> -device {"driver":"pcie-root-port","port":17,"chassis":10,"id":"pci.10","bus":"pcie.0","addr":"0x2.0x1"}
> -device {"driver":"pcie-root-port","port":18,"chassis":11,"id":"pci.11","bus":"pcie.0","addr":"0x2.0x2"}
> -device {"driver":"pcie-root-port","port":19,"chassis":12,"id":"pci.12","bus":"pcie.0","addr":"0x2.0x3"}
> -device {"driver":"pcie-root-port","port":20,"chassis":13,"id":"pci.13","bus":"pcie.0","addr":"0x2.0x4"}
> -device {"driver":"pcie-root-port","port":21,"chassis":14,"id":"pci.14","bus":"pcie.0","addr":"0x2.0x5"}
> -device {"driver":"qemu-xhci","p2":15,"p3":15,"id":"usb","bus":"pci.2","addr":"0x0"}
> -device {"driver":"virtio-serial-pci","id":"virtio-serial0","bus":"pci.3","addr":"0x0"}
> -object {"qom-type":"memory-backend-ram","id":"memvirtiomem0","reserve":false,"size":4194304000}
> -device {"driver":"virtio-mem-pci","node":0,"block-size":2097152,"memdev":"memvirtiomem0","id":"virtiomem0","bus":"pci.7","addr":"0x0"}
> -blockdev {"driver":"file","filename":"/home/elmarco/rhel-10.qcow2","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}
> -blockdev {"node-name":"libvirt-1-format","read-only":false,"driver":"qcow2","file":"libvirt-1-storage","backing":null}
> -device {"driver":"virtio-blk-pci","bus":"pci.4","addr":"0x0","drive":"libvirt-1-format","id":"virtio-disk0","bootindex":1}
> -netdev {"type":"user","id":"hostnet0"} -device
> {"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":"52:54:00:82:08:40","bus":"pci.1","addr":"0x0"}
> -chardev pty,id=charserial0 -device
> {"driver":"isa-serial","chardev":"charserial0","id":"serial0","index":0}
> -chardev socket,id=charchannel0,fd=22,server=on,wait=off -device
> {"driver":"virtserialport","bus":"virtio-serial0.0","nr":1,"chardev":"charchannel0","id":"channel0","name":"org.qemu.guest_agent.0"}
> -chardev socket,id=chrtpm,path=/run/user/1006/libvirt/qemu/run/swtpm/3-rhel10-swtpm.sock
> -tpmdev emulator,id=tpm-tpm0,chardev=chrtpm -device
> {"driver":"tpm-crb","tpmdev":"tpm-tpm0","id":"tpm0"} -audiodev
> {"id":"audio1","driver":"none"} -global ICH9-LPC.noreboot=off
> -watchdog-action reset -device
> {"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.5","addr":"0x0"}
> -object {"qom-type":"rng-random","id":"objrng0","filename":"/dev/urandom"}
> -device {"driver":"virtio-rng-pci","rng":"objrng0","id":"rng0","bus":"pci.6","addr":"0x0"}
> -object {"qom-type":"tdx-guest","id":"lsec0","quote-generation-socket":{"type":"unix","path":"/var/run/tdx-qgs/qgs.socket"},"attributes":268435456}
> -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny
> -msg timestamp=on
> 
> Then I hotplugged some mem:
> virsh --connect qemu:///session update-memory-device rhel10
> --requested-size 2GiB
> 
> [  166.228943] virtio_mem virtio5: plugged size: 0x0
> [  166.231784] virtio_mem virtio5: requested size: 0x80000000
> 
> 
> [root@rhel10-server ~]# lsmem
> RANGE                                 SIZE  STATE REMOVABLE BLOCK
> 0x0000000000000000-0x000000007fffffff   2G online       yes  0-15
> 0x0000000100000000-0x00000001ffffffff   4G online       yes 32-63
> 
> Memory block size:       128M
> Total online memory:       6G
> Total offline memory:      0B
> 
> The host kernel used is experimental; it's a patched version of
> 6.19.0-rc8 that I don't have the details)

It seems related to the memory size. Maybe you can have a try with "-m 2G,maxmem=4G".
I hit the problem when the size <= 2G and no range above 4g at the beginning.


  reply	other threads:[~2026-03-11  7:17 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
2026-03-10 16:09   ` Marc-André Lureau
2026-03-11  7:17     ` Chenyi Qiang [this message]
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=cf341392-bb32-4497-997e-a46902da56c5@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 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.