[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120615194454.GA6366@Krystal>
Date: Fri, 15 Jun 2012 15:44:54 -0400
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc: linux-kernel@...r.kernel.org, mingo@...e.hu, laijs@...fujitsu.com,
dipankar@...ibm.com, akpm@...ux-foundation.org,
josh@...htriplett.org, niv@...ibm.com, tglx@...utronix.de,
peterz@...radead.org, rostedt@...dmis.org, Valdis.Kletnieks@...edu,
dhowells@...hat.com, eric.dumazet@...il.com, darren@...art.com,
fweisbec@...il.com, patches@...aro.org,
"Paul E. McKenney" <paul.mckenney@...aro.org>
Subject: Re: [PATCH tip/core/rcu 4/6] rcu: Fix bug in rcu_barrier() torture
test
* Paul E. McKenney (paulmck@...ux.vnet.ibm.com) wrote:
[...]
> @@ -1642,6 +1643,7 @@ void rcu_torture_barrier_cbf(struct rcu_head *rcu)
> static int rcu_torture_barrier_cbs(void *arg)
> {
> long myid = (long)arg;
> + bool lastphase = 0;
> struct rcu_head rcu;
>
> init_rcu_head_on_stack(&rcu);
> @@ -1649,9 +1651,11 @@ static int rcu_torture_barrier_cbs(void *arg)
> set_user_nice(current, 19);
> do {
> wait_event(barrier_cbs_wq[myid],
> - atomic_read(&barrier_cbs_count) == n_barrier_cbs ||
> + barrier_phase != lastphase ||
> kthread_should_stop() ||
> fullstop != FULLSTOP_DONTSTOP);
> + lastphase = barrier_phase;
> + smp_mb();
Hi Paul,
Documenting this barrier, and the barrier below, along with the variable
accesses they order, would appear to be a good idea, especially since
the bug this is correcting was caused by the lack of appropriate
smp_mb().
Thanks,
Mathieu
> if (kthread_should_stop() || fullstop != FULLSTOP_DONTSTOP)
> break;
> cur_ops->call(&rcu, rcu_torture_barrier_cbf);
> @@ -1676,7 +1680,8 @@ static int rcu_torture_barrier(void *arg)
> do {
> atomic_set(&barrier_cbs_invoked, 0);
> atomic_set(&barrier_cbs_count, n_barrier_cbs);
> - /* wake_up() path contains the required barriers. */
> + smp_mb();
> + barrier_phase = !barrier_phase;
> for (i = 0; i < n_barrier_cbs; i++)
> wake_up(&barrier_cbs_wq[i]);
> wait_event(barrier_wq,
> --
> 1.7.8
>
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists