* [PATCH] rcu: Avoid strict QS reporting in NMI context
@ 2022-06-18 2:22 Zqiang
[not found] ` <CAFTL4hybOuURQD6LdxNiSShkvVT=qJ3_5qA59dOJ_47o9WEWYA@mail.gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: Zqiang @ 2022-06-18 2:22 UTC (permalink / raw)
To: paulmck, frederic; +Cc: rcu, linux-kernel
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.
Signed-off-by: Zqiang <qiang1.zhang@intel.com>
---
kernel/rcu/tree_plugin.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index dc78726b993f..e7a36e248a8a 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -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;
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] rcu: Avoid strict QS reporting in NMI context
[not found] ` <PH0PR11MB5880465364ADD3E4637D8077DAAE9@PH0PR11MB5880.namprd11.prod.outlook.com>
@ 2022-06-18 14:56 ` Paul E. McKenney
0 siblings, 0 replies; 2+ messages in thread
From: Paul E. McKenney @ 2022-06-18 14:56 UTC (permalink / raw)
To: Zhang, Qiang1; +Cc: Frederic Weisbecker, rcu, LKML
On Sat, Jun 18, 2022 at 12:15:23PM +0000, Zhang, Qiang1 wrote:
> Le sam. 18 juin 2022, 04:23, Zqiang <qiang1.zhang@intel.com<mailto:qiang1.zhang@intel.com>> a écrit :
> 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.
>
> Signed-off-by: Zqiang <qiang1.zhang@intel.com<mailto:qiang1.zhang@intel.com>>
> ---
> kernel/rcu/tree_plugin.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
> index dc78726b993f..e7a36e248a8a 100644
> --- a/kernel/rcu/tree_plugin.h
> +++ b/kernel/rcu/tree_plugin.h
> @@ -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)
>
> >Doesn't preempt_count() imply in_nmi()?
> >
>
>
>
> It looks like this, thanks Frederic
>
> #define nmi_count() (preempt_count() & NMI_MASK)
> #define in_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
> >Thanks.
>
> return;
> rdp = this_cpu_ptr(&rcu_data);
> rdp->cpu_no_qs.b.norm = false;
> --
> 2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-18 14:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-18 2:22 [PATCH] rcu: Avoid strict QS reporting in NMI context Zqiang
[not found] ` <CAFTL4hybOuURQD6LdxNiSShkvVT=qJ3_5qA59dOJ_47o9WEWYA@mail.gmail.com>
[not found] ` <PH0PR11MB5880465364ADD3E4637D8077DAAE9@PH0PR11MB5880.namprd11.prod.outlook.com>
2022-06-18 14:56 ` Paul E. McKenney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®