Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1264885
| From | Andy Lutomirski <luto@amacapital.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 3/4] x86/asm: Add asm macros for static keys/jump labels |
| Date | 2015-11-07 18:00 +0100 |
| Message-ID | <qsf0m-4OL-13@gated-at.bofh.it> (permalink) |
| References | <qrYsx-2Hd-3@gated-at.bofh.it> <qrYsy-2Hd-17@gated-at.bofh.it> <qs9QZ-1CF-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Nov 7, 2015 3:21 AM, "Thomas Gleixner" <tglx@linutronix.de> wrote: > > On Fri, 6 Nov 2015, Andy Lutomirski wrote: > > > Unfortunately, these only work if HAVE_JUMP_LABEL. In principle, we > > could do some serious surgery on the core jump label infrastructure > > to keep the patch infrastructure available on x86 on all builds, but > > that's probably not worth it. > > No, but we can be smarter about it. There is nothing which that asm > entry code needs from linux/jump_label.h and asm/jump_label.h execpt > STATIC_KEY_INIT_NOP. Something like the patch below should do the > trick. I like some bits of this. See below. > > Thanks, > > tglx > > Index: tip/arch/x86/entry/calling.h > =================================================================== > --- tip.orig/arch/x86/entry/calling.h > +++ tip/arch/x86/entry/calling.h > @@ -232,3 +232,22 @@ For 32-bit we have the following convent > > #endif /* CONFIG_X86_64 */ > > +/* 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.) > + 1: > + jmp.d32 2f Old binutils will choke on this. But maybe no one has jump labels and old binutils. > + 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. > +#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. --Andy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 0/4] x86 entry stuff, maybe for 4.4 Andy Lutomirski <luto@kernel.org> - 2015-11-07 00:20 +0100
[PATCH 4/4] x86/entry/64: Bypass enter_from_user_mode on non-context-tracking boots Andy Lutomirski <luto@kernel.org> - 2015-11-07 00:20 +0100
Re: [PATCH 4/4] x86/entry/64: Bypass enter_from_user_mode on non-context-tracking boots Ingo Molnar <mingo@kernel.org> - 2015-11-09 10:00 +0100
[PATCH 3/4] x86/asm: Add asm macros for static keys/jump labels Andy Lutomirski <luto@kernel.org> - 2015-11-07 00:20 +0100
Re: [PATCH 3/4] x86/asm: Add asm macros for static keys/jump labels Thomas Gleixner <tglx@linutronix.de> - 2015-11-07 12:30 +0100
Re: [PATCH 3/4] x86/asm: Add asm macros for static keys/jump labels Thomas Gleixner <tglx@linutronix.de> - 2015-11-07 18:00 +0100
Re: [PATCH 3/4] x86/asm: Add asm macros for static keys/jump labels Thomas Gleixner <tglx@linutronix.de> - 2015-11-07 18:10 +0100
Re: [PATCH 3/4] x86/asm: Add asm macros for static keys/jump labels Andy Lutomirski <luto@amacapital.net> - 2015-11-07 19:20 +0100
Re: [PATCH 3/4] x86/asm: Add asm macros for static keys/jump labels Peter Zijlstra <peterz@infradead.org> - 2015-11-09 10:50 +0100
Re: [PATCH 3/4] x86/asm: Add asm macros for static keys/jump labels Andy Lutomirski <luto@amacapital.net> - 2015-11-08 17:20 +0100
Re: [PATCH 3/4] x86/asm: Add asm macros for static keys/jump labels Andy Lutomirski <luto@amacapital.net> - 2015-11-07 18:10 +0100
Re: [PATCH 3/4] x86/asm: Add asm macros for static keys/jump labels Andy Lutomirski <luto@amacapital.net> - 2015-11-07 18:00 +0100
csiph-web