arm: Add for atomic half word exchange
I made the CONFIG_ARCH_MULTI_V6=y andCONFIG_CPU_V6K=y
CONFIG_CPU_32v6=y
CONFIG_CPU_32v6K=y
and compiled 4.0.4 with the patch. Result is a compilation success.
Regards,
Sarbojit
------- Original Message -------
Sender : Arnd Bergmann<[email protected]>
Date : May 19, 2015 18:51 (GMT+09:00)
Title : Re: [RFC] arm: Add for atomic half word exchange
Quoted 2 lines · 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
Quoted 13 lines
#if
__LINUX_ARM_ARCH__>= 6(quoted diff) +8
-0@@ -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"
Review line 72
Quoted 10 lines
(quoted diff) +7
-0+ " 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¥
Quoted 10 lines · Sarbojit Ganguly
I made the
CONFIG_ARCH_MULTI_V6=yandCONFIG_CPU_V6K=y
CONFIG_CPU_32v6=y
CONFIG_CPU_32v6K=yand compiled 4.0.4 with the patch. Result is a compilation success.
Regards,
Sarbojit
Hi Sarbojit,
I am not familiar about the implication of setting those options unconditionally, But from Kconfig point of view
Arnd was expecting something like below IIUC
with the patch: (a quick example)
---8<---
arch/arm/Kconfig +2 -0
@@ -812,6 +812,8 @@ config ARCH_MULTI_V6 bool "ARMv6 based platforms (ARM11)" select ARCH_MULTI_V6_V7 select CPU_V6K + select CPU_32v6 + select CPU_32v6k config ARCH_MULTI_V7 bool "ARMv7 based platforms (Cortex-A, PJ4, Scorpion, Krait)"
Quoted 41 lines
------- Original Message -------
Sender : Arnd Bergmann<[email protected]>
Date : May 19, 2015 18:51 (GMT+09:00)
Title : Re: [RFC] arm: Add for atomic half word exchangeQuoted 2 lines · 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/390Quoted 13 lines
#if __LINUX_ARM_ARCH__ >= 6(quoted diff) +8
-0@@ -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"Review line 72
Quoted 10 lines
(quoted diff) +7
-0+ " 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_V6is set.Arnd