[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dc0fd831ac82f313ce9bf8bc3180b7beef565821.camel@intel.com>
Date: Tue, 27 May 2025 16:19:36 +0000
From: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
To: "pbonzini@...hat.com" <pbonzini@...hat.com>, "seanjc@...gle.com"
<seanjc@...gle.com>
CC: "Li, Xiaoyao" <xiaoyao.li@...el.com>, "kvm@...r.kernel.org"
<kvm@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, lkp <lkp@...el.com>, "Huang, Kai"
<kai.huang@...el.com>
Subject: Re: [PATCH] x86/tdx: mark tdh_vp_enter() as __flatten
On Tue, 2025-05-27 at 13:54 +0000, Sean Christopherson wrote:
> The "standard" kernel way of handling this it to mark the offending helper
> __always_inline, i.e. tag tdx_tdvpr_pa() __always_inline.
>
It looks like __flatten was added after a very similar situation:
https://lore.kernel.org/lkml/CAK8P3a2ZWfNeXKSm8K_SUhhwkor17jFo3xApLXjzfPqX0eUDUA@mail.gmail.com/#t
Since flatten gives the inline decision to the caller instead of the callee,
clang could have the option to keep a non-inline version of tdx_tdvpr_pa() for
whatever reasoning it has. The non-standard behavior around recursive inlining
is unfortunate, but we don't need it here.
The downside is that we would not learn if some code changed in page_to_phys()
and we ended up pulling in some big piece of code for the recursive behavior.
Overall I like the flatten version, but this works too:
diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
index 5699dfe500d9..371b4423a639 100644
--- a/arch/x86/virt/vmx/tdx/tdx.c
+++ b/arch/x86/virt/vmx/tdx/tdx.c
@@ -1501,7 +1501,7 @@ static inline u64 tdx_tdr_pa(struct tdx_td *td)
return page_to_phys(td->tdr_page);
}
-static inline u64 tdx_tdvpr_pa(struct tdx_vp *td)
+static __always_inline u64 tdx_tdvpr_pa(struct tdx_vp *td)
{
return page_to_phys(td->tdvpr_page);
}
> Ditto for tdx_tdr_pa().
> Especially since they're already "inline".
I don't see why tdx_tdr_pa() is required to be inlined. Why force the compiler?
Powered by blists - more mailing lists