x86/entry: Disable interrupts for native_load_gs_index() in C code
There is absolutely no point in doing this in ASM code. Move it to C. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com> Acked-by: Peter Zijlstra <peterz@infradead.org> Acked-by: Andy Lutomirski <luto@kernel.org> Link: https://lkml.kernel.org/r/20200505134903.531534675@linutronix.de
This commit is contained in:
parent
daf7a69787
commit
410367e321
|
@ -1041,22 +1041,17 @@ idtentry simd_coprocessor_error do_simd_coprocessor_error has_error_code=0
|
||||||
*
|
*
|
||||||
* Is in entry.text as it shouldn't be instrumented.
|
* Is in entry.text as it shouldn't be instrumented.
|
||||||
*/
|
*/
|
||||||
SYM_FUNC_START(native_load_gs_index)
|
SYM_FUNC_START(asm_load_gs_index)
|
||||||
FRAME_BEGIN
|
FRAME_BEGIN
|
||||||
pushfq
|
|
||||||
DISABLE_INTERRUPTS(CLBR_ANY & ~CLBR_RDI)
|
|
||||||
TRACE_IRQS_OFF
|
|
||||||
SWAPGS
|
SWAPGS
|
||||||
.Lgs_change:
|
.Lgs_change:
|
||||||
movl %edi, %gs
|
movl %edi, %gs
|
||||||
2: ALTERNATIVE "", "mfence", X86_BUG_SWAPGS_FENCE
|
2: ALTERNATIVE "", "mfence", X86_BUG_SWAPGS_FENCE
|
||||||
SWAPGS
|
SWAPGS
|
||||||
TRACE_IRQS_FLAGS (%rsp)
|
|
||||||
popfq
|
|
||||||
FRAME_END
|
FRAME_END
|
||||||
ret
|
ret
|
||||||
SYM_FUNC_END(native_load_gs_index)
|
SYM_FUNC_END(asm_load_gs_index)
|
||||||
EXPORT_SYMBOL(native_load_gs_index)
|
EXPORT_SYMBOL(asm_load_gs_index)
|
||||||
|
|
||||||
_ASM_EXTABLE(.Lgs_change, .Lbad_gs)
|
_ASM_EXTABLE(.Lgs_change, .Lbad_gs)
|
||||||
.section .fixup, "ax"
|
.section .fixup, "ax"
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include <asm/nops.h>
|
#include <asm/nops.h>
|
||||||
#include <asm/processor-flags.h>
|
#include <asm/processor-flags.h>
|
||||||
|
#include <linux/irqflags.h>
|
||||||
#include <linux/jump_label.h>
|
#include <linux/jump_label.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -129,7 +130,16 @@ static inline void native_wbinvd(void)
|
||||||
asm volatile("wbinvd": : :"memory");
|
asm volatile("wbinvd": : :"memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
extern asmlinkage void native_load_gs_index(unsigned);
|
extern asmlinkage void asm_load_gs_index(unsigned int selector);
|
||||||
|
|
||||||
|
static inline void native_load_gs_index(unsigned int selector)
|
||||||
|
{
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
|
local_irq_save(flags);
|
||||||
|
asm_load_gs_index(selector);
|
||||||
|
local_irq_restore(flags);
|
||||||
|
}
|
||||||
|
|
||||||
static inline unsigned long __read_cr4(void)
|
static inline unsigned long __read_cr4(void)
|
||||||
{
|
{
|
||||||
|
@ -186,7 +196,7 @@ static inline void wbinvd(void)
|
||||||
|
|
||||||
#ifdef CONFIG_X86_64
|
#ifdef CONFIG_X86_64
|
||||||
|
|
||||||
static inline void load_gs_index(unsigned selector)
|
static inline void load_gs_index(unsigned int selector)
|
||||||
{
|
{
|
||||||
native_load_gs_index(selector);
|
native_load_gs_index(selector);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue