linux/arch/s390
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
..
appldata s390/appldata: add slab.h for kzalloc/kfree 2014-05-20 08:58:51 +02:00
boot s390/decompressor: fix initrd corruption caused by bss clear 2017-07-18 18:40:20 +01:00
configs s390: update default configuration 2014-06-11 10:13:30 +02:00
crypto crypto: s390/ghash - Fix incorrect ghash icv buffer handling. 2015-06-02 12:08:17 +01:00
hypfs s390/timex: fix get_tod_clock_ext() inline assembly 2019-02-11 17:53:13 +00:00
include locking/static_keys: Add a new static_key interface 2019-05-22 23:15:05 +01: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: s390: provide io interrupt kvm_stat 2018-06-16 22:22:30 +01:00
lib s390/spinlock: avoid yield to non existent cpu 2016-06-15 21:29:24 +01:00
math-emu s390: fix save and restore of the floating-point-control register 2013-10-24 17:17:11 +02:00
mm s390/kvm: fix deadlock when killed by oom 2018-12-16 22:08:16 +00:00
net net: filter: get rid of BPF_S_* enum 2014-06-01 22:16:58 -07:00
oprofile s390/oprofile: make return of 0 explicit 2014-05-27 10:26:00 +02:00
pci s390/pci: fix out of bounds access during irq setup 2018-12-16 22:08:47 +00:00
defconfig s390: update default configuration 2014-06-11 10:13:30 +02:00
Kbuild s390/pci: base support 2012-11-30 15:40:45 +01:00
Kconfig s390/locking: Reenable optimistic spinning 2014-09-17 09:21:51 -07:00
Kconfig.debug Kconfig: consolidate CONFIG_DEBUG_STRICT_USER_COPY_CHECKS 2013-04-30 17:04:09 -07:00
Makefile s390: allow to set gcc -mtune flag 2013-10-31 09:54:01 +01:00