From: "Huang, Kai" <kai.huang@intel.com>
To: "peterz@infradead.org" <peterz@infradead.org>,
"Hansen, Dave" <dave.hansen@intel.com>
Cc: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>,
"samitolvanen@google.com" <samitolvanen@google.com>,
"bp@alien8.de" <bp@alien8.de>, "x86@kernel.org" <x86@kernel.org>,
"hpa@zytor.com" <hpa@zytor.com>,
"mingo@redhat.com" <mingo@redhat.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"kirill.shutemov@linux.intel.com"
<kirill.shutemov@linux.intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86/virt/tdx: Add ENDBR for low level SEAMCALL assembly functions
Date: Thu, 5 Jun 2025 23:20:59 +0000 [thread overview]
Message-ID: <54b6e468c5c359e0e5062eabb6601062d9d0bbc7.camel@intel.com> (raw)
In-Reply-To: <20250605145914.GW39944@noisy.programming.kicks-ass.net>
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?
next prev parent reply other threads:[~2025-06-05 23:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-04 0:38 Kai Huang
2025-06-04 19:46 ` Dave Hansen
2025-06-04 23:16 ` Huang, Kai
2025-06-04 23:23 ` Dave Hansen
2025-06-04 23:27 ` Huang, Kai
2025-06-04 23:57 ` Huang, Kai
2025-06-05 13:12 ` Huang, Kai
2025-06-05 13:10 ` [PATCH v2] x86/virt/tdx: Annotate TDX assembly to allow indirect calls Kai Huang
2025-06-05 14:07 ` [PATCH] x86/virt/tdx: Add ENDBR for low level SEAMCALL assembly functions Peter Zijlstra
2025-06-05 14:21 ` Peter Zijlstra
2025-06-05 14:54 ` Dave Hansen
2025-06-05 14:59 ` Peter Zijlstra
2025-06-05 23:20 ` Huang, Kai [this message]
2025-06-05 23:23 ` Dave Hansen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54b6e468c5c359e0e5062eabb6601062d9d0bbc7.camel@intel.com \
--to=kai.huang@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=hpa@zytor.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rick.p.edgecombe@intel.com \
--cc=samitolvanen@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®