On Mon, Jul 13, 2009 at 11:15:19AM -0700, David Daney wrote:
> On some CPUs, it is more efficient to disable and enable interrupts in
> the kernel rather than use ll/sc for atomic operations. But if we
> were to set cpu_has_llsc to false, we would break the userspace futex
> interface (in asm/futex.h).
> We separate the two concepts, with a new predicate kernel_uses_llsc,
> that lets us disable the kernel's use of ll/sc while still allowing
> the futex code to use it.
> Also there were a couple of cases in bitops.h where we were using
> ll/sc unconditionally even if cpu_has_llsc were false. There are
> several places in assembly code where the configure variable
> CONFIG_CPU_HAS_LLSC is used instead of cpu_has_llsc, so we make
> cpu_has_llsc true if CONFIG_CPU_HAS_LLSC is set, for consistency.
The uses in bitops.h you mentioned were not bugs; they were wrapped in
#ifdef CONFIG_CPU_MIPSR2 and MIPS R2 implies having LL/SC. So for sane
setups there just is no point in bothering.
As discussed on IRC - this patch adds one more use of CONFIG_CPU_HAS_LLSC
which really should die. So I turned the remaining CONFIG_CPU_HAS_LLSC
users further upside down, removed CONFIG_CPU_HAS_LLSC and applied your
patch with the necessary adjustments on top.