* [PATCH] MIPS: Fix compile error implicit declaration of function cpu_local_wrap
@ 2010-03-11 20:03 Philby John
2010-03-11 20:09 ` David Daney
2010-03-12 14:40 ` Christoph Lameter
0 siblings, 2 replies; 4+ messages in thread
From: Philby John @ 2010-03-11 20:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Christoph Lameter, Tejun Heo, David Daney
The commit 38b7827fc removed cpu_local_xx macros that lead to
a compile error: implicit declaration of function 'cpu_local_wrap',
when compiled for the MIPS Cavium Octeon processors. Revert back
to old code.
CC: Christoph Lameter <cl@linux-foundation.org>
CC: Tejun Heo <tj@kernel.org>
CC: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Philby John <pjohn@mvista.com>
---
arch/mips/include/asm/local.h | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/arch/mips/include/asm/local.h b/arch/mips/include/asm/local.h
index bdcdef0..65ec69d 100644
--- a/arch/mips/include/asm/local.h
+++ b/arch/mips/include/asm/local.h
@@ -193,4 +193,29 @@ static __inline__ long local_sub_return(long i, local_t * l)
#define __local_add(i, l) ((l)->a.counter+=(i))
#define __local_sub(i, l) ((l)->a.counter-=(i))
+/* Need to disable preemption for the cpu local counters otherwise we could
+ still access a variable of a previous CPU in a non atomic way. */
+#define cpu_local_wrap_v(l) \
+ ({ local_t res__; \
+ preempt_disable(); \
+ res__ = (l); \
+ preempt_enable(); \
+ res__; })
+#define cpu_local_wrap(l) \
+ ({ preempt_disable(); \
+ l; \
+ preempt_enable(); }) \
+
+#define cpu_local_read(l) cpu_local_wrap_v(local_read(&__get_cpu_var(l)))
+#define cpu_local_set(l, i) cpu_local_wrap(local_set(&__get_cpu_var(l), (i)))
+#define cpu_local_inc(l) cpu_local_wrap(local_inc(&__get_cpu_var(l)))
+#define cpu_local_dec(l) cpu_local_wrap(local_dec(&__get_cpu_var(l)))
+#define cpu_local_add(i, l) cpu_local_wrap(local_add((i), &__get_cpu_var(l)))
+#define cpu_local_sub(i, l) cpu_local_wrap(local_sub((i), &__get_cpu_var(l)))
+
+#define __cpu_local_inc(l) cpu_local_inc(l)
+#define __cpu_local_dec(l) cpu_local_dec(l)
+#define __cpu_local_add(i, l) cpu_local_add((i), (l))
+#define __cpu_local_sub(i, l) cpu_local_sub((i), (l))
+
#endif /* _ARCH_MIPS_LOCAL_H */
--
1.6.3.3.311.g7ec7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] MIPS: Fix compile error implicit declaration of function cpu_local_wrap
2010-03-11 20:03 [PATCH] MIPS: Fix compile error implicit declaration of function cpu_local_wrap Philby John
@ 2010-03-11 20:09 ` David Daney
2010-03-12 10:02 ` Ralf Baechle
2010-03-12 14:40 ` Christoph Lameter
1 sibling, 1 reply; 4+ messages in thread
From: David Daney @ 2010-03-11 20:09 UTC (permalink / raw)
To: pjohn, Ralf Baechle; +Cc: linux-kernel, Christoph Lameter, Tejun Heo
On 03/11/2010 12:03 PM, Philby John wrote:
> The commit 38b7827fc removed cpu_local_xx macros that lead to
> a compile error: implicit declaration of function 'cpu_local_wrap',
> when compiled for the MIPS Cavium Octeon processors. Revert back
> to old code.
>
> CC: Christoph Lameter<cl@linux-foundation.org>
> CC: Tejun Heo<tj@kernel.org>
> CC: David Daney<ddaney@caviumnetworks.com>
> Signed-off-by: Philby John<pjohn@mvista.com>
Ralf is testing a different patch for this problem.
David Daney
> ---
> arch/mips/include/asm/local.h | 25 +++++++++++++++++++++++++
> 1 files changed, 25 insertions(+), 0 deletions(-)
>
> diff --git a/arch/mips/include/asm/local.h b/arch/mips/include/asm/local.h
> index bdcdef0..65ec69d 100644
> --- a/arch/mips/include/asm/local.h
> +++ b/arch/mips/include/asm/local.h
> @@ -193,4 +193,29 @@ static __inline__ long local_sub_return(long i, local_t * l)
> #define __local_add(i, l) ((l)->a.counter+=(i))
> #define __local_sub(i, l) ((l)->a.counter-=(i))
>
> +/* Need to disable preemption for the cpu local counters otherwise we could
> + still access a variable of a previous CPU in a non atomic way. */
> +#define cpu_local_wrap_v(l) \
> + ({ local_t res__; \
> + preempt_disable(); \
> + res__ = (l); \
> + preempt_enable(); \
> + res__; })
> +#define cpu_local_wrap(l) \
> + ({ preempt_disable(); \
> + l; \
> + preempt_enable(); }) \
> +
> +#define cpu_local_read(l) cpu_local_wrap_v(local_read(&__get_cpu_var(l)))
> +#define cpu_local_set(l, i) cpu_local_wrap(local_set(&__get_cpu_var(l), (i)))
> +#define cpu_local_inc(l) cpu_local_wrap(local_inc(&__get_cpu_var(l)))
> +#define cpu_local_dec(l) cpu_local_wrap(local_dec(&__get_cpu_var(l)))
> +#define cpu_local_add(i, l) cpu_local_wrap(local_add((i),&__get_cpu_var(l)))
> +#define cpu_local_sub(i, l) cpu_local_wrap(local_sub((i),&__get_cpu_var(l)))
> +
> +#define __cpu_local_inc(l) cpu_local_inc(l)
> +#define __cpu_local_dec(l) cpu_local_dec(l)
> +#define __cpu_local_add(i, l) cpu_local_add((i), (l))
> +#define __cpu_local_sub(i, l) cpu_local_sub((i), (l))
> +
> #endif /* _ARCH_MIPS_LOCAL_H */
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] MIPS: Fix compile error implicit declaration of function cpu_local_wrap
2010-03-11 20:09 ` David Daney
@ 2010-03-12 10:02 ` Ralf Baechle
0 siblings, 0 replies; 4+ messages in thread
From: Ralf Baechle @ 2010-03-12 10:02 UTC (permalink / raw)
To: David Daney; +Cc: pjohn, linux-kernel, Christoph Lameter, Tejun Heo
On Thu, Mar 11, 2010 at 12:09:48PM -0800, David Daney wrote:
> On 03/11/2010 12:03 PM, Philby John wrote:
> >The commit 38b7827fc removed cpu_local_xx macros that lead to
> >a compile error: implicit declaration of function 'cpu_local_wrap',
> >when compiled for the MIPS Cavium Octeon processors. Revert back
> >to old code.
> >
> >CC: Christoph Lameter<cl@linux-foundation.org>
> >CC: Tejun Heo<tj@kernel.org>
> >CC: David Daney<ddaney@caviumnetworks.com>
> >Signed-off-by: Philby John<pjohn@mvista.com>
>
> Ralf is testing a different patch for this problem.
Already applied to the lmo tree a few days ago so NACK for the posted
patch.
Ralf
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] MIPS: Fix compile error implicit declaration of function cpu_local_wrap
2010-03-11 20:03 [PATCH] MIPS: Fix compile error implicit declaration of function cpu_local_wrap Philby John
2010-03-11 20:09 ` David Daney
@ 2010-03-12 14:40 ` Christoph Lameter
1 sibling, 0 replies; 4+ messages in thread
From: Christoph Lameter @ 2010-03-12 14:40 UTC (permalink / raw)
To: Philby John; +Cc: linux-kernel, Tejun Heo, David Daney
Please fix up the mips code!
Sample fix here.
---
arch/mips/include/asm/fpu_emulator.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-2.6/arch/mips/include/asm/fpu_emulator.h
===================================================================
--- linux-2.6.orig/arch/mips/include/asm/fpu_emulator.h 2010-03-03 14:48:45.000000000 -0600
+++ linux-2.6/arch/mips/include/asm/fpu_emulator.h 2010-03-03 14:48:47.000000000 -0600
@@ -41,7 +41,7 @@ struct mips_fpu_emulator_stats {
DECLARE_PER_CPU(struct mips_fpu_emulator_stats, fpuemustats);
#define MIPS_FPU_EMU_INC_STATS(M) \
- cpu_local_wrap(__local_inc(&__get_cpu_var(fpuemustats).M))
+ local_inc(&__get_cpu_var(fpuemustats).M)
#else
#define MIPS_FPU_EMU_INC_STATS(M) do { } while (0)
On Fri, 12 Mar 2010, Philby John wrote:
> The commit 38b7827fc removed cpu_local_xx macros that lead to
> a compile error: implicit declaration of function 'cpu_local_wrap',
> when compiled for the MIPS Cavium Octeon processors. Revert back
> to old code.
>
> CC: Christoph Lameter <cl@linux-foundation.org>
> CC: Tejun Heo <tj@kernel.org>
> CC: David Daney <ddaney@caviumnetworks.com>
> Signed-off-by: Philby John <pjohn@mvista.com>
> ---
> arch/mips/include/asm/local.h | 25 +++++++++++++++++++++++++
> 1 files changed, 25 insertions(+), 0 deletions(-)
>
> diff --git a/arch/mips/include/asm/local.h b/arch/mips/include/asm/local.h
> index bdcdef0..65ec69d 100644
> --- a/arch/mips/include/asm/local.h
> +++ b/arch/mips/include/asm/local.h
> @@ -193,4 +193,29 @@ static __inline__ long local_sub_return(long i, local_t * l)
> #define __local_add(i, l) ((l)->a.counter+=(i))
> #define __local_sub(i, l) ((l)->a.counter-=(i))
>
> +/* Need to disable preemption for the cpu local counters otherwise we could
> + still access a variable of a previous CPU in a non atomic way. */
> +#define cpu_local_wrap_v(l) \
> + ({ local_t res__; \
> + preempt_disable(); \
> + res__ = (l); \
> + preempt_enable(); \
> + res__; })
> +#define cpu_local_wrap(l) \
> + ({ preempt_disable(); \
> + l; \
> + preempt_enable(); }) \
> +
> +#define cpu_local_read(l) cpu_local_wrap_v(local_read(&__get_cpu_var(l)))
> +#define cpu_local_set(l, i) cpu_local_wrap(local_set(&__get_cpu_var(l), (i)))
> +#define cpu_local_inc(l) cpu_local_wrap(local_inc(&__get_cpu_var(l)))
> +#define cpu_local_dec(l) cpu_local_wrap(local_dec(&__get_cpu_var(l)))
> +#define cpu_local_add(i, l) cpu_local_wrap(local_add((i), &__get_cpu_var(l)))
> +#define cpu_local_sub(i, l) cpu_local_wrap(local_sub((i), &__get_cpu_var(l)))
> +
> +#define __cpu_local_inc(l) cpu_local_inc(l)
> +#define __cpu_local_dec(l) cpu_local_dec(l)
> +#define __cpu_local_add(i, l) cpu_local_add((i), (l))
> +#define __cpu_local_sub(i, l) cpu_local_sub((i), (l))
> +
> #endif /* _ARCH_MIPS_LOCAL_H */
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-03-12 14:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-11 20:03 [PATCH] MIPS: Fix compile error implicit declaration of function cpu_local_wrap Philby John
2010-03-11 20:09 ` David Daney
2010-03-12 10:02 ` Ralf Baechle
2010-03-12 14:40 ` Christoph Lameter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.