Skip to contentSkip to conversation

x86, mce, inject: Use real injectm in raise_local

PATCH In review Huang Ying 1 participant 2 messages Sep 22, 2009 x86

lore
Share & tools
lore

Huang Ying

author
#0 lore raw

PATCH 1/2 x86, mce, inject: Use real injectm in raise_local

Current raise_local uses struct mce comes from mce_write as parameter instead of real injectm, so when we set mce.finished = 0 to clear injected MCE, the real inject stays valid. This will cause the remaining injectm affects next injection.

To fix this, real injectm is used in raise_local instead of the one on stack.

This patch is based on the diagnnoses and fixes by Dean Nelson.

---
 arch/x86/kernel/cpu/mcheck/mce-inject.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
arch/x86/kernel/cpu/mcheck/mce-inject.c +4 -3
@@ -98,8 +98,9 @@ static struct notifier_block mce_raise_n
 };
 
 /* Inject mce on current CPU */
-static int raise_local(struct mce *m)
+static int raise_local(void)
 {
+	struct mce *m = &__get_cpu_var(injectm);
 	int context = MCJ_CTX(m->inject_flags);
 	int ret = 0;
 	int cpu = m->extcpu;
@@ -167,12 +168,12 @@ static void raise_mce(struct mce *m)
 			}
 			cpu_relax();
 		}
-		raise_local(m);
+		raise_local();
 		put_cpu();
 		put_online_cpus();
 	} else
 #endif
-		raise_local(m);
+		raise_local();
 }
 
 /* Error injection interface */
#1 lore raw

[tip:x86/urgent] x86: mce, inject: Use real inject-msg in raise_local

Commit-ID:  14c0abf14a5e67e793131116bd97f57da37ccce3
Gitweb:     http://git.kernel.org/tip/14c0abf14a5e67e793131116bd97f57da37ccce3
Author:     Huang Ying <[email protected]>
AuthorDate: Tue, 22 Sep 2009 14:35:57 +0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 22 Sep 2009 21:06:37 +0200

x86: mce, inject: Use real inject-msg in raise_local

Current raise_local() uses a struct mce that comes from mce_write() as a parameter instead of the real inject-msg, so when we set mce.finished = 0 to clear injected MCE, the real inject stays valid.

This will cause the remaining inject-msg affect the next injection, which is not desired.

To fix this, real inject-msg is used in raise_local instead of the one on the stack.

This patch is based on the diagnosis and the fixes by Dean Nelson.

LKML-Reference: <[email protected]>

---
 arch/x86/kernel/cpu/mcheck/mce-inject.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
arch/x86/kernel/cpu/mcheck/mce-inject.c +4 -3
index 7029f0e..472763d 100644
@@ -98,8 +98,9 @@ static struct notifier_block mce_raise_nb = {
 };
 
 /* Inject mce on current CPU */
-static int raise_local(struct mce *m)
+static int raise_local(void)
 {
+	struct mce *m = &__get_cpu_var(injectm);
 	int context = MCJ_CTX(m->inject_flags);
 	int ret = 0;
 	int cpu = m->extcpu;
@@ -167,12 +168,12 @@ static void raise_mce(struct mce *m)
 			}
 			cpu_relax();
 		}
-		raise_local(m);
+		raise_local();
 		put_cpu();
 		put_online_cpus();
 	} else
 #endif
-		raise_local(m);
+		raise_local();
 }
 
 /* Error injection interface */