Re: PATCH? rcu_do_batch: fix a pure theoretical memory ordering race

From: Oleg Nesterov
Date: Sun Dec 03 2006 - 17:13:10 EST


On 12/03, Eric Dumazet wrote:
>
> Oleg Nesterov a ?crit :
>
> Yes, but how is it related to RCU ?
> I mean, rcu_do_batch() is just a loop like others in kernel.
> The loop itself is not buggy, but can call a buggy function, you are right.

int start_me_again;

struct rcu_head rcu_head;

void rcu_func(struct rcu_head *rcu)
{
start_me_again = 1;
}

// could be called on arbitrary CPU
void check_start_me_again(void)
{
static spinlock_t lock;

spin_lock(lock);
if (start_me_again) {
start_me_again = 0;
call_rcu(&rcu_head, rcu_func);
}
spin_unlock(lock);
}

I'd say this code is not buggy.

In case it was not clear. I do not claim we need this patch (I don't know).
And yes, I very much doubt we can hit this problem in practice (even if I am
right).

What I don't agree with is that it is callback which should take care of this
problem.

> A smp_rmb() wont avoid all possible bugs...

For example?

Oleg.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/