From: Ingo Molnar Date: Wed, 14 Feb 2024 09:45:07 +0000 (+0100) Subject: Merge tag 'v6.8-rc4' into x86/percpu, to resolve conflicts and refresh the branch X-Git-Tag: block-6.9-20240315~54^2~12 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=03c11eb3b16dc0058589751dfd91f254be2be613;p=linux-block.git Merge tag 'v6.8-rc4' into x86/percpu, to resolve conflicts and refresh the branch Conflicts: arch/x86/include/asm/percpu.h arch/x86/include/asm/text-patching.h Signed-off-by: Ingo Molnar --- 03c11eb3b16dc0058589751dfd91f254be2be613 diff --cc arch/x86/entry/calling.h index 47368ab0bda0,9f1d94790a54..e59d3073e7cf --- a/arch/x86/entry/calling.h +++ b/arch/x86/entry/calling.h @@@ -173,10 -173,9 +173,9 @@@ For 32-bit we have the following conven .endm #define THIS_CPU_user_pcid_flush_mask \ - PER_CPU_VAR(cpu_tlbstate) + TLB_STATE_user_pcid_flush_mask + PER_CPU_VAR(cpu_tlbstate + TLB_STATE_user_pcid_flush_mask) - .macro SWITCH_TO_USER_CR3_NOSTACK scratch_reg:req scratch_reg2:req - ALTERNATIVE "jmp .Lend_\@", "", X86_FEATURE_PTI + .macro SWITCH_TO_USER_CR3 scratch_reg:req scratch_reg2:req mov %cr3, \scratch_reg ALTERNATIVE "jmp .Lwrcr3_\@", "", X86_FEATURE_PCID diff --cc arch/x86/include/asm/percpu.h index e56a37886143,5e01883eb51e..44958ebaf626 --- a/arch/x86/include/asm/percpu.h +++ b/arch/x86/include/asm/percpu.h @@@ -28,52 -24,13 +28,52 @@@ #else /* ...!ASSEMBLY */ +#include - #include #include + #include #ifdef CONFIG_SMP + +#ifdef CONFIG_CC_HAS_NAMED_AS + +#ifdef __CHECKER__ +#define __seg_gs __attribute__((address_space(__seg_gs))) +#define __seg_fs __attribute__((address_space(__seg_fs))) +#endif + +#ifdef CONFIG_X86_64 +#define __percpu_seg_override __seg_gs +#else +#define __percpu_seg_override __seg_fs +#endif + +#define __percpu_prefix "" + +#else /* CONFIG_CC_HAS_NAMED_AS */ + +#define __percpu_seg_override #define __percpu_prefix "%%"__stringify(__percpu_seg)":" + +#endif /* CONFIG_CC_HAS_NAMED_AS */ + +#define __force_percpu_prefix "%%"__stringify(__percpu_seg)":" #define __my_cpu_offset this_cpu_read(this_cpu_off) +#ifdef CONFIG_USE_X86_SEG_SUPPORT +/* + * Efficient implementation for cases in which the compiler supports + * named address spaces. Allows the compiler to perform additional + * optimizations that can save more instructions. + */ +#define arch_raw_cpu_ptr(ptr) \ +({ \ + unsigned long tcp_ptr__; \ + tcp_ptr__ = __raw_cpu_read(, this_cpu_off); \ + \ + tcp_ptr__ += (unsigned long)(ptr); \ + (typeof(*(ptr)) __kernel __force *)tcp_ptr__; \ +}) +#else /* CONFIG_USE_X86_SEG_SUPPORT */ /* * Compared to the generic __my_cpu_offset version, the following * saves one instruction and avoids clobbering a temp register. diff --cc arch/x86/include/asm/text-patching.h index fb338f00d383,0b70653a98c1..345aafbc1964 --- a/arch/x86/include/asm/text-patching.h +++ b/arch/x86/include/asm/text-patching.h @@@ -29,6 -15,6 +15,8 @@@ extern void text_poke_early(void *addr, const void *opcode, size_t len); ++extern void apply_relocation(u8 *buf, size_t len, u8 *dest, u8 *src, size_t src_len); ++ /* * Clear and restore the kernel write-protection flag on the local CPU. * Allows the kernel to edit read-only pages.