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
24 24
25#define ARCH_DEFINE_STATIC_CALL_TRAMP(name, func) __PPC_SCT(name, "b " #func)25#define ARCH_DEFINE_STATIC_CALL_TRAMP(name, func) __PPC_SCT(name, "b " #func)
26#define ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name) __PPC_SCT(name, "blr")26#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")
27 28
28#endif /* _ASM_POWERPC_STATIC_CALL_H */29#endif /* _ASM_POWERPC_STATIC_CALL_H */
arch/x86/include/asm/percpu.h+3−3
@@ -38,9 +38,9 @@ · 37 unmodified lines
38#define arch_raw_cpu_ptr(ptr) \38#define arch_raw_cpu_ptr(ptr) \
39({ \39({ \
40 unsigned long tcp_ptr__; \40 unsigned long tcp_ptr__; \
41 asm volatile("add " __percpu_arg(1) ", %0" \41 asm ("add " __percpu_arg(1) ", %0" \
42 : "=r" (tcp_ptr__) \42 : "=r" (tcp_ptr__) \
43 : "m" (this_cpu_off), "0" (ptr)); \43 : "m" (this_cpu_off), "0" (ptr)); \
44 (typeof(*(ptr)) __kernel __force *)tcp_ptr__; \44 (typeof(*(ptr)) __kernel __force *)tcp_ptr__; \
45})45})
46#else46#else
arch/x86/include/asm/static_call.h+2−0
@@ -38,6 +38,8 @@ · 37 unmodified lines
38#define ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name) \38#define ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name) \
39 __ARCH_DEFINE_STATIC_CALL_TRAMP(name, "ret; int3; nop; nop; nop")39 __ARCH_DEFINE_STATIC_CALL_TRAMP(name, "ret; int3; nop; nop; nop")
40 40
41#define ARCH_DEFINE_STATIC_CALL_RET0_TRAMP(name) \
42 ARCH_DEFINE_STATIC_CALL_TRAMP(name, __static_call_return0)
41 43
42#define ARCH_ADD_TRAMP_KEY(name) \44#define ARCH_ADD_TRAMP_KEY(name) \
43 asm(".pushsection .static_call_tramp_key, \"a\" \n" \45 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
12};12};
13 13
14/*14/*
15 * data16 data16 xorq %rax, %rax - a single 5 byte instruction that clears %rax15 * cs cs cs xorl %eax, %eax - a single 5 byte instruction that clears %[er]ax
16 * The REX.W cancels the effect of any data16.
17 */16 */
18static const u8 xor5rax[] = { 0x66, 0x66, 0x48, 0x31, 0xc0 };17static const u8 xor5rax[] = { 0x2e, 0x2e, 0x2e, 0x31, 0xc0 };
19 18
20static const u8 retinsn[] = { RET_INSN_OPCODE, 0xcc, 0xcc, 0xcc, 0xcc };19static const u8 retinsn[] = { RET_INSN_OPCODE, 0xcc, 0xcc, 0xcc, 0xcc };
21 20