public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Alexandre Chartre <alexandre.chartre@oracle.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>,
	Julien Thierry <jthierry@redhat.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de
Subject: Re: [PATCH 4/7] objtool: Add support for return trampoline call
Date: Mon, 6 Apr 2020 11:31:43 +0200	[thread overview]
Message-ID: <20200406093143.GH20730@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <27f433a3-6109-9831-5292-3df4155e10fb@oracle.com>

On Mon, Apr 06, 2020 at 10:19:56AM +0200, Alexandre Chartre wrote:
> 
> On 4/4/20 5:51 PM, Peter Zijlstra wrote:
> > On Sat, Apr 04, 2020 at 09:22:32AM -0500, Josh Poimboeuf wrote:
> > > On Sat, Apr 04, 2020 at 03:32:18PM +0200, Peter Zijlstra wrote:
> > > > On Fri, Apr 03, 2020 at 05:46:20PM +0200, Peter Zijlstra wrote:
> > > > > On Fri, Apr 03, 2020 at 10:17:57AM -0500, Josh Poimboeuf wrote:
> > > > > > Peter, I think my previous idea for UNWIND_HINT_ADJUST stack_add=8 would
> > > > > > work here?
> > > > > 
> > > > > Yes, it would.
> > > > 
> > > > Sorry, I have reconsidered. While it will shut up objtool, it will not
> > > > 'work'. That is, the ORC data generated will not correctly unwind.
> > > > 
> > > > I'll try and write a longer email tonight.
> > > 
> > > Right, that's what I've been trying to say.  The ORC data will be
> > > non-deterministic unless we unroll the loop.  Or did you mean something
> > > else?
> > 
> > The below should result in deterministic code.
> > 
> > diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h
> > index 07e95dcb40ad..109ee65f4a11 100644
> > --- a/arch/x86/include/asm/nospec-branch.h
> > +++ b/arch/x86/include/asm/nospec-branch.h
> > @@ -59,8 +59,8 @@
> >   	jmp	775b;				\
> >   774:						\
> >   	dec	reg;				\
> > -	jnz	771b;				\
> > -	add	$(BITS_PER_LONG/8) * nr, sp;
> > +	add	$(BITS_PER_LONG/8) * $2, sp;	\
> > +	jnz	771b;
> >   #ifdef __ASSEMBLY__
> 
> Nice. This works fine and allows to remove ANNOTATE_NOSPEC_ALTERNATIVE when
> using __FILL_RETURN_BUFFER. However this is probably less performant because
> we now have nr/2 add instructions instead of just 1.

Does it actually matter though? That is, can you measure the difference?

  reply	other threads:[~2020-04-06  9:41 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-02  8:22 [PATCH 0/7] objtool changes to remove most ANNOTATE_NOSPEC_ALTERNATIVE Alexandre Chartre
2020-04-02  8:22 ` [PATCH 1/7] objtool: is_fentry_call() crashes if call has no destination Alexandre Chartre
2020-04-02  8:22 ` [PATCH 2/7] objtool: Allow branches within the same alternative Alexandre Chartre
2020-04-02 12:03   ` Julien Thierry
2020-04-02 12:38     ` Alexandre Chartre
2020-04-02  8:22 ` [PATCH 3/7] objtool: Add support for intra-function calls Alexandre Chartre
2020-04-02 12:53   ` Julien Thierry
2020-04-02 13:24     ` Alexandre Chartre
2020-04-02 13:38       ` Julien Thierry
2020-04-02 14:56         ` Alexandre Chartre
2020-04-02 15:04       ` Peter Zijlstra
2020-04-02 15:54         ` Josh Poimboeuf
2020-04-03  7:06           ` Alexandre Chartre
2020-04-02 15:49     ` Josh Poimboeuf
2020-04-02 17:27       ` Josh Poimboeuf
2020-04-03  8:01       ` Julien Thierry
2020-04-03 12:41         ` Peter Zijlstra
2020-04-03 12:49           ` Julien Thierry
2020-04-03 14:37             ` Peter Zijlstra
2020-04-03 14:44         ` Josh Poimboeuf
2020-04-02  8:22 ` [PATCH 4/7] objtool: Add support for return trampoline call Alexandre Chartre
2020-04-02 13:26   ` Julien Thierry
2020-04-02 14:46     ` Alexandre Chartre
2020-04-02 15:31       ` Julien Thierry
2020-04-02 15:40         ` Peter Zijlstra
2020-04-03  8:11           ` Julien Thierry
2020-04-03 15:17             ` Josh Poimboeuf
2020-04-03 15:22               ` Josh Poimboeuf
2020-04-03 15:32                 ` Josh Poimboeuf
2020-04-03 15:46               ` Peter Zijlstra
2020-04-03 15:55                 ` Josh Poimboeuf
2020-04-04 13:32                 ` Peter Zijlstra
2020-04-04 14:22                   ` Josh Poimboeuf
2020-04-04 15:51                     ` Peter Zijlstra
2020-04-06  8:19                       ` Alexandre Chartre
2020-04-06  9:31                         ` Peter Zijlstra [this message]
2020-04-06 11:03                           ` Alexandre Chartre
2020-04-06 14:16                       ` Josh Poimboeuf
2020-04-02 15:27   ` Peter Zijlstra
2020-04-03  7:19     ` Alexandre Chartre
2020-04-06 14:34     ` Alexandre Chartre
2020-04-06 14:55       ` Alexandre Chartre
2020-04-02  8:22 ` [PATCH 5/7] x86/speculation: Annotate intra-function calls Alexandre Chartre
2020-04-03 16:05   ` Josh Poimboeuf
2020-04-03 16:16     ` Josh Poimboeuf
2020-04-03 17:14       ` Alexandre Chartre
2020-04-03 17:18         ` Peter Zijlstra
2020-04-03 17:24           ` Josh Poimboeuf
2020-04-03 18:20             ` Peter Zijlstra
2020-04-02  8:22 ` [PATCH 6/7] x86/speculation: Annotate retpoline return instructions Alexandre Chartre
2020-04-02  8:22 ` [PATCH 7/7] x86/speculation: Remove most ANNOTATE_NOSPEC_ALTERNATIVE Alexandre Chartre

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=20200406093143.GH20730@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=alexandre.chartre@oracle.com \
    --cc=jpoimboe@redhat.com \
    --cc=jthierry@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --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