[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211213150340.9419-5-jiangshanlai@gmail.com>
Date: Mon, 13 Dec 2021 23:03:40 +0800
From: Lai Jiangshan <jiangshanlai@...il.com>
To: linux-kernel@...r.kernel.org
Cc: x86@...nel.org, Lai Jiangshan <laijs@...ux.alibaba.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>, Joerg Roedel <jroedel@...e.de>,
Brijesh Singh <brijesh.singh@....com>
Subject: [PATCH 4/4] x86/nmi: Convert nmi_cr2/nmi_dr7 to be func-local variable
From: Lai Jiangshan <laijs@...ux.alibaba.com>
nmi_cr2 and nmi_dr7 are used inside a function (the outmost exc_nmi()),
they don't need to be percpu data.
Signed-off-by: Lai Jiangshan <laijs@...ux.alibaba.com>
---
arch/x86/kernel/nmi.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
index 44c3adb68282..673eee5831db 100644
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
@@ -470,12 +470,12 @@ enum nmi_states {
NMI_LATCHED,
};
static DEFINE_PER_CPU(enum nmi_states, nmi_state);
-static DEFINE_PER_CPU(unsigned long, nmi_cr2);
-static DEFINE_PER_CPU(unsigned long, nmi_dr7);
DEFINE_IDTENTRY_NMI(exc_nmi)
{
irqentry_state_t irq_state;
+ unsigned long nmi_cr2;
+ unsigned long nmi_dr7;
/*
* Re-enable NMIs right here when running as an SEV-ES guest. This might
@@ -491,7 +491,7 @@ DEFINE_IDTENTRY_NMI(exc_nmi)
return;
}
this_cpu_write(nmi_state, NMI_EXECUTING);
- this_cpu_write(nmi_cr2, read_cr2());
+ nmi_cr2 = read_cr2();
nmi_restart:
/*
@@ -500,7 +500,7 @@ DEFINE_IDTENTRY_NMI(exc_nmi)
*/
sev_es_ist_enter(regs);
- this_cpu_write(nmi_dr7, local_db_save());
+ nmi_dr7 = local_db_save();
irq_state = irqentry_nmi_enter(regs);
@@ -511,12 +511,12 @@ DEFINE_IDTENTRY_NMI(exc_nmi)
irqentry_nmi_exit(regs, irq_state);
- local_db_restore(this_cpu_read(nmi_dr7));
+ local_db_restore(nmi_dr7);
sev_es_ist_exit();
- if (unlikely(this_cpu_read(nmi_cr2) != read_cr2()))
- write_cr2(this_cpu_read(nmi_cr2));
+ if (unlikely(nmi_cr2 != read_cr2()))
+ write_cr2(nmi_cr2);
if (this_cpu_dec_return(nmi_state))
goto nmi_restart;
--
2.19.1.6.gb485710b
Powered by blists - more mailing lists