linux/arch/powerpc
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
..
boot powerpc: Fix COFF zImage booting on old powermacs 2019-02-11 17:54:13 +00:00
configs powerpc/configs: Don't enable PPC_EARLY_DEBUG in defconfigs 2019-04-04 16:14:01 +01:00
crypto crypto: add missing crypto module aliases 2015-02-04 10:57:50 +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: Protect device ops->create and list_add with kvm->lock 2019-03-25 17:32:35 +00:00
lib powerpc/lib: Fix the feature fixup tests to actually work 2018-11-20 18:04:53 +00:00
math-emu powerpc: Correct emulated mtfsf instruction 2014-04-07 10:33:11 +10:00
mm powerpc/pseries: Fix unitialized timer reset on migration 2018-12-16 22:09:25 +00:00
net net: filter: make JITs zero A for SKF_AD_ALU_XOR_X 2016-01-25 10:44:05 +00:00
oprofile cpufreq: remove unused notifier: CPUFREQ_{SUSPENDCHANGE|RESUMECHANGE} 2014-03-19 14:10:24 +01:00
perf powerpc/perf: Dereference BHRB entries safely 2018-03-03 15:51:58 +00:00
platforms powerpc/pseries: Fix how we iterate over the DTL entries 2019-02-11 17:53:26 +00:00
sysdev powerpc: Fix size calculation using resource_size() 2018-12-16 22:08:41 +00:00
xmon powerpc/xmon: Fix another endiannes issue in RTAS call from xmon 2015-02-04 10:58:05 +00:00
Kconfig powerpc/bpf/jit: Disable classic BPF JIT on ppc64le 2016-08-22 22:38:18 +01:00
Kconfig.debug powerpc/powernv: Remove OPAL v1 takeover 2014-06-25 13:10:47 +10:00
Makefile powerpc/e500mc: Set assembler machine type to e500mc 2018-11-20 18:05:17 +00:00
relocs_check.pl Fix warning typo "CONFIG_RELCOATABLE" 2013-05-29 15:11:30 +02:00