From: Chen Gang <gang.chen@asianux.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Catalin Marinas <Catalin.Marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
Tony Lindgren <tony@atomide.com>,
"olof@lixom.net" <olof@lixom.net>,
Santosh Shilimkar <santosh.shilimkar@ti.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [Suggestion] ARM64: kernel: compiling issue, need implement cmpxchg64 with assembler language.
Date: Sat, 20 Apr 2013 10:28:55 +0800 [thread overview]
Message-ID: <5171FD67.2080104@asianux.com> (raw)
In-Reply-To: <201304191412.54601.arnd@arndb.de>
On 2013年04月19日 20:12, Arnd Bergmann wrote:
> On Friday 19 April 2013, Chen Gang wrote:
>> in arch/arm64/include/asm, not define the function cmpxchg64
>>
>> when compiling with allmodconfig,
>> drivers/block/blockconsole.c will need this function.
>>
>> I am not quite familiar with ARM64 (neither ARM64 assembler)
>>
>> can any member helps to send related patch ?
>> if no one have time to send related patch, I should try.
>> and I am glad to try, but need additional time resources,
>> if I try, I should finish it within this month (2013-4-30).
>>
>> welcome any suggestions or completions.
>
> cmpxchg64 is the same as cmpxchg on 64-bit platforms, can't the
> driver be changed to use the latter?
>
> Arnd
>
>
can we be sure that cmpxchg64 is equal to cmpchg on all 64-bit platforms ?
(I guess, the driver may need cross multiple platforms)
(it seems, under x86, s390, better use cmpxchg64, at least they define it).
whether we can be sure or not,
I still prefer to define the macro cmpxchg64 just the alias of cmpxchg.
(and I also guess ARM64 is always on 64-bit platform)
the related patch may be like below.
-------------------------------patch begin--------------------------------------
diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h
index 968b5cb..b572d2b 100644
--- a/arch/arm64/include/asm/cmpxchg.h
+++ b/arch/arm64/include/asm/cmpxchg.h
@@ -170,4 +170,6 @@ static inline unsigned long __cmpxchg_mb(volatile void *ptr, unsigned long old,
(unsigned long)(n), \
sizeof(*(ptr))))
+#define cmpxchg64(ptr,o,n) cmpxchg((ptr),(o),(n))
+
#endif /* __ASM_CMPXCHG_H */
-------------------------------patch end----------------------------------------
I think, we can also reference the implementation of s390:
it is in arch/s390/include/asm/cmpxchg.h.
since we are ARM64, excluding ARM(32,16...), we can only consider 64-bit.
if in the future, ARM64 and ARM are merged together:
we can use CONFIG_64BIT to switch the cmpxchg64 definition.
if define CONFIG_64BIT, use cmpxchg instead of cmpxchg64.
else, use the definition of ARM (arch/arm/include/asm/cmpxchg.h already defines cmpxchg64)
-------------------------------reference begin----------------------------------
#ifdef CONFIG_64BIT
#define cmpxchg64(ptr, o, n) \
({ \
cmpxchg((ptr), (o), (n)); \
})
#else /* CONFIG_64BIT */
...
-------------------------------reference end------------------------------------
:-)
--
Chen Gang
Asianux Corporation
next prev parent reply other threads:[~2013-04-20 2:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-19 11:45 [Suggestion] ARM64: kernel: compiling issue, need implement cmpxchg64 with assembler language Chen Gang
2013-04-19 12:12 ` Arnd Bergmann
2013-04-20 2:28 ` Chen Gang [this message]
2013-04-20 7:32 ` Arnd Bergmann
2013-04-22 5:08 ` Chen Gang
2013-04-22 5:08 ` [PATCH] ARM64: kernel: compiling issue, define cmpxchg64 and cmpxchg64_local for outside using Chen Gang
2013-04-23 10:48 ` Catalin Marinas
2013-04-23 10:54 ` Chen Gang
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=5171FD67.2080104@asianux.com \
--to=gang.chen@asianux.com \
--cc=Catalin.Marinas@arm.com \
--cc=arnd@arndb.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=olof@lixom.net \
--cc=santosh.shilimkar@ti.com \
--cc=tony@atomide.com \
--cc=will.deacon@arm.com \
/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