[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aMeskOdstg01cvMP@yzhao56-desk.sh.intel.com>
Date: Mon, 15 Sep 2025 14:05:04 +0800
From: Yan Zhao <yan.y.zhao@...el.com>
To: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
CC: "pbonzini@...hat.com" <pbonzini@...hat.com>, "seanjc@...gle.com"
<seanjc@...gle.com>, "kvm@...r.kernel.org" <kvm@...r.kernel.org>, "Li,
Xiaoyao" <xiaoyao.li@...el.com>, "Du, Fan" <fan.du@...el.com>, "Hansen, Dave"
<dave.hansen@...el.com>, "david@...hat.com" <david@...hat.com>,
"thomas.lendacky@....com" <thomas.lendacky@....com>, "vbabka@...e.cz"
<vbabka@...e.cz>, "tabba@...gle.com" <tabba@...gle.com>, "kas@...nel.org"
<kas@...nel.org>, "michael.roth@....com" <michael.roth@....com>, "Weiny, Ira"
<ira.weiny@...el.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "binbin.wu@...ux.intel.com"
<binbin.wu@...ux.intel.com>, "ackerleytng@...gle.com"
<ackerleytng@...gle.com>, "Yamahata, Isaku" <isaku.yamahata@...el.com>,
"Peng, Chao P" <chao.p.peng@...el.com>, "Annapurve, Vishal"
<vannapurve@...gle.com>, "Miao, Jun" <jun.miao@...el.com>,
"pgonda@...gle.com" <pgonda@...gle.com>, "x86@...nel.org" <x86@...nel.org>
Subject: Re: [RFC PATCH v2 18/23] x86/virt/tdx: Do not perform cache flushes
unless CLFLUSH_BEFORE_ALLOC is set
On Fri, Sep 05, 2025 at 11:41:41PM +0800, Edgecombe, Rick P wrote:
> On Thu, 2025-08-07 at 17:45 +0800, Yan Zhao wrote:
> > From: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
> >
> > The TDX module enumerates with a TDX_FEATURES0 bit if an explicit cache
> > flush is necessary when switching KeyID for a page, like before
> > handing the page over to a TD.
> >
> > Currently, none of the TDX-capable platforms have this bit enabled.
> >
> > Moreover, cache flushing with TDH.PHYMEM.PAGE.WBINVD fails if
> > Dynamic PAMT is active and the target page is not 4k. The SEAMCALL only
> > supports 4k pages and will fail if there is no PAMT_4K for the HPA.
Back to when Kirill was enabling DPAMT for huge pages, TDH.PHYMEM.PAGE.WBINVD
did fail in this scenario.
However, this has been fixed in TDX_1.5.20, which is why I didn't encounter
this issue when posting this series.
> > Avoid performing these cache flushes unless the CLFLUSH_BEFORE_ALLOC bit
> > of TDX_FEATURES0 is set.
> >
> > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
> > Signed-off-by: Yan Zhao <yan.y.zhao@...el.com>
>
> I think I mentioned this on some version of this patch already, but during the
> base series we decided to assume CLFLUSH_BEFORE_ALLOC was always set for
> simplicity. Let's try to be consistent.
Right, though CLFLUSH_BEFORE_ALLOC is always false in all current TDX modules,
linux conservatively assumes it's always true.
> Why prepare for some future TDX module that sets CLFLUSH_BEFORE_ALLOC *and* adds
> new support for at larger page sizes TDH.PHYMEM.PAGE.WBINVD? It almost seems
> like this is working around a bug.
As the TDX module bug is gone, let's drop this patch to be consistent with the
policy of assuming CLFLUSH_BEFORE_ALLOC is always true.
Powered by blists - more mailing lists