[RFC][PATCH 1/9] jump_label, x86: Strip ASM jump_label support

From: Peter Zijlstra
Date: Mon Oct 07 2019 - 07:24:48 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
@@ -337,7 +337,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