Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755707AbbESLUY (ORCPT ); Tue, 19 May 2015 07:20:24 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:28987 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754262AbbESLUR (ORCPT ); Tue, 19 May 2015 07:20:17 -0400 X-AuditID: cbfee68e-f79c56d000006efb-1a-555b1c6f93d9 Date: Tue, 19 May 2015 11:20:15 +0000 (GMT) From: Sarbojit Ganguly Subject: [RFC] arm: Add for atomic half word exchange To: Arnd Bergmann , "linux-arm-kernel@lists.infradead.org" Cc: "tglx@linutronix.de" , "mingo@redhat.com" , "hpa@zytor.com" , "peterz@infradead.org" , "Waiman.Long@hp.com" , "raghavendra.kt@linux.vnet.ibm.com" , "oleg@redhat.com" , "linux-kernel@vger.kernel.org" , SHARAN ALLUR , "torvalds@linux-foundation.org" , "vikram.m@samsung.com" Reply-to: ganguly.s@samsung.com MIME-version: 1.0 X-MTR: 20150519111659227@ganguly.s Msgkey: 20150519111659227@ganguly.s X-EPLocale: en_US.windows-1252 X-Priority: 3 X-EPWebmail-Msg-Type: personal X-EPWebmail-Reply-Demand: 0 X-EPApproval-Locale: X-EPHeader: ML X-MLAttribute: X-RootMTR: 20150519111659227@ganguly.s X-ParentMTR: X-ArchiveUser: X-CPGSPASS: Y X-ConfirmMail: N,general Content-type: text/plain; charset=windows-1252 MIME-version: 1.0 Message-id: <1795987946.405311432034410830.JavaMail.weblogic@ep2mlwas07a> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMIsWRmVeSWpSXmKPExsWyRsSkVjdfJjrU4Nd1FYvLu+awOTB6fN4k F8AYxWWTkpqTWZZapG+XwJUxo/kFa8EKoYrHnTcZGxhfCHYxcnAICahI9E2K6GLk5JAQMJF4 MqWfBcIWk7hwbz1bFyMXUMlSRok125axwBQt2viICcQWEpjDKNH8VwnEZhFQlXi7qhMsziag L3F6/0smkP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JLpl6GsnklZrQ/ZYGJT/u6 hhnClpY4P2sDI8zJi78/horzSxy7vQOqV0Bi6pmDUDXqEhcX/YOq4ZNYs/AtC0z9rlPLmWF2 NWz8zQ5hS0hsbXnCCmIzCyhKTOl+yA5hG0gcWTSHFd0vvAKeEl8azjNNYJSdhSQ1C0n7LCTt yGoWMLKsYhRNLUguKE5KrzDRK07MLS7NS9dLzs/dxAhOQc+W7GBsuGB9iFGAg1GJhzeiPipU iDWxrLgy9xCjBAezkgivOHd0qBBvSmJlVWpRfnxRaU5q8SFGU2CkTWSWEk3OB6bHvJJ4Q2MT c1NjUwsDQ3NzMyVx3v/nckOEBNITS1KzU1MLUotg+pg4OKUaGHl+3K47tX7XHgkh3fQZVfd2 1H9xZtFcJLHjqql2+kKvsnuuBo/6v4RZWMgmvrbpcrgYI2nzo32v5LYT1dlPv2m9VDjLXLCn MVKJKfLlKcVX4lO6e61L0+U/PJXYbnWCXdG6bPvOreVrJqo7+TRyJ7h2ethEzLuYdyp7d2Ce 9tUgfrWPbrvqlViKMxINtZiLihMB205wf1cDAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id t4JBKSMn001048 Content-Length: 1822 Lines: 47 Yes, I will try to do that. OTOH, I saw that there was a discussion on removal of bad_xchg() altogether. Perhaps that approach be better than adding this half word exchange? Regards, Sarbojit ------- Original Message ------- Sender : Arnd Bergmann Date : May 19, 2015 18:51 (GMT+09:00) Title : Re: [RFC] arm: Add for atomic half word exchange On Tuesday 19 May 2015 09:39:33 Sarbojit Ganguly wrote: > Since 16 bit half word exchange was not there and MCS based qspinlock by Waiman's xchg_tail() requires an atomic exchange on a half word, > here is a small modification to __xchg() code. We have discussed a similar patch before, see https://lkml.org/lkml/2015/2/25/390 > #if __LINUX_ARM_ARCH__ >= 6 > @@ -50,6 +52,23 @@ > : "r" (x), "r" (ptr) > : "memory", "cc"); > break; > + /* > + * halfword exclusive exchange > + * This is new implementation as qspinlock > + * wants 16 bit atomic CAS. > + */ > + 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" Please try to find a way to make this compile when CONFIG_CPU_V6 is set. Arnd ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?