x86: Fix an RT MCE crash
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
@@ -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
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.
Signed-off-by Corey Minyard <[email protected]>--- arch/x86/kernel/cpu/mcheck/mce.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)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 )
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.
Signed-off-by Corey Minyard <[email protected]>--- arch/x86/kernel/cpu/mcheck/mce.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/x86/kernel/cpu/mcheck/mce.c +0
-0
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
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.
Signed-off-by Corey Minyard <[email protected]>--- arch/x86/kernel/cpu/mcheck/mce.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/x86/kernel/cpu/mcheck/mce.c +0
-0@@ -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
-1static 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