linux-mips
[Top] [All Lists]

Re: cmpxchg broken in some situation

To: Ralf Baechle <ralf@linux-mips.org>
Subject: Re: cmpxchg broken in some situation
From: David Daney <ddaney@avtrex.com>
Date: Sun, 30 Sep 2007 20:56:51 -0700
Cc: Fuxin Zhang <fxzhang@ict.ac.cn>, linux-mips@linux-mips.org
In-reply-to: <20071001025340.GA7091@linux-mips.org>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <46FF7BC2.5050905@ict.ac.cn> <20071001025340.GA7091@linux-mips.org>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Thunderbird 1.5.0.12 (X11/20070719)
Ralf Baechle wrote:
+       } else if (cpu_has_llsc) {                                      \
+               __asm__ __volatile__(                                   \
+               "  .set    push                            \n"        \
+               "  .set    noat                            \n"        \
+               "  .set    mips3                           \n"        \
+               "1:        " ld "        %0, %2          # __cmpxchg_u32 \n"    
    \
+               "  bne     %0, %z3, 2f                     \n"        \
+               "  .set    mips0                           \n"        \
+               "  move    $1, %z4                         \n"        \
+               "  .set    mips3                           \n"        \
+               "  " st "        $1, %1                          \n"        \
+               "  beqz    $1, 3f                          \n"        \
+               "2:                                                \n"        \
+               "  .subsection 2                           \n"        \
+               "3:        b       1b                              \n"        \
+               "  .previous                               \n"        \
+               "  .set    pop                             \n"        \
+               : "=&r" (__ret), "=R" (*m)                              \
+               : "R" (*m), "Jr" (old), "Jr" (new)                        \
+               : "memory");                                          \
Is a 'sync' needed after the 'sc'?

According to this message:
http://www.linux-mips.org/cgi-bin/mesg.cgi?a=linux-mips&i=20070919084515.GM9972%40networkno.de
it would seem so.


David Daney

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