[RFC][PATCH 2/8] jump_label, x86: Strip ASM jump_label support

From: Peter Zijlstra
Date: Fri Jun 28 2019 - 09:36:30 EST


In prepration for variable size jump_label support; remove all ASM
bits that are not used.

Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
---
arch/x86/entry/calling.h | 2 +-
arch/x86/include/asm/jump_label.h | 28 ++++------------------------
2 files changed, 5 insertions(+), 25 deletions(-)

--- a/arch/x86/entry/calling.h
+++ b/arch/x86/entry/calling.h
@@ -377,7 +377,7 @@ For 32-bit we have the following convent
.macro CALL_enter_from_user_mode
#ifdef CONFIG_CONTEXT_TRACKING
#ifdef CONFIG_JUMP_LABEL
- STATIC_JUMP_IF_FALSE .Lafter_call_\@, context_tracking_enabled, def=0
+ STATIC_BRANCH_FALSE_LIKELY .Lafter_call_\@, context_tracking_enabled
#endif
call enter_from_user_mode
.Lafter_call_\@:
--- a/arch/x86/include/asm/jump_label.h
+++ b/arch/x86/include/asm/jump_label.h
@@ -55,36 +55,16 @@ static __always_inline bool arch_static_

#else /* __ASSEMBLY__ */

-.macro STATIC_JUMP_IF_TRUE target, key, def
+.macro STATIC_BRANCH_FALSE_LIKELY target, key
.Lstatic_jump_\@:
- .if \def
/* Equivalent to "jmp.d32 \target" */
.byte 0xe9
- .long \target - .Lstatic_jump_after_\@
-.Lstatic_jump_after_\@:
- .else
- .byte STATIC_KEY_INIT_NOP
- .endif
- .pushsection __jump_table, "aw"
- _ASM_ALIGN
- .long .Lstatic_jump_\@ - ., \target - .
- _ASM_PTR \key - .
- .popsection
-.endm
+ .long \target - (. + 4)

-.macro STATIC_JUMP_IF_FALSE target, key, def
-.Lstatic_jump_\@:
- .if \def
- .byte STATIC_KEY_INIT_NOP
- .else
- /* Equivalent to "jmp.d32 \target" */
- .byte 0xe9
- .long \target - .Lstatic_jump_after_\@
-.Lstatic_jump_after_\@:
- .endif
.pushsection __jump_table, "aw"
_ASM_ALIGN
- .long .Lstatic_jump_\@ - ., \target - .
+ .long .Lstatic_jump_\@ - .
+ .long \target - .
_ASM_PTR \key + 1 - .
.popsection
.endm