Re: [PATCH v5 00/12] Make RamDiscardManager work with multiple sources & virtio-mem

Marc-AndrĂ© Lureau <[email protected]> Mon, 22 Jun 2026 15:53:33 +0400
Newsgroups org.nongnu.qemu-rust,org.kernel.vger.kvm,org.nongnu.qemu-devel
Message-ID <CAMxuvazRnZw4PEsdKCEBD8X1ua5LMj5K-k+-oh-J_uvXm5vT1w@mail.gmail.com>
Hi Peter

On Fri, Jun 19, 2026 at 7:13=E2=80=AFPM Peter Xu <[email protected]> wrote:
>
> On Fri, Jun 19, 2026 at 12:11:48AM +0400, Marc-Andr=C3=A9 Lureau wrote:
> > Hi
> >
> > On Thu, Jun 4, 2026 at 5:46=E2=80=AFPM Marc-Andr=C3=A9 Lureau
> > <[email protected]> wrote:
> > >
> > > Hi,
> > >
> > > This is an attempt to fix the incompatibility of virtio-mem with conf=
idential
> > > VMs. The solution implements what was discussed earlier with D. Hilde=
nbrand:
> > > https://patchwork.ozlabs.org/project/qemu-devel/patch/20250407074939.=
[email protected]/#3502238
> > >
> > > The first patches are misc cleanups. Then some code refactoring to ha=
ve 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)
> >
> > Can the patch 1-11 be queued or are we missing something?
> > (RFC patch 12 can be dropped for now)
>
> Likely yes.. one thing to double check with you before I do: We don't nee=
d
> the kernel series, do we?  Since when unplug, I expect with the truncatio=
n
> approach that this series proposed, KVM will emit TDH.MEM.PAGE.REMOVE the=
n
> unaccept is done (?).

> Say, what happens if we run QEMU with this series applied, but without th=
e
> kernel series?

The kernel series is needed at least for PAGE.ACCEPT. Without it, QEMU
will have KVM_RUN return EIO, and finish into assert (while tearing
down ioeventfd).

> What confused me a bit is the dependency of this series v.s. the kernel
> one.  It seems to use different approaches, but then I don't understand w=
hy
> this series was tested with the kernel change.

My understanding is that the kernel may perform TDG.MEM.PAGE.RELEASE.
That depends on TDX config TDCS_CONFIG_PAGE_RELEASE which qemu/kvm
doesnt currently control. I don't know whether this is then
redundant/needless with qemu doing discard on the guest_memfd..