2006-01-10 13:08:33

by Oleg Nesterov

[permalink] [raw]
Subject: [PATCH] rcu: fix hotplug-cpu ->donelist leak

Pointed out by Srivatsa Vaddagiri <[email protected]>.

rcu_do_batch() stops after processing maxbatch callbacks
on ->donelist leaving rcu_tasklet in TASKLET_STATE_SCHED
state.

If CPU_DEAD event happens remaining ->donelist entries are
lost, rcu_offline_cpu() kills this tasklet.

With this patch ->donelist migrates along with ->curlist
and ->nxtlist to the current cpu.

Compile tested.

Signed-off-by: Oleg Nesterov <[email protected]>

--- 2.6.15/kernel/rcupdate.c~4_HPFIX 2006-01-10 19:06:38.000000000 +0300
+++ 2.6.15/kernel/rcupdate.c 2006-01-10 19:15:01.000000000 +0300
@@ -343,8 +343,9 @@ static void __rcu_offline_cpu(struct rcu
spin_unlock_bh(&rcp->lock);
rcu_move_batch(this_rdp, rdp->curlist, rdp->curtail);
rcu_move_batch(this_rdp, rdp->nxtlist, rdp->nxttail);
-
+ rcu_move_batch(this_rdp, rdp->donelist, rdp->donetail);
}
+
static void rcu_offline_cpu(int cpu)
{
struct rcu_data *this_rdp = &get_cpu_var(rcu_data);


2006-01-11 05:01:39

by Paul E. McKenney

[permalink] [raw]
Subject: Re: [PATCH] rcu: fix hotplug-cpu ->donelist leak

On Tue, Jan 10, 2006 at 05:24:53PM +0300, Oleg Nesterov wrote:
> Pointed out by Srivatsa Vaddagiri <[email protected]>.
>
> rcu_do_batch() stops after processing maxbatch callbacks
> on ->donelist leaving rcu_tasklet in TASKLET_STATE_SCHED
> state.
>
> If CPU_DEAD event happens remaining ->donelist entries are
> lost, rcu_offline_cpu() kills this tasklet.
>
> With this patch ->donelist migrates along with ->curlist
> and ->nxtlist to the current cpu.
>
> Compile tested.

Looks good, but I fat-fingered my test scripts and left it out. :-/

Started another RCU-torture run...

Thanx, Paul

> Signed-off-by: Oleg Nesterov <[email protected]>
>
> --- 2.6.15/kernel/rcupdate.c~4_HPFIX 2006-01-10 19:06:38.000000000 +0300
> +++ 2.6.15/kernel/rcupdate.c 2006-01-10 19:15:01.000000000 +0300
> @@ -343,8 +343,9 @@ static void __rcu_offline_cpu(struct rcu
> spin_unlock_bh(&rcp->lock);
> rcu_move_batch(this_rdp, rdp->curlist, rdp->curtail);
> rcu_move_batch(this_rdp, rdp->nxtlist, rdp->nxttail);
> -
> + rcu_move_batch(this_rdp, rdp->donelist, rdp->donetail);
> }
> +
> static void rcu_offline_cpu(int cpu)
> {
> struct rcu_data *this_rdp = &get_cpu_var(rcu_data);
>

2006-01-11 16:27:51

by Paul E. McKenney

[permalink] [raw]
Subject: Re: [PATCH] rcu: fix hotplug-cpu ->donelist leak

On Tue, Jan 10, 2006 at 05:24:53PM +0300, Oleg Nesterov wrote:
> Pointed out by Srivatsa Vaddagiri <[email protected]>.
>
> rcu_do_batch() stops after processing maxbatch callbacks
> on ->donelist leaving rcu_tasklet in TASKLET_STATE_SCHED
> state.
>
> If CPU_DEAD event happens remaining ->donelist entries are
> lost, rcu_offline_cpu() kills this tasklet.
>
> With this patch ->donelist migrates along with ->curlist
> and ->nxtlist to the current cpu.
>
> Compile tested.

This passed a ten-hour RCU torture test, with the torture test augmented
by Vatsa's CPU-hotplug RCU-torture-test patch.

Thanx, Paul

Acked-by: Paul E. McKenney <[email protected]>
> Signed-off-by: Oleg Nesterov <[email protected]>
>
> --- 2.6.15/kernel/rcupdate.c~4_HPFIX 2006-01-10 19:06:38.000000000 +0300
> +++ 2.6.15/kernel/rcupdate.c 2006-01-10 19:15:01.000000000 +0300
> @@ -343,8 +343,9 @@ static void __rcu_offline_cpu(struct rcu
> spin_unlock_bh(&rcp->lock);
> rcu_move_batch(this_rdp, rdp->curlist, rdp->curtail);
> rcu_move_batch(this_rdp, rdp->nxtlist, rdp->nxttail);
> -
> + rcu_move_batch(this_rdp, rdp->donelist, rdp->donetail);
> }
> +
> static void rcu_offline_cpu(int cpu)
> {
> struct rcu_data *this_rdp = &get_cpu_var(rcu_data);
>

2006-01-11 18:09:31

by Oleg Nesterov

[permalink] [raw]
Subject: Re: [PATCH] rcu: fix hotplug-cpu ->donelist leak

"Paul E. McKenney" wrote:
>
> This passed a ten-hour RCU torture test, with the torture test augmented

Thank you!

> by Vatsa's CPU-hotplug RCU-torture-test patch.

I can't find this patch, could you point me?

Oleg.

2006-01-11 18:21:06

by Paul E. McKenney

[permalink] [raw]
Subject: Re: [PATCH] rcu: fix hotplug-cpu ->donelist leak

On Wed, Jan 11, 2006 at 10:25:35PM +0300, Oleg Nesterov wrote:
> "Paul E. McKenney" wrote:
> >
> > This passed a ten-hour RCU torture test, with the torture test augmented
>
> Thank you!
>
> > by Vatsa's CPU-hotplug RCU-torture-test patch.
>
> I can't find this patch, could you point me?

http://marc.theaimsgroup.com/?l=linux-kernel&m=113378075217761&w=2

I just realized that I had failed to ack this one, so just did so.

Thanx, Paul