diff mbox

[-next] sparc32/sparc64: Provide cmpxchg64()

Message ID 1363290128-21247-1-git-send-email-geert@linux-m68k.org
State Changes Requested
Delegated to: David Miller
Headers show

Commit Message

Geert Uytterhoeven March 14, 2013, 7:42 p.m. UTC
sparc/sparc64 allmodconfig:

drivers/block/blockconsole.c: In function ‘bcon_advance_console_bytes’:
drivers/block/blockconsole.c:164: error: implicit declaration of function
‘cmpxchg64’

Map cmpxchg64 to cmpxchg64_local to fix this.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
http://kisskb.ellerman.id.au/kisskb/buildresult/8398811/
http://kisskb.ellerman.id.au/kisskb/buildresult/8398801/

 arch/sparc/include/asm/cmpxchg_32.h |    1 +
 arch/sparc/include/asm/cmpxchg_64.h |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

Comments

David Miller March 19, 2013, 8:20 p.m. UTC | #1
From: Geert Uytterhoeven <geert@linux-m68k.org>

Date: Thu, 14 Mar 2013 20:42:08 +0100

> sparc/sparc64 allmodconfig:

> 

> drivers/block/blockconsole.c: In function ‘bcon_advance_console_bytes’:

> drivers/block/blockconsole.c:164: error: implicit declaration of function

> ‘cmpxchg64’

> 

> Map cmpxchg64 to cmpxchg64_local to fix this.

> 

> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>


But, in the sparc 32-bit case, the _local() variants are only atomic
from the perspective of the current cpu, they are not globally atomic.

This is true because the sparc 32-bit cases use the
asm-generic/cmpxchg-local.h helpers.

I really can't apply this, it isn't correct, sorry.
Geert Uytterhoeven March 20, 2013, 8:05 a.m. UTC | #2
Hi David,

On Tue, Mar 19, 2013 at 9:20 PM, David Miller <davem@davemloft.net> wrote:
> From: Geert Uytterhoeven <geert@linux-m68k.org>
> Date: Thu, 14 Mar 2013 20:42:08 +0100
>
>> sparc/sparc64 allmodconfig:
>>
>> drivers/block/blockconsole.c: In function ‘bcon_advance_console_bytes’:
>> drivers/block/blockconsole.c:164: error: implicit declaration of function
>> ‘cmpxchg64’
>>
>> Map cmpxchg64 to cmpxchg64_local to fix this.
>>
>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
>
> But, in the sparc 32-bit case, the _local() variants are only atomic
> from the perspective of the current cpu, they are not globally atomic.
>
> This is true because the sparc 32-bit cases use the
> asm-generic/cmpxchg-local.h helpers.
>
> I really can't apply this, it isn't correct, sorry.

You're right, sorry for that.

The sparc64 part is still OK as it eventually calls __cmpxchg_u64(), isn't it?

Do you want me to send a new patch for that part only, or will you just
remove the sparc32 part?

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller March 20, 2013, 2:11 p.m. UTC | #3
From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: Wed, 20 Mar 2013 09:05:19 +0100

> The sparc64 part is still OK as it eventually calls __cmpxchg_u64(),
> isn't it?

Yes, that part is OK.

> Do you want me to send a new patch for that part only, or will you just
> remove the sparc32 part?

Please send a new patch, thank you.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Geert Uytterhoeven March 20, 2013, 2:35 p.m. UTC | #4
On Wed, Mar 20, 2013 at 3:11 PM, David Miller <davem@davemloft.net> wrote:
> From: Geert Uytterhoeven <geert@linux-m68k.org>
> Date: Wed, 20 Mar 2013 09:05:19 +0100
>
>> The sparc64 part is still OK as it eventually calls __cmpxchg_u64(),
>> isn't it?
>
> Yes, that part is OK.
>
>> Do you want me to send a new patch for that part only, or will you just
>> remove the sparc32 part?
>
> Please send a new patch, thank you.

OK, done.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/sparc/include/asm/cmpxchg_32.h b/arch/sparc/include/asm/cmpxchg_32.h
index 1fae1a0..284fb96 100644
--- a/arch/sparc/include/asm/cmpxchg_32.h
+++ b/arch/sparc/include/asm/cmpxchg_32.h
@@ -81,5 +81,6 @@  __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size)
 	((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
 			(unsigned long)(n), sizeof(*(ptr))))
 #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
+#define cmpxchg64(ptr, o, n)	cmpxchg64_local((ptr), (o), (n))
 
 #endif /* __ARCH_SPARC_CMPXCHG__ */
diff --git a/arch/sparc/include/asm/cmpxchg_64.h b/arch/sparc/include/asm/cmpxchg_64.h
index b30eb37..4adefe8 100644
--- a/arch/sparc/include/asm/cmpxchg_64.h
+++ b/arch/sparc/include/asm/cmpxchg_64.h
@@ -141,5 +141,6 @@  static inline unsigned long __cmpxchg_local(volatile void *ptr,
 	BUILD_BUG_ON(sizeof(*(ptr)) != 8);				\
 	cmpxchg_local((ptr), (o), (n));					\
   })
+#define cmpxchg64(ptr, o, n)	cmpxchg64_local((ptr), (o), (n))
 
 #endif /* __ARCH_SPARC64_CMPXCHG__ */