Recoverable MCA interrupts from NMI handlers? IPMI and RCU?
Hello!
A couple of questions about the x86 architecture...
1. Can recoverable machine-check exceptions occur from within
NMI handlers? If so, there is a bug in preemptable RCU's CONFIG_NO_HZ handling that could be fixed by a patch something like the one shown below (untested, probably does not even compile).
2. Does the IPMI subsystem make use of RCU read-side primitives
from within SMI handlers? If so, we need the SMI handlers to invoke rcu_irq_enter() upon entry and rcu_irq_exit() upon exit when they are invoked from dynticks idle state. Or something similar, depending on restrictions on code within SMI handlers.
If I need to forward either of these questions to someone else, please let me know!
---
include/linux/rcupreempt.h | 18 ----- kernel/rcupreempt.c | 156 ++++++++++++++++++++------------------------- 2 files changed, 73 insertions(+), 101 deletions(-)
include/linux/rcupreempt.h +2 -16
@@ -81,22 +81,8 @@ extern struct rcupreempt_trace *rcupreemstruct softirq_action ;#ifdef CONFIG_NO_HZ -DECLARE_PER_CPU (long, dynticks_progress_counter); - -static inline void rcu_enter_nohz (void ) -{ -smp_mb ();/* CPUs seeing ++ must see prior RCU read-side crit sects */ -__get_cpu_var (dynticks_progress_counter)++; -WARN_ON (__get_cpu_var (dynticks_progress_counter) &0x1 ); -} - -static inline void rcu_exit_nohz (void ) -{ -__get_cpu_var (dynticks_progress_counter)++; -smp_mb ();/* CPUs seeing ++ must see later RCU read-side crit sects */ -WARN_ON (!(__get_cpu_var (dynticks_progress_counter) &0x1 )); -} - +extern void rcu_enter_nohz (void ); +extern void rcu_exit_nohz (void );#else /* CONFIG_NO_HZ */ #define rcu_enter_nohz () do { } while (0)#define rcu_exit_nohz () do { } while (0)
kernel/rcupreempt.c +71 -85
183 lines not on this page · raw message
Quoted 10 lines · Paul E. McKenney
Hello!
A couple of questions about the x86 architecture...
1. Can recoverable machine-check exceptions occur from within
NMI handlers? If so, there is a bug in preemptable RCU'sCONFIG_NO_HZhandling that could be fixed by a patch something like the one shown below (untested, probably does not even compile).
In theory, recoverable #MC's can occur anywhere. It's an exception.
Quoted 5 lines
2. Does the IPMI subsystem make use of RCU read-side primitives
from within SMI handlers? If so, we need the SMI handlers to invokercu_irq_enter()upon entry andrcu_irq_exit()upon exit when they are invoked from dynticks idle state. Or something similar, depending on restrictions on code within SMI handlers.
Not sure about that one. I clearly need to look carefully into this... SMI is quite "special" in that it sets up an entirely new environment; the concept of executing kernel code at SMI level makes me want to run away and hide.
-hpa
Quoted 5 lines · H. Peter Anvin
Quoted 4 lines · Paul E. McKenney
Hello!
A couple of questions about the x86 architecture...
Quoted 7 lines
Quoted 5 lines
1. Can recoverable machine-check exceptions occur from within
NMI handlers? If so, there is a bug in preemptable RCU'sCONFIG_NO_HZhandling that could be fixed by a patch something like the one shown below (untested, probably does not even compile).In theory, recoverable #MC's can occur anywhere. It's an exception.
Thank you for the info! I guess I had better get busy testing the patch, then.
Quoted 10 lines
Quoted 5 lines
2. Does the IPMI subsystem make use of RCU read-side primitives
from within SMI handlers? If so, we need the SMI handlers to invokercu_irq_enter()upon entry andrcu_irq_exit()upon exit when they are invoked from dynticks idle state. Or something similar, depending on restrictions on code within SMI handlers.Not sure about that one. I clearly need to look carefully into this... SMI is quite "special" in that it sets up an entirely new environment; the concept of executing kernel code at SMI level makes me want to run away and hide.
Well, as long as the SMI handlers don't include calls to rcu_read_lock() and rcu_read_unlock(), then they don't need to include any calls to rcu_irq_enter() and rcu_irq_exit(). ;-)
Thanx, Paul
Quoted 6 lines · Paul E. McKenney
Quoted 6 lines
Quoted 5 lines
2. Does the IPMI subsystem make use of RCU read-side primitives
from within SMI handlers? If so, we need the SMI handlers to invokercu_irq_enter()upon entry andrcu_irq_exit()upon exit when they are invoked from dynticks idle state. Or something similar, depending on restrictions on code within SMI handlers.
Quoted 8 lines
Quoted 4 lines
Not sure about that one. I clearly need to look carefully into this... SMI is quite "special" in that it sets up an entirely new environment; the concept of executing kernel code at SMI level makes me want to run away and hide.
Well, as long as the SMI handlers don't include calls to
rcu_read_lock()andrcu_read_unlock(), then they don't need to include any calls torcu_irq_enter()andrcu_irq_exit(). ;-)
You can't really call any non-trivial protected mode code from the system
management mode as they run from different virtual address spaces each. What is run in the SMM is meant to be like firmware, run transparently to the rest of the system. In real life limitations of hardware and bugs in software make it less transparent than one could wish, but there you go.
Maciej
Quoted 10 lines · Paul E. McKenney
Hello!
A couple of questions about the x86 architecture...
1. Can recoverable machine-check exceptions occur from within
NMI handlers? If so, there is a bug in preemptable RCU'sCONFIG_NO_HZhandling that could be fixed by a patch something like the one shown below (untested, probably does not even compile).
Quoted 6 lines
2. Does the IPMI subsystem make use of RCU read-side primitives
from within SMI handlers? If so, we need the SMI handlers to invokercu_irq_enter()upon entry andrcu_irq_exit()upon exit when they are invoked from dynticks idle state. Or something similar, depending on restrictions on code within SMI handlers.
If you mean the IPMI driver, it does not tie into any SMI. It theoretically could since there's a bit for that in the watchdog timer, but there's been no demand and I haven't looked at it. I guess it would be better than an NMI.
If it did tie in, it would most likely just panic to get useful information out before the watchdog reset the system.
-corey
Quoted 17 lines · Corey Minyard
Quoted 10 lines · Paul E. McKenney
Hello!
A couple of questions about the x86 architecture...
1. Can recoverable machine-check exceptions occur from within
NMI handlers? If so, there is a bug in preemptable RCU'sCONFIG_NO_HZhandling that could be fixed by a patch something like the one shown below (untested, probably does not even compile).Quoted 6 lines
2. Does the IPMI subsystem make use of RCU read-side primitives
from within SMI handlers? If so, we need the SMI handlers to invokercu_irq_enter()upon entry andrcu_irq_exit()upon exit when they are invoked from dynticks idle state. Or something similar, depending on restrictions on code within SMI handlers.
Quoted 7 lines
If you mean the IPMI driver, it does not tie into any SMI. It theoretically could since there's a bit for that in the watchdog timer, but there's been no demand and I haven't looked at it. I guess it would be better than an NMI.
If it did tie in, it would most likely just panic to get useful information out before the watchdog reset the system.
Thanks for the info! I will stop worrying about SMIs and RCU, then.
Thanx, Paul
Quoted 3 lines · Corey Minyard
If you mean the IPMI driver, it does not tie into any SMI. It theoretically could since there's a bit for that in the watchdog timer, but there's been no demand and I haven't looked at it. I guess it would be better than an NMI.
If it did tie in, it would most likely just panic to get useful information out before the watchdog reset the system.
The main reason I could see wanting to use SMI would be as a debugging tool, since SMI makes the entire state of the system available at a low level; however, trying to interact with the state of the kernel at this priority level seems beyond the pale in terms of complexity.
-hpa
Quoted 6 lines · H. Peter Anvin
Quoted 5 lines · Corey Minyard
If you mean the IPMI driver, it does not tie into any SMI. It theoretically could since there's a bit for that in the watchdog timer, but there's been no demand and I haven't looked at it. I guess it would be better than an NMI.
Quoted 7 lines
Quoted 2 lines
If it did tie in, it would most likely just panic to get useful information out before the watchdog reset the system.
The main reason I could see wanting to use SMI would be as a debugging tool, since SMI makes the entire state of the system available at a low level; however, trying to interact with the state of the kernel at this priority level seems beyond the pale in terms of complexity.
Works for me! ;-)
Thanx, Paul