[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <54b6e468c5c359e0e5062eabb6601062d9d0bbc7.camel@intel.com>
Date: Thu, 5 Jun 2025 23:20:59 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "peterz@...radead.org" <peterz@...radead.org>, "Hansen, Dave"
<dave.hansen@...el.com>
CC: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>,
"samitolvanen@...gle.com" <samitolvanen@...gle.com>, "bp@...en8.de"
<bp@...en8.de>, "x86@...nel.org" <x86@...nel.org>, "hpa@...or.com"
<hpa@...or.com>, "mingo@...hat.com" <mingo@...hat.com>, "tglx@...utronix.de"
<tglx@...utronix.de>, "kirill.shutemov@...ux.intel.com"
<kirill.shutemov@...ux.intel.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86/virt/tdx: Add ENDBR for low level SEAMCALL assembly
functions
On Thu, 2025-06-05 at 16:59 +0200, Peter Zijlstra wrote:
> On Thu, Jun 05, 2025 at 07:54:48AM -0700, Dave Hansen wrote:
> > On 6/5/25 07:21, Peter Zijlstra wrote:
> > > -static inline u64 sc_retry(sc_func_t func, u64 fn,
> > > - struct tdx_module_args *args)
> > > +static __always_inline u64 sc_retry(const sc_func_t func, u64 fn,
> > > + struct tdx_module_args *args)
> > > {
> > > int retry = RDRAND_RETRY_LOOPS;
> >
> > Practically, I can see how this works. If the compiler doesn't inline
> > sc_retry(), it stops being able to guarantee that the function pointer
> > value is known.
> >
> > My only worry is that the compiler decides to be stupid for some other
> > reason, it could start generating indirect calls again.
> >
> > Are we confident that __always_inline will keep the compiler from
> > generating indirect calls?
>
> Fairly sure. I've used this elsewhere too.
>
> Also, if it ever decides to be that stupid, I'm going to log a bug and
> call it broken.
Thanks Peter for helping.
I verified Peter's change, and I confirm that fixes those warnings. Both
gcc and clang (with CFI) build successfully w/o those warnings.
Hi Dave,
Just wondering are you happy with Peter's change?
Powered by blists - more mailing lists