public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] Fix RCU race in access of nohz_cpu_mask
@ 2005-12-08 19:31 Oleg Nesterov
  2005-12-09  2:46 ` Srivatsa Vaddagiri
  2005-12-09  2:56 ` Srivatsa Vaddagiri
  0 siblings, 2 replies; 33+ messages in thread
From: Oleg Nesterov @ 2005-12-08 19:31 UTC (permalink / raw)
  To: Srivatsa Vaddagiri
  Cc: linux-kernel, Dipankar Sarma, Paul E. McKenney, Andrew Morton

Srivatsa Vaddagiri wrote:
>
> Accessing  nohz_cpu_mask before incrementing rcp->cur is racy. It can
> cause tickless idle CPUs to be included in rsp->cpumask, which will
> extend graceperiods unnecessarily.
> ...
> @@ -244,15 +244,15 @@ static void rcu_start_batch(struct rcu_c
>
>         if (rcp->next_pending &&
>                         rcp->completed == rcp->cur) {
> -               /* Can't change, since spin lock held. */
> -               cpus_andnot(rsp->cpumask, cpu_online_map, nohz_cpu_mask);
> -
>                 rcp->next_pending = 0;
>                 /* next_pending == 0 must be visible in __rcu_process_callbacks()
>                  * before it can see new value of cur.
>                  */
>                 smp_wmb();
>                 rcp->cur++;
> +               smp_mb();
> +               cpus_andnot(rsp->cpumask, cpu_online_map, nohz_cpu_mask);
> +

Could you explain why this patch makes any difference?

grep shows the only user of nohz_cpu_mask in arch/s390/kernel/time.c,
start_hz_timer() and stop_hz_timer().

I can't see how this change can prevent idle cpus to be included in
->cpumask, cpu can add itself to nohz_cpu_mask right after some other
cpu started new grace period.

I think cpu should call cpu_quiet() after adding itself to nohz mask
to eliminate this race.

No?

Oleg.

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

end of thread, other threads:[~2006-03-31 23:38 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-08 19:31 [PATCH] Fix RCU race in access of nohz_cpu_mask Oleg Nesterov
2005-12-09  2:46 ` Srivatsa Vaddagiri
2005-12-09 19:17   ` Oleg Nesterov
2005-12-10 15:19     ` Srivatsa Vaddagiri
2005-12-10 18:55       ` Oleg Nesterov
2005-12-11 17:41         ` Semantics of smp_mb() [was : Re: [PATCH] Fix RCU race in access of nohz_cpu_mask ] Srivatsa Vaddagiri
2005-12-11 21:21           ` Andrew James Wade
2005-12-11 23:45             ` Rusty Russell
2005-12-12  0:49               ` Keith Owens
2005-12-12  8:41                 ` Srivatsa Vaddagiri
2005-12-12 19:33                   ` Oleg Nesterov
2005-12-13  5:20                     ` Paul E. McKenney
2005-12-13  5:07               ` Andrew James Wade
2005-12-13  5:43                 ` Paul E. McKenney
2005-12-13 11:20                 ` Andi Kleen
2005-12-13 16:20                   ` Paul E. McKenney
2005-12-13 22:27                     ` Keith Owens
2005-12-13 22:50                       ` Paul E. McKenney
2005-12-14  1:12                         ` Andi Kleen
2005-12-14  1:46                           ` Paul E. McKenney
2005-12-15 21:15                       ` Semantics of smp_mb() Roland Dreier
2005-12-16  7:46                       ` Semantics of smp_mb() [was : Re: [PATCH] Fix RCU race in access of nohz_cpu_mask ] Jeremy Higdon
2006-03-13 18:39                         ` Paul E. McKenney
2006-03-31  4:56                           ` Jeremy Higdon
2006-03-31  6:18                             ` Paul E. McKenney
2006-03-31 23:38                             ` Jesse Barnes
2005-12-12  3:10         ` [PATCH] Fix RCU race in access of nohz_cpu_mask Paul E. McKenney
2005-12-12  4:32           ` Andrew Morton
2005-12-12  4:38             ` David S. Miller
2005-12-12  4:47               ` Nick Piggin
2005-12-12  4:49             ` Paul Mackerras
2005-12-12  6:27             ` Keith Owens
2005-12-09  2:56 ` Srivatsa Vaddagiri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox