Re: [patch 00/21] mutex subsystem, -V14

From: Linus Torvalds
Date: Wed Jan 04 2006 - 21:52:02 EST




On Wed, 4 Jan 2006, Nicolas Pitre wrote:

> On Wed, 4 Jan 2006, Joel Schopp wrote:
>
> > > this is version 14 of the generic mutex subsystem, against v2.6.15.
> > >
> > > The patch-queue consists of 21 patches, which can also be downloaded from:
> > >
> > > http://redhat.com/~mingo/generic-mutex-subsystem/
> > >
> >
> > Took a glance at this on ppc64. Would it be useful if I contributed an arch
> > specific version like arm has? We'll either need an arch specific version or
> > have the generic changed.
>
> Don't change the generic version. You should provide a ppc specific
> version if the generic ones don't look so good.

Well, if the generic one generates _buggy_ code on ppc64, that means that
either the generic version is buggy, or one of the atomics that it uses is
buggily implemented on ppc64.

And I think it's the generic mutex stuff that is buggy. It seems to assume
memory barriers that aren't valid to assume.

A mutex is more than just updating the mutex count properly. You also have
to have the proper memory barriers there to make sure that the things that
the mutex _protects_ actually stay inside the mutex.

So while a ppc64-optimized mutex is probably a good idea per se, I think
the generic mutex code had better be fixed first and regardless of any
optimized version.

On x86/x86-64, the locked instructions automatically imply the proper
memory barriers, but that was just lucky, I think.

Linus
-
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/