mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sarbojit Ganguly <ganguly.s@samsung.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Sarbojit Ganguly <ganguly.s@samsung.com>,
	"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	"SHARAN ALLUR sharan.allur@samsung.com" 
	<"SHARANALLUR<sharan.allur"@samsung.com>,
	"VIKRAM MUPPARTHI vikram.m@samsung.com" 
	<"VIKRAMMUPPARTHI<vikram.m"@samsung.com>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"Waiman.Long@hp.com" <Waiman.Long@hp.com>,
	"WillDeacon<will.deacon"@arm.com
Subject: Re: Re: Re: [PATCH] arm: Adding support for atomic half word exchange
Date: Thu, 20 Aug 2015 08:24:35 +0000 (GMT)	[thread overview]
Message-ID: <1818188924.338311440059074422.JavaMail.weblogic@ep2mlwas04c> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=utf-8, Size: 6169 bytes --]

Hello Russell, 

My apologies for the accidental HTML formatting.
I have reconfigured my e-mail client to use text-only format by default.  
Here is the patch and its description.


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 to support the exchange.
ARMv6 and lower does not have support for LDREXH, so we need to make sure things
do not break when we're compiling on ARMv6.

Signed-off-by: Sarbojit Ganguly 
---
arch/arm/include/asm/cmpxchg.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/arch/arm/include/asm/cmpxchg.h b/arch/arm/include/asm/cmpxchg.h
index 1692a05..547101d 100644
--- a/arch/arm/include/asm/cmpxchg.h
+++ b/arch/arm/include/asm/cmpxchg.h
@@ -50,6 +50,24 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size
                        : "r" (x), "r" (ptr)
                        : "memory", "cc");
                break;
+#if !defined (CONFIG_CPU_V6)
+               /*
+                * Halfword exclusive exchange
+                * This is new implementation as qspinlock
+                * wants 16 bit atomic CAS.
+                * This is not supported on ARMv6.
+                */
+       case 2:
+               asm volatile("@ __xchg2 "
+               "1:     ldrexh  %0, [%3] "
+               "       strexh  %1, %2, [%3] "
+               "       teq     %1, #0 "
+               "       bne     1b"
+               : "=&r" (ret), "=&r" (tmp)
+               : "r" (x), "r" (ptr)
+               : "memory", "cc");
+               break;
+#endif
        case 4:
                asm volatile("@ __xchg4 "
                "1:     ldrex   %0, [%3] "



Regards,
Sarbojit

------- Original Message -------
Sender : Russell King - ARM Linux<linux@arm.linux.org.uk>
Date : Aug 20, 2015 13:49 (GMT+05:30)
Title : Re: Re: [PATCH] arm: Adding support for atomic half word exchange

This email is unreadable.  Do NOT use html email when discussing linux
matters.  Many mailing lists will reject or discard your message.

On Thu, Aug 20, 2015 at 06:47:50AM +0000, Sarbojit Ganguly wrote:
> 
> 
> 
> 
> 
> 
> 
> 
> 
My apologies, the e-mail editor was not configured properly.
CC'ed to relevant maintainers and reposting once again with proper formatting.

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 to support the exchange.
ARMv6 and lower does not have support for LDREXH, so we need to make sure things
do not break when we're compiling on ARMv6.

Signed-off-by: Sarbojit Ganguly 
---
arch/arm/include/asm/cmpxchg.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/arch/arm/include/asm/cmpxchg.h b/arch/arm/include/asm/cmpxchg.h
index 1692a05..547101d 100644
--- a/arch/arm/include/asm/cmpxchg.h
+++ b/arch/arm/include/asm/cmpxchg.h
@@ -50,6 +50,24 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size
                        : "r" (x), "r" (ptr)
                        : "memory", "cc");
                break;
+#if !defined (CONFIG_CPU_V6)
+               /*
+                * Halfword exclusive exchange
+                * This is new implementation as qspinlock
+                * wants 16 bit atomic CAS.
+                * This is not supported on ARMv6.
+                */
+       case 2:
+               asm volatile("@ __xchg2 "
+               "1:     ldrexh  %0, [%3] "
+               "       strexh  %1, %2, [%3] "
+               "       teq     %1, #0 "
+               "       bne     1b"
+               : "=&r" (ret), "=&r" (tmp)
+               : "r" (x), "r" (ptr)
+               : "memory", "cc");
+               break;
+#endif
        case 4:
                asm volatile("@ __xchg4 "
                "1:     ldrex   %0, [%3] "



Regards,
Sarbojit

------- Original Message -------
Sender : Catalin Marinas
Date : Aug 19, 2015 21:43 (GMT+05:30)
Title : Re: [PATCH] arm: Adding support for atomic half word exchange

On Tue, Aug 18, 2015 at 09:17:53AM +0100, 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 to support the exchange.
> ARMv6 and lower does not have support for LDREXH, so we need to make sure things do not break when we're compiling on ARMv6.

First of all, please wrap the text appropriately.

Secondly, you need to cc the relevant maintainer and mailing list (try
running ./scripts/get_maintainer.pl on this patch to get some hints).

-- 
Catalin

> 


> 

> 
감사합니다

> 
사보짓   선임   삼성 전자

> 
----------------------------------------------------------------------+

> 
The Tao lies beyond Yin and Yang. It is silent and still as a pool of water.      |

> 
It does not seek fame, therefore nobody knows its presence.                       |

> 
It does not seek fortune, for it is complete within itself.                       |

> 
It exists beyond space and time.                                                  |

> 
----------------------------------------------------------------------+

> 


> 
> 
> 
> 
> 




-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.


감사합니다
사보짓   선임   삼성 전자
----------------------------------------------------------------------+
The Tao lies beyond Yin and Yang. It is silent and still as a pool of water.      |
It does not seek fame, therefore nobody knows its presence.                       |
It does not seek fortune, for it is complete within itself.                       |
It exists beyond space and time.                                                  |
----------------------------------------------------------------------+ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

             reply	other threads:[~2015-08-20  8:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-20  8:24 Sarbojit Ganguly [this message]
2015-08-20 14:25 Sarbojit Ganguly

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=1818188924.338311440059074422.JavaMail.weblogic@ep2mlwas04c \
    --to=ganguly.s@samsung.com \
    --cc="SHARANALLUR<sharan.allur"@samsung.com \
    --cc="VIKRAMMUPPARTHI<vikram.m"@samsung.com \
    --cc="WillDeacon<will.deacon"@arm.com \
    --cc=Waiman.Long@hp.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=peterz@infradead.org \
    /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

all inboxes | Powered by JetHome®