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




* Joel Schopp <jschopp@xxxxxxxxxxxxxx> wrote:

> 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.

feel free to implement an assembly mutex fastpath, and it would
certainly be welcome and useful - but i think you are wrong about SMP
synchronization:

> Anyway, here is some disassembly of some of the code generated with my
> comments:
>
> c00000000049bf9c <.mutex_lock>:
> c00000000049bf9c: 7c 00 06 ac eieio
> c00000000049bfa0: 7d 20 18 28 lwarx r9,r0,r3
> c00000000049bfa4: 31 29 ff ff addic r9,r9,-1

> The eieio is completly unnecessary, it got picked up from
> atomic_dec_return (Anton, why is there an eieio at the start of
> atomic_dec_return in the first place?).

a mutex is like a spinlock, it must prevent loads and stores within the
critical section from 'leaking outside the critical section' [they must
not be reordered to before the mutex_lock(), nor to after the
mutex_unlock()] - hence the barriers added by atomic_dec_return() are
very much needed.

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



Relevant Pages

  • Re: [patch 00/21] mutex subsystem, -V14
    ... specific version like arm has? ... We'll either need an arch specific version or have the generic changed. ... The eieio is completly unnecessary, it got picked up from atomic_dec_return. ... 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/ ...
    (Linux-Kernel)
  • [RFC][PATCH 0/2] hrtimer breakage
    ... If you're in the To: field, I broke your arch with commit: ... alpha, arm, blackfin, frv, m68knommu, sh, sh64 and sparc ... from the second moved to the first patch, ...
    (Linux-Kernel)
  • Re: A COC muses about armbraces
    ... > a long heavy tool that's hidden inside a hollow form, ... Arch, I imagine you remember starting a car with a hand crank. ... In both instances I figured I could fracture an arm, or worse, if my ...
    (rec.crafts.woodturning)
  • Re: [PATCH 1/3] dynticks - implement no idle hz for x86
    ... > The usage of 'lock' probably needs to be made clear. ... > use of spinlock can be entirely within the arch code. ... > any CPU that wakes up. ... > while ARM is using one. ...
    (Linux-Kernel)
  • Re: [RFC][PATCH 2/3] Convert !GENERIC_TIME arches to use arch_getoffset() infrastructure.
    ... I have split out patches for each arch, ... I do not have cross compilers for these architectures, ... (like arm, and sh) ...
    (Linux-Kernel)