rcu: Avoid strict QS reporting in NMI context
PATCH 1/1 rcu: Avoid strict QS reporting in NMI context
Avoid invoke rcu_report_qs_rdp() in NMI handlers, in NMI handlers, acquiring raw_spinlocks should be avoided, prevent NMI handlers from blocking(spin) unnecessarily.
This commit make rcu_read_unlock_strict() early return when in NMI context.
--- kernel/rcu/tree_plugin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree_plugin.h +1 -1
@@ -821,7 +821,7 @@ void rcu_read_unlock_strict(void) {struct rcu_data *rdp; -if (irqs_disabled () ||preempt_count () || !rcu_state.gp_kthread) +if (in_nmi () ||irqs_disabled () ||preempt_count () || !rcu_state.gp_kthread)return ; rdp =this_cpu_ptr (&rcu_data); rdp->cpu_no_qs.b.norm = false;
Signature · 1 line
2.25.1
A message that is not in the archive (sent off-list or not yet received): CAFTL4hybOuURQD6LdxNiSShkvVT=qJ3_5qA59dOJ_47o9WEWYA@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): PH0PR11MB5880465364ADD3E4637D8077DAAE9@PH0PR11MB5880.namprd11.prod.outlook.com
Paul E. McKenney
maintainerQuoted 29 lines · On Sat, Jun 18, 2022 at 12:15:23PM +0000, Zhang, Qiang1 wrote:
Le sam. 18 juin 2022, 04:23, Zqiang <[email protected]<mailto:[email protected]>> a écrit :
Avoid invokercu_report_qs_rdp()in NMI handlers, in NMI handlers,
acquiringraw_spinlocksshould be avoided, prevent NMI handlers
from blocking(spin) unnecessarily.This commit make
rcu_read_unlock_strict()early return when in NMI context.Signed-off-by Zqiang <[email protected]<mailto:[email protected]>>--- kernel/rcu/tree_plugin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/rcu/tree_plugin.h +1
-1@@ -821,7 +821,7 @@ void rcu_read_unlock_strict(void) {struct rcu_data *rdp; -if (irqs_disabled () ||preempt_count () || !rcu_state.gp_kthread) +if (in_nmi () ||irqs_disabled () ||preempt_count () || !rcu_state.gp_kthread)Quoted 2 lines
Doesn't
preempt_count()implyin_nmi()?
Quoted 6 lines
It looks like this, thanks Frederic
#define
nmi_count()(preempt_count()&NMI_MASK)
#definein_nmi()(nmi_count())Hi Paul, sorry it’s my mistake.
Thank you both for catching this!
I clearly should not be reviewing incoming patches late on Friday evening!
Thanx, Paul
Quoted 7 lines
Quoted 1 line
Thanks.
return; rdp = this_cpu_ptr(&rcu_data); rdp->cpu_no_qs.b.norm = false;--
2.25.1