linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rcu/exp: Mark current CPU as exp-QS in IPI loop second pass
@ 2021-11-30 16:21 Frederic Weisbecker
  2021-11-30 17:01 ` Neeraj Upadhyay
  0 siblings, 1 reply; 3+ messages in thread
From: Frederic Weisbecker @ 2021-11-30 16:21 UTC (permalink / raw)
  To: Paul E . McKenney
  Cc: LKML, Frederic Weisbecker, Uladzislau Rezki, Neeraj Upadhyay,
	Boqun Feng, Josh Triplett, Joel Fernandes, rcu

While looping through the rnp's CPUs to IPI for an expedited grace
period, a first pass excludes the current CPU and the CPUs in dynticks
idle mode. The workqueue will report their QS on their behalf later.

The second pass processes the IPIs and also ignores the current CPU,
assuming it has been previously included in the group of CPUs whose
QS are to be reported by the workqueue.

Unfortunately the current CPU may have changed between the first and
second pass, due to the rnp lock being dropped, re-enabling preemption.
As a result the current CPU, if different in the second pass, may be
ignored by the expedited grace period. No IPI will be sent to it
so it won't be requested to report an expedited quiescent state.

This ends up in an expedited grace period stall.

Fix this with including the current CPU in the second round in the group
of CPUs to report a QS for by the workqueue.

Fixes: b9ad4d6ed18e ("rcu: Avoid self-IPI in sync_rcu_exp_select_node_cpus()")
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Uladzislau Rezki <urezki@gmail.com>
Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Joel Fernandes <joel@joelfernandes.org>
---
 kernel/rcu/tree_exp.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h
index a96d17206d87..237a79989aba 100644
--- a/kernel/rcu/tree_exp.h
+++ b/kernel/rcu/tree_exp.h
@@ -387,6 +387,7 @@ static void sync_rcu_exp_select_node_cpus(struct work_struct *wp)
 			continue;
 		}
 		if (get_cpu() == cpu) {
+			mask_ofl_test |= mask;
 			put_cpu();
 			continue;
 		}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rcu/exp: Mark current CPU as exp-QS in IPI loop second pass
  2021-11-30 16:21 [PATCH] rcu/exp: Mark current CPU as exp-QS in IPI loop second pass Frederic Weisbecker
@ 2021-11-30 17:01 ` Neeraj Upadhyay
  2021-11-30 18:44   ` Paul E. McKenney
  0 siblings, 1 reply; 3+ messages in thread
From: Neeraj Upadhyay @ 2021-11-30 17:01 UTC (permalink / raw)
  To: Frederic Weisbecker, Paul E . McKenney
  Cc: LKML, Uladzislau Rezki, Boqun Feng, Josh Triplett, Joel Fernandes, rcu



On 11/30/2021 9:51 PM, Frederic Weisbecker wrote:
> While looping through the rnp's CPUs to IPI for an expedited grace
> period, a first pass excludes the current CPU and the CPUs in dynticks
> idle mode. The workqueue will report their QS on their behalf later.
> 
> The second pass processes the IPIs and also ignores the current CPU,
> assuming it has been previously included in the group of CPUs whose
> QS are to be reported by the workqueue.
> 
> Unfortunately the current CPU may have changed between the first and
> second pass, due to the rnp lock being dropped, re-enabling preemption.
> As a result the current CPU, if different in the second pass, may be
> ignored by the expedited grace period. No IPI will be sent to it
> so it won't be requested to report an expedited quiescent state.
> 
> This ends up in an expedited grace period stall.
> 
> Fix this with including the current CPU in the second round in the group
> of CPUs to report a QS for by the workqueue.
> 
> Fixes: b9ad4d6ed18e ("rcu: Avoid self-IPI in sync_rcu_exp_select_node_cpus()")
> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
> Cc: Uladzislau Rezki <urezki@gmail.com>
> Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com>
> Cc: Boqun Feng <boqun.feng@gmail.com>
> Cc: Josh Triplett <josh@joshtriplett.org>
> Cc: Joel Fernandes <joel@joelfernandes.org>
> ---

Reviewed-by: Neeraj Upadhyay <quic_neeraju@quicinc.com>



Thanks
Neeraj


>   kernel/rcu/tree_exp.h | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h
> index a96d17206d87..237a79989aba 100644
> --- a/kernel/rcu/tree_exp.h
> +++ b/kernel/rcu/tree_exp.h
> @@ -387,6 +387,7 @@ static void sync_rcu_exp_select_node_cpus(struct work_struct *wp)
>   			continue;
>   		}
>   		if (get_cpu() == cpu) {
> +			mask_ofl_test |= mask;
>   			put_cpu();
>   			continue;
>   		}
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rcu/exp: Mark current CPU as exp-QS in IPI loop second pass
  2021-11-30 17:01 ` Neeraj Upadhyay
@ 2021-11-30 18:44   ` Paul E. McKenney
  0 siblings, 0 replies; 3+ messages in thread
From: Paul E. McKenney @ 2021-11-30 18:44 UTC (permalink / raw)
  To: Neeraj Upadhyay
  Cc: Frederic Weisbecker, LKML, Uladzislau Rezki, Boqun Feng,
	Josh Triplett, Joel Fernandes, rcu

On Tue, Nov 30, 2021 at 10:31:57PM +0530, Neeraj Upadhyay wrote:
> 
> 
> On 11/30/2021 9:51 PM, Frederic Weisbecker wrote:
> > While looping through the rnp's CPUs to IPI for an expedited grace
> > period, a first pass excludes the current CPU and the CPUs in dynticks
> > idle mode. The workqueue will report their QS on their behalf later.
> > 
> > The second pass processes the IPIs and also ignores the current CPU,
> > assuming it has been previously included in the group of CPUs whose
> > QS are to be reported by the workqueue.
> > 
> > Unfortunately the current CPU may have changed between the first and
> > second pass, due to the rnp lock being dropped, re-enabling preemption.
> > As a result the current CPU, if different in the second pass, may be
> > ignored by the expedited grace period. No IPI will be sent to it
> > so it won't be requested to report an expedited quiescent state.
> > 
> > This ends up in an expedited grace period stall.
> > 
> > Fix this with including the current CPU in the second round in the group
> > of CPUs to report a QS for by the workqueue.
> > 
> > Fixes: b9ad4d6ed18e ("rcu: Avoid self-IPI in sync_rcu_exp_select_node_cpus()")
> > Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
> > Cc: Uladzislau Rezki <urezki@gmail.com>
> > Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com>
> > Cc: Boqun Feng <boqun.feng@gmail.com>
> > Cc: Josh Triplett <josh@joshtriplett.org>
> > Cc: Joel Fernandes <joel@joelfernandes.org>
> > ---
> 
> Reviewed-by: Neeraj Upadhyay <quic_neeraju@quicinc.com>

Applied, thank you both!

							Thanx, Paul

> Thanks
> Neeraj
> 
> 
> >   kernel/rcu/tree_exp.h | 1 +
> >   1 file changed, 1 insertion(+)
> > 
> > diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h
> > index a96d17206d87..237a79989aba 100644
> > --- a/kernel/rcu/tree_exp.h
> > +++ b/kernel/rcu/tree_exp.h
> > @@ -387,6 +387,7 @@ static void sync_rcu_exp_select_node_cpus(struct work_struct *wp)
> >   			continue;
> >   		}
> >   		if (get_cpu() == cpu) {
> > +			mask_ofl_test |= mask;
> >   			put_cpu();
> >   			continue;
> >   		}
> > 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-30 18:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30 16:21 [PATCH] rcu/exp: Mark current CPU as exp-QS in IPI loop second pass Frederic Weisbecker
2021-11-30 17:01 ` Neeraj Upadhyay
2021-11-30 18:44   ` 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;
as well as URLs for NNTP newsgroup(s).