linux-mips
[Top] [All Lists]

Re: [PATCH 1/2] MIPS: Allow kernel use of ll/sc to be separate from the

To: David Daney <ddaney@caviumnetworks.com>
Subject: Re: [PATCH 1/2] MIPS: Allow kernel use of ll/sc to be separate from the presence of ll/sc.
From: Ralf Baechle <ralf@linux-mips.org>
Date: Wed, 5 Aug 2009 02:18:21 +0100
Cc: linux-mips@linux-mips.org
In-reply-to: <1247508920-29153-1-git-send-email-ddaney@caviumnetworks.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1247508920-29153-1-git-send-email-ddaney@caviumnetworks.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.18 (2008-05-17)
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.

Thanks!

  Ralf

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [PATCH 1/2] MIPS: Allow kernel use of ll/sc to be separate from the presence of ll/sc., Ralf Baechle <=