From: Sean Christopherson <seanjc@google.com>
To: Yan Zhao <yan.y.zhao@intel.com>
Cc: Rick P Edgecombe <rick.p.edgecombe@intel.com>,
Dave Hansen <dave.hansen@intel.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-coco@lists.linux.dev" <linux-coco@lists.linux.dev>,
Kai Huang <kai.huang@intel.com>,
Xiaoyao Li <xiaoyao.li@intel.com>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"kas@kernel.org" <kas@kernel.org>,
"mingo@redhat.com" <mingo@redhat.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"binbin.wu@linux.intel.com" <binbin.wu@linux.intel.com>,
"ackerleytng@google.com" <ackerleytng@google.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Isaku Yamahata <isaku.yamahata@intel.com>,
"sagis@google.com" <sagis@google.com>,
Vishal Annapurve <vannapurve@google.com>,
"bp@alien8.de" <bp@alien8.de>,
"tglx@kernel.org" <tglx@kernel.org>,
"yilun.xu@linux.intel.com" <yilun.xu@linux.intel.com>,
"x86@kernel.org" <x86@kernel.org>
Subject: Re: [PATCH 1/2] x86/virt/tdx: Use PFN directly for mapping guest private memory
Date: Tue, 31 Mar 2026 12:13:42 -0700 [thread overview]
Message-ID: <acwc5sDHFbHJGG4O@google.com> (raw)
In-Reply-To: <acYrxIxoENyZhKCV@yzhao56-desk.sh.intel.com>
On Fri, Mar 27, 2026, Yan Zhao wrote:
> On Thu, Mar 26, 2026 at 12:57:26AM +0800, Edgecombe, Rick P wrote:
> > On Wed, 2026-03-25 at 17:10 +0800, Yan Zhao wrote:
> > > > I don't really understand what this is saying.
> > > >
> > > > Is the concern that KVM might want to set up page tables for memory
> > > > that differ from how it was allocated? I'm a bit worried that this
> > > > assumes something about folios that doesn't always hold.
> > > >
> > > > I think the hugetlbfs gigantic support uses folios in at least a
> > > > few spots today.
> > > Below is the background of this problem. I'll try to include a short
> > > summary in the next version's patch logs.
> >
> > While this patchset is kind of pre-work for TDX huge pages, the reason
> > to separate it out and push it earlier is because it has some value on
> > it's own. So I'd think to focus mostly on the impact of the change
> > today.
> >
> > How about this justification:
> > 1. Because KVM handles guest memory as PFNs, and the SEAMCALLs under
> > discussion are only used there, PFN is more natural.
> >
> > 2. The struct page was partly making sure we didn't pass a wrong arg
> > (typical type safety) and partly ensuring that KVM doesn't pass non-
> > convertible memory, however the SEAMCALLs themselves can check this for
> > the kernel. So the case is already covered by warnings.
> >
> > In conclusion, the PFN is more natural and the original purpose of
> > struct page is already covered.
Most importantly, having core TDX make assumptions based on the struct page and/or
folio will create subtle dependencies that are easily avoided.
> > Sean said somewhere IIRC that he would have NAKed the struct page thing
> > if he had seen it, for even the base support.
Yes.
> > And the two points above don't actually require discussion of even huge
> > pages. So does it actually add any value to dive into the issues you list
> > below?
> I wanted to mention the issues listed below because I'm not sure if anyone has
> the same question as me: why do we have to convert struct page to PFN if they
> can both achieve the same purpose, given that currently all private memory
> allocated by gmem has struct page backing?
From https://lore.kernel.org/all/aWgyhmTJphGQqO0Y@google.com:
: I'm not at all opposed to backing guest_memfd with "struct page", quite the
: opposite. What I don't want is to bake assumptions into KVM code that doesn't
: _require_ struct page, because that has cause KVM immense pain in the past.
:
: And I'm strongly opposed to KVM special-casing TDX or anything else, precisely
: because we struggled through all that pain so that KVM would work better with
: memory that isn't backed by "struct page", or more specifically, memory that has
: an associated "struct page", but isn't managed by core MM, e.g. isn't refcounted.
next prev parent reply other threads:[~2026-03-31 19:13 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 0:56 [PATCH 0/2] struct page to PFN conversion for TDX guest private memory Yan Zhao
2026-03-19 0:57 ` [PATCH 1/2] x86/virt/tdx: Use PFN directly for mapping " Yan Zhao
2026-03-19 10:39 ` Kiryl Shutsemau
2026-03-19 11:59 ` Yan Zhao
2026-03-19 12:14 ` Yan Zhao
2026-03-19 12:57 ` Kiryl Shutsemau
2026-03-19 17:27 ` Edgecombe, Rick P
2026-03-20 12:59 ` Kiryl Shutsemau
2026-03-20 17:31 ` Edgecombe, Rick P
2026-03-20 17:38 ` Dave Hansen
2026-03-20 17:48 ` Edgecombe, Rick P
2026-03-19 18:05 ` Dave Hansen
2026-03-25 9:10 ` Yan Zhao
2026-03-25 16:57 ` Edgecombe, Rick P
2026-03-27 7:03 ` Yan Zhao
2026-03-31 19:13 ` Sean Christopherson [this message]
2026-04-02 20:47 ` Sean Christopherson
2026-04-02 21:09 ` Dave Hansen
2026-04-02 22:11 ` Sean Christopherson
2026-04-02 23:23 ` Ackerley Tng
2026-04-02 23:35 ` Sean Christopherson
2026-04-02 23:36 ` Edgecombe, Rick P
2026-04-02 23:46 ` Sean Christopherson
2026-04-02 23:53 ` Edgecombe, Rick P
2026-03-19 0:58 ` [PATCH 2/2] x86/virt/tdx: Use PFN directly for unmapping " Yan Zhao
2026-03-19 3:20 ` Xiaoyao Li
2026-03-19 6:45 ` Yan Zhao
2026-03-19 8:56 ` Xiaoyao Li
2026-03-19 8:56 ` Yan Zhao
2026-04-04 6:39 ` Paolo Bonzini
2026-03-19 18:44 ` Edgecombe, Rick P
2026-03-19 10:48 ` Kiryl Shutsemau
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=acwc5sDHFbHJGG4O@google.com \
--to=seanjc@google.com \
--cc=ackerleytng@google.com \
--cc=binbin.wu@linux.intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=isaku.yamahata@intel.com \
--cc=kai.huang@intel.com \
--cc=kas@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rick.p.edgecombe@intel.com \
--cc=sagis@google.com \
--cc=tglx@kernel.org \
--cc=vannapurve@google.com \
--cc=x86@kernel.org \
--cc=xiaoyao.li@intel.com \
--cc=yan.y.zhao@intel.com \
--cc=yilun.xu@linux.intel.com \
/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