linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rcu: Fix existing exp request check in sync_sched_exp_online_cleanup()
@ 2021-08-18  8:04 Neeraj Upadhyay
  2021-08-18 15:51 ` Paul E. McKenney
  0 siblings, 1 reply; 2+ messages in thread
From: Neeraj Upadhyay @ 2021-08-18  8:04 UTC (permalink / raw)
  To: paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel
  Cc: rcu, linux-kernel, urezki, frederic, boqun.feng, Neeraj Upadhyay

The sync_sched_exp_online_cleanup() checks to see if RCU needs
an expedited quiescent state from the incoming CPU, sending it
an IPI if so. Before sending IPI, it checks whether expedited
qs need has been already requested for the incoming CPU, by
checking rcu_data.cpu_no_qs.b.exp for the current cpu, on which
sync_sched_exp_online_cleanup() is running. This works for the
case where incoming CPU is same as self. However, for the case
where incoming CPU is different from self, expedited request
won't get marked, which can potentially delay reporting of
expedited quiescent state for the incoming CPU.

Fixes: e015a3411220 ("rcu: Avoid self-IPI in sync_sched_exp_online_cleanup()")
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
---
 kernel/rcu/tree_exp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h
index d9e4f8e..f3947c4 100644
--- a/kernel/rcu/tree_exp.h
+++ b/kernel/rcu/tree_exp.h
@@ -759,7 +759,7 @@ static void sync_sched_exp_online_cleanup(int cpu)
 	my_cpu = get_cpu();
 	/* Quiescent state either not needed or already requested, leave. */
 	if (!(READ_ONCE(rnp->expmask) & rdp->grpmask) ||
-	    __this_cpu_read(rcu_data.cpu_no_qs.b.exp)) {
+	    rdp->cpu_no_qs.b.exp) {
 		put_cpu();
 		return;
 	}
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, 
hosted by The Linux Foundation


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

* Re: [PATCH] rcu: Fix existing exp request check in sync_sched_exp_online_cleanup()
  2021-08-18  8:04 [PATCH] rcu: Fix existing exp request check in sync_sched_exp_online_cleanup() Neeraj Upadhyay
@ 2021-08-18 15:51 ` Paul E. McKenney
  0 siblings, 0 replies; 2+ messages in thread
From: Paul E. McKenney @ 2021-08-18 15:51 UTC (permalink / raw)
  To: Neeraj Upadhyay
  Cc: josh, rostedt, mathieu.desnoyers, jiangshanlai, joel, rcu,
	linux-kernel, urezki, frederic, boqun.feng

On Wed, Aug 18, 2021 at 01:34:00PM +0530, Neeraj Upadhyay wrote:
> The sync_sched_exp_online_cleanup() checks to see if RCU needs
> an expedited quiescent state from the incoming CPU, sending it
> an IPI if so. Before sending IPI, it checks whether expedited
> qs need has been already requested for the incoming CPU, by
> checking rcu_data.cpu_no_qs.b.exp for the current cpu, on which
> sync_sched_exp_online_cleanup() is running. This works for the
> case where incoming CPU is same as self. However, for the case
> where incoming CPU is different from self, expedited request
> won't get marked, which can potentially delay reporting of
> expedited quiescent state for the incoming CPU.
> 
> Fixes: e015a3411220 ("rcu: Avoid self-IPI in sync_sched_exp_online_cleanup()")
> Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>

Good catch!!!  I have queued this for further review and testing, thank
you!

							Thanx, Paul

> ---
>  kernel/rcu/tree_exp.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h
> index d9e4f8e..f3947c4 100644
> --- a/kernel/rcu/tree_exp.h
> +++ b/kernel/rcu/tree_exp.h
> @@ -759,7 +759,7 @@ static void sync_sched_exp_online_cleanup(int cpu)
>  	my_cpu = get_cpu();
>  	/* Quiescent state either not needed or already requested, leave. */
>  	if (!(READ_ONCE(rnp->expmask) & rdp->grpmask) ||
> -	    __this_cpu_read(rcu_data.cpu_no_qs.b.exp)) {
> +	    rdp->cpu_no_qs.b.exp) {
>  		put_cpu();
>  		return;
>  	}
> -- 
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, 
> hosted by The Linux Foundation
> 

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

end of thread, other threads:[~2021-08-18 15:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18  8:04 [PATCH] rcu: Fix existing exp request check in sync_sched_exp_online_cleanup() Neeraj Upadhyay
2021-08-18 15:51 ` 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).