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@xxxxxxxxxxxxxx/#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?