mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Kai Huang <kai.huang@intel.com>,
	tglx@linutronix.de, bp@alien8.de, mingo@redhat.com,
	hpa@zytor.com, kirill.shutemov@linux.intel.com,
	rick.p.edgecombe@intel.com, x86@kernel.org,
	samitolvanen@google.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/virt/tdx: Add ENDBR for low level SEAMCALL assembly functions
Date: Thu, 5 Jun 2025 16:59:14 +0200	[thread overview]
Message-ID: <20250605145914.GW39944@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <ae0adccd-25d2-4dd3-b1b9-f7ba0c13367c@intel.com>

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.

  reply	other threads:[~2025-06-05 14:59 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 [this message]
2025-06-05 23:20         ` Huang, Kai
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=20250605145914.GW39944@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=hpa@zytor.com \
    --cc=kai.huang@intel.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --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®