Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Thiemo Seufer <ths@networkno.de>
To: Morten Larsen <mlarsen@broadcom.com>
Cc: linux-mips@linux-mips.org
Subject: Re: Bug in atomic_sub_if_positive
Date: Wed, 2 Jul 2008 10:59:56 +0100	[thread overview]
Message-ID: <20080702095955.GA7007@networkno.de> (raw)
In-Reply-To: <ADD7831BD377A74E9A1621D1EAAED18F0450AC61@NT-SJCA-0750.brcm.ad.broadcom.com>

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.
> 
> Previous patch was garbled by Outlook - this one should be clean:
> 
> --- a/include/asm-mips/atomic.h	2008-06-25 22:38:43.159739000 -0700
> +++ b/include/asm-mips/atomic.h	2008-06-25 22:39:07.552065000 -0700
> @@ -292,10 +292,10 @@ static __inline__ int atomic_sub_if_posi
>  		"	beqz	%0, 2f					\n"
>  		"	 subu	%0, %1, %3				\n"
>  		"	.set	reorder					\n"
> -		"1:							\n"
>  		"	.subsection 2					\n"
>  		"2:	b	1b					\n"
>  		"	.previous					\n"
> +		"1:							\n"

AFAICS this change should make no difference to the generated code. I
suspect you assembler handles .subsection incorrectly. Can you provide
a disassembled exapmle which gets altered by this patch? Also, please
tell us the exact version of the assembler you use.


Thiemo

  parent reply	other threads:[~2008-07-02 10:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-02  0:12 Bug in atomic_sub_if_positive Morten Larsen
2008-07-02  0:28 ` [SPAM] " Markus Gothe
2008-07-02  0:43   ` Morten Larsen
2008-07-02  9:59 ` Thiemo Seufer [this message]
2008-07-02 10:31   ` Atsushi Nemoto
2008-07-02 10:51     ` Thiemo Seufer
2008-07-03 15:04       ` Atsushi Nemoto
2008-07-04 11:54         ` Ralf Baechle
  -- strict thread matches above, loose matches on Subject: below --
2008-06-26  6:07 Morten Larsen
2008-06-26 12:11 ` Ralf Baechle
2008-06-27  6:00   ` Morten Larsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080702095955.GA7007@networkno.de \
    --to=ths@networkno.de \
    --cc=linux-mips@linux-mips.org \
    --cc=mlarsen@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox