Re: [PATCH][2.5] Protect smp_call_function_data w/ spinlocks on

Zwane Mwaikambo (zwane@holomorphy.com)
Fri, 14 Feb 2003 12:16:12 -0500 (EST)


On Fri, 14 Feb 2003, Ivan Kokshaysky wrote:

> On Fri, Feb 14, 2003 at 06:51:54AM -0500, Zwane Mwaikambo wrote:
> > This is an untested patch to remove the custom mutex, however it
> > doesn't maintain the same semantics wrt 'retry' and unconditionally
> > blocks on contention.
>
> Why do you want to remove it? The critical data here is a single pointer
> which can be effectively protected without spinlock.

Ok the reason being is that the lock not only protects the
smp_call_function_data pointer but also acts as a lock for that critical
section. Without it you'll constantly be overwriting the pointer halfway
through IPI acceptance (or even worse whilst a remote CPU is assigning the
data members).

Although i'm not denying there isn't a way to do this lockless, i believe
what some architectures did was poll on the pointer then do an assignment
which i think is a bit too much effort when using a spinlock is much
saner. Regardless i'd be interested to hear about alternatives.

Cheers,
Zwane

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