linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Brian Gerst <brgerst@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	X86 ML <x86@kernel.org>, Peter Zijlstra <peterz@infradead.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH 3/4] x86/asm: Add asm macros for static keys/jump labels
Date: Sat, 7 Nov 2015 17:58:14 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.11.1511071754180.4032@nanos> (raw)
In-Reply-To: <CALCETrUfQSTE82phx1DeUvNq-oL_8CT-AbX4eDi10x58TRFfFw@mail.gmail.com>

On Sat, 7 Nov 2015, Andy Lutomirski wrote:
> On Nov 7, 2015 3:21 AM, "Thomas Gleixner" <tglx@linutronix.de> wrote:
> > +/* ASM jump label support */
> > +#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
> > +#include <asm/jump_label.h>
> > +
> > +       .macro STATIC_CALL_IF_ENABLED fun, key
> 
> I think we still need the "def" parameter.  But maybe the "static
> call" is a good idea.  (By giving 'def' a default value or omitting it
> entirely, it's too easy not to think about it, and that's a huge
> historical source of breakage and it's a good part of the reason for
> the new improved C API.  At least these days I *think* we'll diagnose
> the problem on bootup instead of waiting for random breakage later.)

Ok. That's easy to add :)
 
> > +       1:
> > +       jmp.d32         2f
> 
> Old binutils will choke on this.  But maybe no one has jump labels and
> old binutils.

Good question.
 
> > +       call            fun
> > +       .pushsection __jump_table, "aw"
> > +       _ASM_ALIGN
> > +       _ASM_PTR        1b, 2f, \key
> > +       .popsection
> > +       2:
> > +       .endm
> > +#else
> > +       .macro STATIC_CALL_IF_ENABLED fun, key
> > +       call            fun
> > +       .endm
> 
> This could result in errors down the road, since this macro is really
> "static call if enabled or if the kernel is built without jump
> labels".  enter_from_user_mode is special because it's already a no-op
> if context tracking is off, but I'm not sure that this oddity should
> leak into more generic code.

Hmm. Maybe we need a better name for this macro.
 
> > +#endif
> > Index: tip/arch/x86/entry/entry_64.S
> > ===================================================================
> > --- tip.orig/arch/x86/entry/entry_64.S
> > +++ tip/arch/x86/entry/entry_64.S
> > @@ -510,7 +510,7 @@ END(irq_entries_start)
> >          */
> >         SWAPGS
> >  #ifdef CONFIG_CONTEXT_TRACKING
> > -       call enter_from_user_mode
> > +       STATIC_CALL_IF_ENABLED enter_from_user_mode, context_tracking_enabled
> >  #endif
> 
> This doesn't get rid of the ifdeffery, which I thought was a nice
> feature of my patch.

Right. I was just too lazy to add another macro :)

My main point was to avoid the extra stuff for !HAVE_JUMP_LABEL and
hide this in a header file.

Thanks,

	tglx



  reply	other threads:[~2015-11-07 16:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-06 23:12 [PATCH 0/4] x86 entry stuff, maybe for 4.4 Andy Lutomirski
2015-11-06 23:12 ` [PATCH 1/4] x86/entry/64: Fix irqflag tracing wrt context tracking Andy Lutomirski
2015-11-07  9:59   ` Thomas Gleixner
2015-11-07 11:18   ` Borislav Petkov
2015-11-09  4:20     ` Andy Lutomirski
2015-11-06 23:12 ` [PATCH 2/4] context_tracking: Switch to new static_branch API Andy Lutomirski
2015-11-07  9:59   ` Thomas Gleixner
2015-11-06 23:12 ` [PATCH 3/4] x86/asm: Add asm macros for static keys/jump labels Andy Lutomirski
2015-11-07 11:20   ` Thomas Gleixner
2015-11-07 16:49     ` Andy Lutomirski
2015-11-07 16:58       ` Thomas Gleixner [this message]
2015-11-07 17:05         ` Andy Lutomirski
2015-11-07 17:08           ` Thomas Gleixner
2015-11-07 18:16             ` Andy Lutomirski
2015-11-09  9:48               ` Peter Zijlstra
2015-11-08 16:16             ` Andy Lutomirski
2015-11-06 23:12 ` [PATCH 4/4] x86/entry/64: Bypass enter_from_user_mode on non-context-tracking boots Andy Lutomirski
2015-11-09  8:52   ` Ingo Molnar

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=alpine.DEB.2.11.1511071754180.4032@nanos \
    --to=tglx@linutronix.de \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=peterz@infradead.org \
    --cc=torvalds@linux-foundation.org \
    --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;
as well as URLs for NNTP newsgroup(s).