[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b7ee10745a6ab4335229e56fa401e505ecc7e1c9.camel@intel.com>
Date: Thu, 26 Jun 2025 15:07:41 +0000
From: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
To: "Hansen, Dave" <dave.hansen@...el.com>, "bp@...en8.de" <bp@...en8.de>,
"Huang, Kai" <kai.huang@...el.com>, "peterz@...radead.org"
<peterz@...radead.org>, "hpa@...or.com" <hpa@...or.com>, "mingo@...hat.com"
<mingo@...hat.com>, "kirill.shutemov@...ux.intel.com"
<kirill.shutemov@...ux.intel.com>, "tglx@...utronix.de" <tglx@...utronix.de>
CC: "pbonzini@...hat.com" <pbonzini@...hat.com>, "seanjc@...gle.com"
<seanjc@...gle.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "x86@...nel.org" <x86@...nel.org>
Subject: Re: [PATCH] x86/virt/tdx: Further fix tdh_vp_enter() calls
instrumentable code warning
On Thu, 2025-06-26 at 01:24 +0000, Huang, Kai wrote:
> > >
> > > To fix the second problem, change tdx_tdvpr_pa() to use
> > > PFN_PHYS(page_to_pfn()) instead of page_to_phys() so that there will be
> > > no more function call inside tdx_tdvpr_pa()[*].
> >
> > To check my understanding, page_to_pfn() on CONFIG_SPARSEMEM_VMEMMAP or
> > CONFIG_FLATMEM has no function calls, but on CONFIG_SPARSEMEM, it does. We
> > are
> > counting on x86_64 to not use CONFIG_SPARSEMEM?
>
> Yes. Please see include/asm-generic/memory_model.h.
It's a little brittle, but the compiler should warn at least.
>
> >
> > >
> > > The TDVPR page is always an actual page out of page allocator, so the
> > > additional warning around pfn_valid() check in page_to_phys() doesn't
> > > help a lot anyway. It's not worth complicating the code for such
> > > warning when CONFIG_DEBUG_VIRTUAL=y.
> > >
> > > [*] Since commit cba5d9b3e99d ("x86/mm/64: Make SPARSEMEM_VMEMMAP the
> > > only memory model") page_to_pfn() has been a simple macro without
> > > any function call.
> > >
> > > Fixes: e9f17038d814 ("x86/tdx: mark tdh_vp_enter() as __flatten")
> > > Signed-off-by: Kai Huang <kai.huang@...el.com>
> >
> > Otherwise, LGTM.
>
> Is this a RB? :-)
Yes, I think this problem has been annoying. This is a decent solution all
things considered.
Reviewed-by: Rick Edgecombe <rick.p.edgecombe@...el.com>
Powered by blists - more mailing lists