Skip to contentSkip to conversation

x86: Fix an RT MCE crash

PATCH Superseded [email protected] 3 participants 4 messages Jul 6, 2016 – Jul 11, 2016 x86

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 x86: Fix an RT MCE crash

From: Corey Minyard <[email protected]>

On some x86 systems an MCE interrupt would come in before the kernel was ready for it. Looking at the latest RT code, it has similar (but not quite the same) code, except it adds a bool that tells if MCE handling is initialized. That was required because they had switched to use swork instead of a kernel thread. Here, just checking to see if the thread is NULL is good enough to see if MCE handling is initialized.

---
 arch/x86/kernel/cpu/mcheck/mce.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/mcheck/mce.c +2 -1
index aaf4b9b..cc70d98 100644
@@ -1391,7 +1391,8 @@ static int mce_notify_work_init(void)
 
 static void mce_notify_work(void)
 {
-	wake_up_process(mce_notify_helper);
+	if (mce_notify_helper)
+		wake_up_process(mce_notify_helper);
 }
 #else
 static void mce_notify_work(void)
Signature · 1 line
2.7.4
#1 lore raw

I forgot to mention that this applies to v3.2-rt, v3.4-rt, v3.10-rt, v3.12-rt, and v3.14-rt. I didn't see a v3.16-rt.

-corey

Quoted 29 lines · On 07/06/2016 01:55 PM, [email protected] wrote:

From: Corey Minyard <[email protected]>

On some x86 systems an MCE interrupt would come in before the kernel was ready for it. Looking at the latest RT code, it has similar (but not quite the same) code, except it adds a bool that tells if MCE handling is initialized. That was required because they had switched to use swork instead of a kernel thread. Here, just checking to see if the thread is NULL is good enough to see if MCE handling is initialized.

---
  arch/x86/kernel/cpu/mcheck/mce.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/mcheck/mce.c +2 -1
index aaf4b9b..cc70d98 100644
@@ -1391,7 +1391,8 @@ static int mce_notify_work_init(void)
 
  static void mce_notify_work(void)
  {
-	wake_up_process(mce_notify_helper);
+	if (mce_notify_helper)
+		wake_up_process(mce_notify_helper);
  }
  #else
  static void mce_notify_work(void)
#2 lore raw
In reply to [email protected]
Quoted 20 lines · On Wed, 6 Jul 2016 13:55:01 -0500 [email protected] wrote:

From: Corey Minyard <[email protected]>

On some x86 systems an MCE interrupt would come in before the kernel was ready for it. Looking at the latest RT code, it has similar (but not quite the same) code, except it adds a bool that tells if MCE handling is initialized. That was required because they had switched to use swork instead of a kernel thread. Here, just checking to see if the thread is NULL is good enough to see if MCE handling is initialized.

---
 arch/x86/kernel/cpu/mcheck/mce.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/mcheck/mce.c +0 -0
index aaf4b9b..cc70d98 100644

arch/x86/kernel/cpu/mcheck/mce.c static int mce_notify_work_init(void) · line 1398

Quoted 9 lines
arch/x86/kernel/cpu/mcheck/mce.c +2 -1
@@ -1391,7 +1391,8 @@ static int mce_notify_work_init(void)
 
 static void mce_notify_work(void)
 {
-	wake_up_process(mce_notify_helper);
+	if (mce_notify_helper)
+		wake_up_process(mce_notify_helper);
 }
 #else
 static void mce_notify_work(void)

Wait, is this all that's needed?

Also, Boris should be credited here somewhere.

-- Steve

#3 lore raw
Quoted 24 lines · Steven Rostedt
Quoted 21 lines · On Wed, 6 Jul 2016 13:55:01 -0500 [email protected] wrote:

From: Corey Minyard <[email protected]>

On some x86 systems an MCE interrupt would come in before the kernel was ready for it. Looking at the latest RT code, it has similar (but not quite the same) code, except it adds a bool that tells if MCE handling is initialized. That was required because they had switched to use swork instead of a kernel thread. Here, just checking to see if the thread is NULL is good enough to see if MCE handling is initialized.

---
  arch/x86/kernel/cpu/mcheck/mce.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/mcheck/mce.c +0 -0
index aaf4b9b..cc70d98 100644
@@ -1391,7 +1391,8 @@ static int mce_notify_work_init(void)
 
Quoted 10 lines

arch/x86/kernel/cpu/mcheck/mce.c static int mce_notify_work_init(void) · line 1398

Quoted 8 lines
arch/x86/kernel/cpu/mcheck/mce.c +2 -1
  static void mce_notify_work(void)
  {
-	wake_up_process(mce_notify_helper);
+	if (mce_notify_helper)
+		wake_up_process(mce_notify_helper);
  }
  #else
  static void mce_notify_work(void)

Wait, is this all that's needed?

Yes, that's it.

Quoted 1 line

Also, Boris should be credited here somewhere.

Indeed, he should. I'll issue V3.

-corey

Quoted 1 line

-- Steve