From: Huang Ying <ying.huang@intel.com>
To: Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>,
Andi Kleen <ak@linux.intel.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/2] MCE: inject: Support specifying raise mode for software MCE injection
Date: Wed, 03 Jun 2009 15:33:53 +0800 [thread overview]
Message-ID: <1244014433.8361.302.camel@yhuang-dev.sh.intel.com> (raw)
Support specifying raise mode for software MCE injection
Raise mode include raising as exception or raising as poll, it is
specified via the mce.inject_flags field.
This can be used to specify raise mode of UCNA, which is UC error but
raised not as exception. And this can be used to test the filter code
of poll handler or exception handler too. For example, enforce a poll
raise mode for a fatal MCE.
Signed-off-by: Huang Ying <ying.huang@intel.com>
---
arch/x86/include/asm/mce.h | 1 +
arch/x86/kernel/cpu/mcheck/mce-inject.c | 16 ++++++++--------
2 files changed, 9 insertions(+), 8 deletions(-)
--- a/arch/x86/kernel/cpu/mcheck/mce-inject.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-inject.c
@@ -43,7 +43,7 @@ static void inject_mce(struct mce *m)
i->finished = 1;
}
-static void raise_corrected(struct mce *m)
+static void raise_poll(struct mce *m)
{
unsigned long flags;
mce_banks_t b;
@@ -55,7 +55,7 @@ static void raise_corrected(struct mce *
m->finished = 0;
}
-static void raise_uncorrected(struct mce *m, struct pt_regs *pregs)
+static void raise_exception(struct mce *m, struct pt_regs *pregs)
{
struct pt_regs regs;
unsigned long flags;
@@ -84,10 +84,10 @@ static int mce_raise_notify(struct notif
if (val != DIE_NMI_IPI || !cpu_isset(cpu, mce_inject_cpumask))
return NOTIFY_DONE;
cpu_clear(cpu, mce_inject_cpumask);
- if (m->status & MCI_STATUS_UC)
- raise_uncorrected(m, args->regs);
+ if (m->inject_flags & MCJ_EXCEPTION)
+ raise_exception(m, args->regs);
else if (m->status)
- raise_corrected(m);
+ raise_poll(m);
return NOTIFY_STOP;
}
@@ -103,7 +103,7 @@ static int raise_local(struct mce *m)
int ret = 0;
int cpu = m->cpu;
- if (m->status & MCI_STATUS_UC) {
+ if (m->inject_flags & MCJ_EXCEPTION) {
printk(KERN_INFO "Triggering MCE exception on CPU %d\n", cpu);
switch (context) {
case MCJ_CTX_IRQ:
@@ -113,7 +113,7 @@ static int raise_local(struct mce *m)
*/
/*FALL THROUGH*/
case MCJ_CTX_PROCESS:
- raise_uncorrected(m, NULL);
+ raise_exception(m, NULL);
break;
default:
printk(KERN_INFO "Invalid MCE context\n");
@@ -123,7 +123,7 @@ static int raise_local(struct mce *m)
} else if (m->status) {
printk(KERN_INFO "Starting machine check poll on CPU %d\n",
cpu);
- raise_corrected(m);
+ raise_poll(m);
mce_notify_user();
printk(KERN_INFO "Machine check poll done on CPU %d\n", cpu);
} else
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -34,6 +34,7 @@
#define MCJ_CTX_PROCESS 1 /* inject context: process */
#define MCJ_CTX_IRQ 2 /* inject context: IRQ */
#define MCJ_NMI_BROADCAST 4 /* do NMI broadcasting */
+#define MCJ_EXCEPTION 8 /* raise as exception */
/* Fields are zero when not available */
struct mce {
reply other threads:[~2009-06-03 7:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1244014433.8361.302.camel@yhuang-dev.sh.intel.com \
--to=ying.huang@intel.com \
--cc=ak@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®