[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1012081618530.28112@router.home>
Date: Wed, 8 Dec 2010 16:20:06 -0600 (CST)
From: Christoph Lameter <cl@...ux.com>
To: Tejun Heo <tj@...nel.org>
cc: akpm@...ux-foundation.org, Pekka Enberg <penberg@...helsinki.fi>,
linux-kernel@...r.kernel.org,
Eric Dumazet <eric.dumazet@...il.com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Subject: Re: [cpuops cmpxchg V1 2/4] x86: this_cpu_cmpxchg and this_cpu_xchg
operations
Argh. I included __this_cpu_cmpxchg_8 done with cmpxchg8b for 32 bit. That
has some issues....
Subject: Fixup __this_cpu_cmpxchg_8
__this_cpu_cmpxchg_8 can cause compilation failure since it is expanded
for any this_cpu_cmpxchg independent of the size or type of argument.
However. __this_cpu_cmpxchg_8 only generates code for the 8 byte
case. Use a union to get around the compilation failures.
Signed-off-by: Christoph Lameter <cl@...ux.com>
---
arch/x86/include/asm/percpu.h | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
Index: linux-2.6/arch/x86/include/asm/percpu.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/percpu.h 2010-12-08 14:48:02.000000000 -0600
+++ linux-2.6/arch/x86/include/asm/percpu.h 2010-12-08 16:01:24.000000000 -0600
@@ -391,15 +391,23 @@ do { \
#ifndef CONFIG_X86_64
#ifdef CONFIG_X86_CMPXCHG64
-/* We can support a 8 byte cmpxchg with a special instruction on 32 bit */
+/*
+ * We can support a 8 byte cmpxchg with a special instruction on 32 bit.
+ *
+ * Note that some of the strangeness here with the __new variable is due to
+ * the need to expand and compile this function for arbitary types even
+ * though the code will not be included in the .o file if used for a smaller
+ * type.
+ */
#define __this_cpu_cmpxchg_8(pcp, oval, nval) \
({ \
- typeof(var) __ret; \
- typeof(var) __old = (oval); \
- typeof(var) __new = (nval); \
+ typeof(pcp) __ret; \
+ typeof(pcp) __old = (oval); \
+ union x { typeof(pcp) n;u64 m; } __new; \
+ __new.n = (nval); \
asm("cmpxchg8b %2, "__percpu_arg(1) \
- : "=A" (__ret), "+m" (&pcp) \
- : "b" (((u32)new), "c" ((u32)(new >> 32)), "0" (__old) \
+ : "=A" (__ret), "+m" (pcp) \
+ : "b" ((u32)__new.m), "c" ((u32)(__new.m >> 32)), "0" (__old) \
: "memory"); \
__ret; \
})
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists