Messages in this thread Patch in this message | | | From | Lai Jiangshan <> | Subject | [PATCH V3 41/49] x86/nmi: Use C entry code | Date | Thu, 14 Oct 2021 11:50:18 +0800 |
| |
From: Lai Jiangshan <laijs@linux.alibaba.com>
Use DEFINE_IDTENTRY_IST_ETNRY to emit C entry function and use the function directly in entry_64.S.
Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com> --- arch/x86/entry/entry_64.S | 17 ++--------------- arch/x86/include/asm/idtentry.h | 5 ++++- arch/x86/kernel/Makefile | 1 + 3 files changed, 7 insertions(+), 16 deletions(-)
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S index 7c994bcde1b0..0a1a55c8207e 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -1309,21 +1309,8 @@ end_repeat_nmi: PUSH_AND_CLEAR_REGS ENCODE_FRAME_POINTER - /* - * Use paranoid_entry to handle SWAPGS and CR3. - */ - call paranoid_entry - UNWIND_HINT_REGS - - movq %rsp, %rdi - movq $-1, %rsi - call exc_nmi - - /* - * Use paranoid_exit to handle SWAPGS and CR3, but no need to use - * restore_regs_and_return_to_kernel as we must handle nested NMI. - */ - call paranoid_exit + movq %rsp, %rdi /* pt_regs pointer */ + call ist_exc_nmi POP_REGS diff --git a/arch/x86/include/asm/idtentry.h b/arch/x86/include/asm/idtentry.h index b9a6750dbba2..57636844b0fd 100644 --- a/arch/x86/include/asm/idtentry.h +++ b/arch/x86/include/asm/idtentry.h @@ -372,6 +372,8 @@ __visible __entry_text void ist_##func(struct pt_regs *regs) \ #define DEFINE_IDTENTRY_NOIST(func) \ DEFINE_IDTENTRY_RAW(noist_##func) +#define DEFINE_IDTENTRY_NMI DEFINE_IDTENTRY_IST + #define DECLARE_IDTENTRY_MCE DECLARE_IDTENTRY_IST #define DEFINE_IDTENTRY_MCE DEFINE_IDTENTRY_IST #define DEFINE_IDTENTRY_MCE_USER DEFINE_IDTENTRY_NOIST @@ -421,6 +423,8 @@ __visible __entry_text void ist_##func(struct pt_regs *regs) \ #else /* CONFIG_X86_64 */ +#define DEFINE_IDTENTRY_NMI DEFINE_IDTENTRY_RAW + /** * DECLARE_IDTENTRY_DF - Declare functions for double fault 32bit variant * @vector: Vector number (ignored for C) @@ -452,7 +456,6 @@ __visible noinstr void func(struct pt_regs *regs, \ /* C-Code mapping */ #define DECLARE_IDTENTRY_NMI DECLARE_IDTENTRY_RAW -#define DEFINE_IDTENTRY_NMI DEFINE_IDTENTRY_RAW #else /* !__ASSEMBLY__ */ diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index 8ac45801ba8b..28815c2e6cb2 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile @@ -51,6 +51,7 @@ KCOV_INSTRUMENT := n CFLAGS_head$(BITS).o += -fno-stack-protector CFLAGS_cc_platform.o += -fno-stack-protector CFLAGS_traps.o += -fno-stack-protector +CFLAGS_nmi.o += -fno-stack-protector CFLAGS_irq.o := -I $(srctree)/$(src)/../include/asm/trace -- 2.19.1.6.gb485710b
| |