History

Merge tag 'locking_urgent_for_v5.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull locking fixes from Borislav Petkov: - Allow the compiler to optimize away unused percpu accesses and change the local_lock_* macros back to inline functions - A couple of fixes to static call insn patching * tag 'locking_urgent_for_v5.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: Revert "mm/page_alloc: mark pagesets as __maybe_unused" Revert "locking/local_lock: Make the empty local_lock_*() function a macro." x86/percpu: Remove volatile from arch_raw_cpu_ptr(). static_call: Remove __DEFINE_STATIC_CALL macro static_call: Properly initialise DEFINE_STATIC_CALL_RET0() static_call: Don't make __static_call_return0 static x86,static_call: Fix __static_call_return0 for i386

Linus Torvalds committed 4 years ago

Commit 50c94de2 parents 7136849 273ba8510 files · +585 −572Browse files

Showing the changes to arch (4 of 10 files). Show all

Unified · Split

4 files
  1. arch/powerpc/include/asm/static_call.h +1 −0
  2. arch/x86/include/asm/percpu.h +3 −3
  3. arch/x86/include/asm/static_call.h +2 −0
  4. arch/x86/kernel/static_call.c +2 −3
arch/powerpc/include/asm/static_call.h+1−0
@@ -24,5 +24,6 @@ · 23 unmodified lines
2424
2525 #define ARCH_DEFINE_STATIC_CALL_TRAMP(name, func) __PPC_SCT(name, "b " #func)
2626 #define ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name) __PPC_SCT(name, "blr")
27+#define ARCH_DEFINE_STATIC_CALL_RET0_TRAMP(name) __PPC_SCT(name, "b .+20")
2728
2829 #endif /* _ASM_POWERPC_STATIC_CALL_H */
arch/x86/include/asm/percpu.h+3−3
@@ -38,9 +38,9 @@ · 37 unmodified lines
3838 #define arch_raw_cpu_ptr(ptr) \
3939 ({ \
4040 unsigned long tcp_ptr__; \
41− asm volatile("add " __percpu_arg(1) ", %0" \
42− : "=r" (tcp_ptr__) \
43− : "m" (this_cpu_off), "0" (ptr)); \
41+ asm ("add " __percpu_arg(1) ", %0" \
42+ : "=r" (tcp_ptr__) \
43+ : "m" (this_cpu_off), "0" (ptr)); \
4444 (typeof(*(ptr)) __kernel __force *)tcp_ptr__; \
4545 })
4646 #else
arch/x86/include/asm/static_call.h+2−0
@@ -38,6 +38,8 @@ · 37 unmodified lines
3838 #define ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name) \
3939 __ARCH_DEFINE_STATIC_CALL_TRAMP(name, "ret; int3; nop; nop; nop")
4040
41+#define ARCH_DEFINE_STATIC_CALL_RET0_TRAMP(name) \
42+ ARCH_DEFINE_STATIC_CALL_TRAMP(name, __static_call_return0)
4143
4244 #define ARCH_ADD_TRAMP_KEY(name) \
4345 asm(".pushsection .static_call_tramp_key, \"a\" \n" \
arch/x86/kernel/static_call.c+2−3
@@ -12,10 +12,9 @@ enum insn_type { · 11 unmodified lines
1212 };
1313
1414 /*
15− * data16 data16 xorq %rax, %rax - a single 5 byte instruction that clears %rax
16− * The REX.W cancels the effect of any data16.
15+ * cs cs cs xorl %eax, %eax - a single 5 byte instruction that clears %[er]ax
1716 */
18−static const u8 xor5rax[] = { 0x66, 0x66, 0x48, 0x31, 0xc0 };
17+static const u8 xor5rax[] = { 0x2e, 0x2e, 0x2e, 0x31, 0xc0 };
1918
2019 static const u8 retinsn[] = { RET_INSN_OPCODE, 0xcc, 0xcc, 0xcc, 0xcc };
2120