linux/arch/mips
Peter Zijlstra 2ca8c2cccc locking/static_keys: Add a new static_key interface
commit 11276d5306 upstream.

There are various problems and short-comings with the current
static_key interface:

 - static_key_{true,false}() read like a branch depending on the key
   value, instead of the actual likely/unlikely branch depending on
   init value.

 - static_key_{true,false}() are, as stated above, tied to the
   static_key init values STATIC_KEY_INIT_{TRUE,FALSE}.

 - we're limited to the 2 (out of 4) possible options that compile to
   a default NOP because that's what our arch_static_branch() assembly
   emits.

So provide a new static_key interface:

  DEFINE_STATIC_KEY_TRUE(name);
  DEFINE_STATIC_KEY_FALSE(name);

Which define a key of different types with an initial true/false
value.

Then allow:

   static_branch_likely()
   static_branch_unlikely()

to take a key of either type and emit the right instruction for the
case.

This means adding a second arch_static_branch_jump() assembly helper
which emits a JMP per default.

In order to determine the right instruction for the right state,
encode the branch type in the LSB of jump_entry::key.

This is the final step in removing the naming confusion that has led to
a stream of avoidable bugs such as:

  a833581e37 ("x86, perf: Fix static_key bug in load_mm_cr4()")

... but it also allows new static key combinations that will give us
performance enhancements in the subsequent patches.

Tested-by: Rabin Vincent <rabin@rab.in> # arm
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Michael Ellerman <mpe@ellerman.id.au> # ppc
Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com> # s390
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
[bwh: Backported to 3.16:
 - For s390, use the 31-bit-compatible macros in arch_static_branch_jump()
 - 
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2019-05-22 23:15:05 +01:00
..
alchemy MIPS: Replace obsolete strict_strto call with kstrto 2014-06-04 22:50:40 +02:00
ar7 MIPS: AR7: Ensure that serial ports are properly set up 2018-01-01 20:52:06 +00:00
ath79 MIPS: ath79: make bootconsole wait for both THRE and TEMT 2016-08-22 22:37:53 +01:00
bcm47xx MIPS: BCM47XX: Fix button inversion for Asus WL-500W 2017-06-05 21:17:10 +01:00
bcm63xx MIPS: BCM63XX: fix switch core reset on BCM6368 2019-04-04 16:14:04 +01:00
boot MIPS: Align kernel load address to 64KB 2019-04-04 16:13:43 +01:00
cavium-octeon MIPS: OCTEON: Fix copy_from_user fault handling for large buffers 2017-06-05 21:17:10 +01:00
cobalt MIPS: Cobalt: Move to 8250/16550 serial early printk driver 2013-10-29 21:24:38 +01:00
configs MIPS: ip27: Disable qlge driver in defconfig 2017-06-05 21:17:10 +01:00
dec MIPS: DEC: Fix an int-handler.S CPU_DADDI_WORKAROUNDS regression 2017-11-11 13:34:00 +00:00
emma MIPS: Remove panic_timeout settings 2013-11-26 12:12:27 +01:00
fw MIPS: DEC/SNI: O32 wrapper stack switching fixes 2014-05-13 00:29:35 +02:00
include locking/static_keys: Add a new static_key interface 2019-05-22 23:15:05 +01:00
jazz Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-03-02 07:44:16 -08:00
jz4740 MIPS: jz4740: fix build error in irq.h 2017-11-11 13:34:02 +00:00
kernel jump_label: Rename JUMP_LABEL_{EN,DIS}ABLE to JUMP_LABEL_{JMP,NOP} 2019-05-22 23:15:03 +01:00
kvm KVM: Fix spelling mistake: "cop_unsuable" -> "cop_unusable" 2018-10-21 08:46:06 +01:00
lantiq Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2014-06-09 18:10:34 -07:00
lasat MIPS: Lasat: Replace del_timer by del_timer_sync 2014-03-31 18:17:12 +02:00
lib MIPS: memset: Fix CPU_DADDI_WORKAROUNDS `small_fixup' regression 2018-12-16 22:09:35 +00:00
loongson MIPS: Loongson 2F: allow NULL clock for clk_get_rate 2017-11-26 13:50:32 +00:00
loongson1 MIPS: Disable MIPS16/microMIPS crap for platforms not supporting these ASEs. 2014-05-23 15:12:37 +02:00
math-emu MIPS: Fix a preemption issue with thread's FPU defaults 2018-03-03 15:51:56 +00:00
mm MIPS: Expand MIPS32 ASIDs to 64 bits 2019-04-04 16:13:47 +01:00
mti-malta MIPS: Malta: Fix IOCU disable switch read for MIPS64 2016-11-20 01:17:36 +00:00
mti-sead3 Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2014-06-09 18:10:34 -07:00
net bpf, mips: fix off-by-one in ctx offset allocation 2016-11-20 01:16:56 +00:00
netlogic MIPS: Netlogic: Fix assembler warning from smpboot.S 2017-06-05 21:16:46 +01:00
oprofile MIPS: oprofile: Fix backtrace on 64-bit kernel 2014-12-01 10:26:05 +00:00
paravirt mips: Update the email address of Geert Uytterhoeven 2014-06-02 16:34:41 +02:00
pci MIPS: OCTEON: don't set octeon_dma_bar_type if PCI is disabled 2019-05-02 21:41:31 +01:00
pmcs-msp71xx MIPS: MT: Remove SMTC support 2014-05-24 00:07:01 +02:00
pnx833x MIPS: PNX833x: Remove checks for CONFIG_I2C_PNX0105 2014-05-23 15:12:39 +02:00
power nosave: consolidate __nosave_{begin,end} in <asm/sections.h> 2015-05-06 10:24:18 +01:00
ralink MIPS: ralink: Remove ralink_halt() 2018-06-16 22:22:46 +01:00
rb532 MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
sgi-ip22 MIPS: ip22: Fix ip28 build for modern gcc 2017-11-11 13:34:00 +00:00
sgi-ip27 MIPS: IP27: Fix __node_distances undefined error 2014-12-01 10:26:04 +00:00
sgi-ip32 MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
sibyte MIPS: SMP: Remove plat_smp_ops cpus_done method. 2014-05-27 11:06:42 +02:00
sni MIPS: Cleanup CP0 PRId and CP1 FPIR register access masks 2013-09-18 20:25:19 +02:00
txx9 MIPS: TXx9: use IS_BUILTIN() for CONFIG_LEDS_CLASS 2018-06-16 22:22:06 +01:00
vr41xx MIPS: Idle: Consolidate all declarations in <asm/idle.h>. 2013-05-22 01:34:27 +02:00
Kbuild MIPS: net: Add BPF JIT 2014-05-30 16:10:20 +02:00
Kbuild.platforms MIPS: Enable build for new system 'paravirt' 2014-06-02 12:34:20 +02:00
Kconfig MIPS: SiByte: Enable ZONE_DMA32 for LittleSur 2019-04-04 16:13:42 +01:00
Kconfig.debug MIPS: MT: Remove SMTC support 2014-05-24 00:07:01 +02:00
Makefile MIPS: 'make -s' should be silent 2017-06-05 21:16:58 +01:00