Re: [PATCH] x86/virt/tdx: Further fix tdh_vp_enter() calls instrumentable code warning
From: Huang, Kai
Date: Wed Jun 25 2025 - 21:24:58 EST
> >
> > 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.
>
> >
> > 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@xxxxxxxxx>
>
> Otherwise, LGTM.
Is this a RB? :-)