Re: [PATCH 1/4] generic-smp: remove single ipi fallback forsmp_call_function_many()

From: Oleg Nesterov
Date: Tue Feb 17 2009 - 07:29:44 EST


On 02/16, Oleg Nesterov wrote:
>
> > + data->refs = cpumask_weight(&data->cpumask);
> > +
> > + spin_lock_irqsave(&call_function.lock, flags);
> > + call_function.counter++;
> > + list_add_tail_rcu(&data->csd.list, &call_function.queue);
> > + spin_unlock_irqrestore(&call_function.lock, flags);
>
> What if the initialization above leaks into the critical section?
>
> I mean, generic_smp_call_function_interrupt() running on another CPU
> can see the result of list_add_tail_rcu() and cpumask_and(data->cpumask)
> but not (say) "data->refs = ...".

I was wrong, sorry.

list_add_tail_rcu() implies wmb() and list_for_each_entry_rcu() does
smp_read_barrier_depends(), so another CPU must always see the fully
initialized entry.

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/