Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752991AbbBYP6v (ORCPT ); Wed, 25 Feb 2015 10:58:51 -0500 Received: from mout.kundenserver.de ([212.227.126.130]:54385 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752450AbbBYP6u (ORCPT ); Wed, 25 Feb 2015 10:58:50 -0500 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: Pranith Kumar , Russell King , open list Subject: Re: [RFC PATCH] arm: asm/cmpxchg.h: Add support half-word xchg() Date: Wed, 25 Feb 2015 16:58:35 +0100 Message-ID: <3465519.0ga9zC7F7b@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1424878581-11701-1-git-send-email-bobby.prani@gmail.com> References: <1424878581-11701-1-git-send-email-bobby.prani@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:i5guMpp9QOKIPDBcjmsQY9/1eH+e5Wbr/BDaZL7J1frm4nzX6lq 5Ce8nOkChr6dr6d6PyCtZyA/vQi2OrThjemFjrkzysNZx8UND7ZZ80T2swUZ0LpZx5UAxm0 NBsux8fwbxA3CUu6nAJhqNwaYeySkTN41g/y4VhWKnEK52FDHmhrqgNNQB54fypvWPPBEUw bj8h4NE6dhGFOSdkQYvCQ== X-UI-Out-Filterresults: notjunk:1; Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1765 Lines: 49 On Wednesday 25 February 2015 10:36:20 Pranith Kumar wrote: > This patch adds support for a half-word xchg() for ARM using ldrexh/strexh > instructions. It also fixes an asm comment for __cmpxchg2. > > Currently using a half-word xchg() results in the following splat on an ARMv7 > machine. > > [ 45.833303] xchg: bad data size: pc 0xbe806020, ptr 0xeb18deee, size 2 > [ 45.833324] ------------[ cut here ]------------ > [ 45.837939] kernel BUG at /dvs/git/dirty/git-master_linux/kernel/arch/arm/kernel/traps.c:727! > > Signed-off-by: Pranith Kumar Unfortunately, the BUG message seems incomplete, can you reproduce this with CONFIG_DEBUG_BUGVERBOSE enabled? > arch/arm/include/asm/cmpxchg.h | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/include/asm/cmpxchg.h b/arch/arm/include/asm/cmpxchg.h > index abb2c37..9505cca 100644 > --- a/arch/arm/include/asm/cmpxchg.h > +++ b/arch/arm/include/asm/cmpxchg.h > @@ -50,6 +50,16 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size > : "r" (x), "r" (ptr) > : "memory", "cc"); > break; > + case 2: > + asm volatile("@ __xchg2\n" > + "1: ldrexh %0, [%3]\n" > + " strexh %1, %2, [%3]\n" > + " teq %1, #0\n" > + " bne 1b" > + : "=&r" (ret), "=&r" (tmp) > + : "r" (x), "r" (ptr) > + : "memory", "cc"); > + break; > case 4: > asm volatile("@ __xchg4\n" > "1: ldrex %0, [%3]\n" Does this work on all ARMv6 or just ARMv6k? Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/