linux-mips
[Top] [All Lists]

Re: Bug in atomic_sub_if_positive

To: Morten Larsen <mlarsen@broadcom.com>
Subject: Re: Bug in atomic_sub_if_positive
From: Ralf Baechle <ralf@linux-mips.org>
Date: Thu, 26 Jun 2008 14:11:20 +0200
Cc: linux-mips@linux-mips.org
In-reply-to: <ADD7831BD377A74E9A1621D1EAAED18F0442AF00@NT-SJCA-0750.brcm.ad.broadcom.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <ADD7831BD377A74E9A1621D1EAAED18F0442AF00@NT-SJCA-0750.brcm.ad.broadcom.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.17 (2007-11-01)
On Wed, Jun 25, 2008 at 11:07:24PM -0700, Morten Larsen wrote:

> As far as I can tell the branch optimization fixes in 2.6.21 introduced
> a bug in atomic_sub_if_positive that causes it to return even when the
> sc instruction fails. The result is that e.g. down_trylock becomes
> unreliable as the semaphore counter is not always decremented.

I did play with a test program and can't reproduce the effect with my
assembler.  I have darm memories of gas immitating some obscure behaviour
of the IRIX assembler and I think it doesn't do so for all MIPS targets.

So I'm wandering what toolchain have you been using?

  Ralf

<Prev in Thread] Current Thread [Next in Thread>