Re: [PATCH] spinlock: __raw_spin_is_locked() should return true for UP
[Posted August 19, 2009 by corbet]
| From: |
| Linus Torvalds <torvalds-AT-linux-foundation.org> |
| To: |
| Kumar Gala <galak-AT-kernel.crashing.org> |
| Subject: |
| Re: [PATCH] spinlock: __raw_spin_is_locked() should return true for UP |
| Date: |
| Tue, 18 Aug 2009 16:20:43 -0700 (PDT) |
| Cc: |
| peterz-AT-infradead.org, linux-kernel-AT-vger.kernel.org, rostedt-AT-goodmis.org,
linuxppc-dev-AT-ozlabs.org, mingo-AT-elte.hu, tglx-AT-linutronix.de |
| Archive-link: |
| Article, Thread
|
On Tue, 18 Aug 2009, Kumar Gala wrote:
>
> For some reason __raw_spin_is_locked() has been returning false for the
> uni-processor, non-CONFIG_DEBUG_SPINLOCK. The UP + CONFIG_DEBUG_SPINLOCK
> handles this correctly.
>
> Found this by enabling CONFIG_DEBUG_VM on PPC and hitting always hitting
> a BUG_ON that was testing to make sure the pte_lock was held.
>
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
> ---
>
> Linus, a fix for 2.6.31
This really isn't all that clear.
The thing is, some people may assert that a lock is held, but others could
easily be looping until it's not held using something like
while (spin_is_locked(lock))
cpu_relax();
so it's hard to tell whether it should return true or false in the case
where spin-locking simply doesn't exist.
Linus
(
Log in to post comments)