2007-11-27 00:17:26

by Christoph Lameter

[permalink] [raw]
Subject: [patch 11/14] Powerpc: Use generic per cpu

Powerpc has a way to determine the address of the per cpu area of the
currently executing processor via the paca and the array of per cpu
offsets is avoided by looking up the per cpu area from the remote
paca's (copying x86_64).

Cc: Paul Mackerras <[email protected]>
Signed-off-by: Christoph Lameter <[email protected]>

---
include/asm-powerpc/percpu.h | 19 -------------------
1 file changed, 19 deletions(-)

Index: linux-2.6/include/asm-powerpc/percpu.h
===================================================================
--- linux-2.6.orig/include/asm-powerpc/percpu.h 2007-11-24 10:27:31.088350556 -0800
+++ linux-2.6/include/asm-powerpc/percpu.h 2007-11-24 10:29:20.752350757 -0800
@@ -16,25 +16,6 @@
#define __my_cpu_offset() get_paca()->data_offset
#define per_cpu_offset(x) (__per_cpu_offset(x))

-/* var is in discarded region: offset to particular copy we want */
-#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)))
-#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))
-#define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, local_paca->data_offset))
-
-extern void setup_per_cpu_areas(void);
-
-#else /* ! SMP */
-
-#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var))
-#define __get_cpu_var(var) per_cpu__##var
-#define __raw_get_cpu_var(var) per_cpu__##var
-
#endif /* SMP */
-
-#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
-
-#else
#include <asm-generic/percpu.h>
-#endif
-
#endif /* _ASM_POWERPC_PERCPU_H_ */

--


2007-11-27 07:42:24

by Kumar Gala

[permalink] [raw]
Subject: Re: [patch 11/14] Powerpc: Use generic per cpu


On Nov 26, 2007, at 6:14 PM, Christoph Lameter wrote:

> Powerpc has a way to determine the address of the per cpu area of the
> currently executing processor via the paca and the array of per cpu
> offsets is avoided by looking up the per cpu area from the remote
> paca's (copying x86_64).
>
> Cc: Paul Mackerras <[email protected]>
> Signed-off-by: Christoph Lameter <[email protected]>
>
> ---
> include/asm-powerpc/percpu.h | 19 -------------------
> 1 file changed, 19 deletions(-)
>
> Index: linux-2.6/include/asm-powerpc/percpu.h
> ===================================================================
> --- linux-2.6.orig/include/asm-powerpc/percpu.h 2007-11-24
> 10:27:31.088350556 -0800
> +++ linux-2.6/include/asm-powerpc/percpu.h 2007-11-24
> 10:29:20.752350757 -0800
> @@ -16,25 +16,6 @@
> #define __my_cpu_offset() get_paca()->data_offset
> #define per_cpu_offset(x) (__per_cpu_offset(x))

This concerns me. paca doesn't exist on all PPC platforms.

- k

2007-11-27 18:16:47

by Christoph Lameter

[permalink] [raw]
Subject: Re: [patch 11/14] Powerpc: Use generic per cpu

On Tue, 27 Nov 2007, Kumar Gala wrote:

> > Index: linux-2.6/include/asm-powerpc/percpu.h
> > ===================================================================
> > --- linux-2.6.orig/include/asm-powerpc/percpu.h 2007-11-24
> > 10:27:31.088350556 -0800
> > +++ linux-2.6/include/asm-powerpc/percpu.h 2007-11-24 10:29:20.752350757
> > -0800
> > @@ -16,25 +16,6 @@
> > #define __my_cpu_offset() get_paca()->data_offset
> > #define per_cpu_offset(x) (__per_cpu_offset(x))
>
> This concerns me. paca doesn't exist on all PPC platforms.

I wonder why the current code is working then.

2007-11-27 20:58:41

by Paul Mackerras

[permalink] [raw]
Subject: Re: [patch 11/14] Powerpc: Use generic per cpu

Christoph Lameter writes:
> On Tue, 27 Nov 2007, Kumar Gala wrote:
>
> > > Index: linux-2.6/include/asm-powerpc/percpu.h
> > > ===================================================================
> > > --- linux-2.6.orig/include/asm-powerpc/percpu.h 2007-11-24
> > > 10:27:31.088350556 -0800
> > > +++ linux-2.6/include/asm-powerpc/percpu.h 2007-11-24 10:29:20.752350757
> > > -0800
> > > @@ -16,25 +16,6 @@
> > > #define __my_cpu_offset() get_paca()->data_offset
> > > #define per_cpu_offset(x) (__per_cpu_offset(x))
> >
> > This concerns me. paca doesn't exist on all PPC platforms.
>
> I wonder why the current code is working then.

Did you try both 32-bit (CONFIG_64BIT=n) and 64-bit (CONFIG_64BIT=y)
configurations? The paca only exists in 64-bit kernels.

Paul.

2007-11-27 21:13:29

by Christoph Lameter

[permalink] [raw]
Subject: Re: [patch 11/14] Powerpc: Use generic per cpu

On Wed, 28 Nov 2007, Paul Mackerras wrote:

> Did you try both 32-bit (CONFIG_64BIT=n) and 64-bit (CONFIG_64BIT=y)
> configurations? The paca only exists in 64-bit kernels.

I build both and there is no dependency on 32bit or 64 bit in
include/asm-powerpc/percpu.h. Both access the paca (whatever that is).

2007-11-28 02:36:07

by Paul Mackerras

[permalink] [raw]
Subject: Re: [patch 11/14] Powerpc: Use generic per cpu

Christoph Lameter writes:

> On Wed, 28 Nov 2007, Paul Mackerras wrote:
>
> > Did you try both 32-bit (CONFIG_64BIT=n) and 64-bit (CONFIG_64BIT=y)
> > configurations? The paca only exists in 64-bit kernels.
>
> I build both and there is no dependency on 32bit or 64 bit in
> include/asm-powerpc/percpu.h. Both access the paca (whatever that is).

Look at line 3 of include/asm-powerpc/percpu.h:

#ifdef __powerpc64__

As far as I can see, after applying your series of patches, I end up
with an unbalanced #ifdef in include/asm-powerpc/percpu.h. I see 3
#ifdef/#ifndef, but only two #endifs. It needs another #endif after
the #endif /* SMP */ to match the #ifdef __powerpc64__. With that
change it looks OK, since 32-bit uses asm-generic/percpu.h for both
SMP and UP.

Paul.

2007-11-28 18:55:00

by Christoph Lameter

[permalink] [raw]
Subject: Re: [patch 11/14] Powerpc: Use generic per cpu

On Wed, 28 Nov 2007, Paul Mackerras wrote:

> Christoph Lameter writes:
>
> > On Wed, 28 Nov 2007, Paul Mackerras wrote:
> >
> > > Did you try both 32-bit (CONFIG_64BIT=n) and 64-bit (CONFIG_64BIT=y)
> > > configurations? The paca only exists in 64-bit kernels.
> >
> > I build both and there is no dependency on 32bit or 64 bit in
> > include/asm-powerpc/percpu.h. Both access the paca (whatever that is).
>
> Look at line 3 of include/asm-powerpc/percpu.h:
>
> #ifdef __powerpc64__
>
> As far as I can see, after applying your series of patches, I end up
> with an unbalanced #ifdef in include/asm-powerpc/percpu.h. I see 3
> #ifdef/#ifndef, but only two #endifs. It needs another #endif after
> the #endif /* SMP */ to match the #ifdef __powerpc64__. With that
> change it looks OK, since 32-bit uses asm-generic/percpu.h for both
> SMP and UP.

Ahhh.. Ok. Fixed.

Do you know where to get a ppc64 crosscompiler? I
tried to build gcc for ppc64 but the build failed on x86_64.

2007-12-02 20:56:27

by Benjamin Herrenschmidt

[permalink] [raw]
Subject: Re: [patch 11/14] Powerpc: Use generic per cpu


On Wed, 2007-11-28 at 10:54 -0800, Christoph Lameter wrote:
> > As far as I can see, after applying your series of patches, I end up
> > with an unbalanced #ifdef in include/asm-powerpc/percpu.h. I see 3
> > #ifdef/#ifndef, but only two #endifs. It needs another #endif after
> > the #endif /* SMP */ to match the #ifdef __powerpc64__. With that
> > change it looks OK, since 32-bit uses asm-generic/percpu.h for both
> > SMP and UP.
>
> Ahhh.. Ok. Fixed.
>
> Do you know where to get a ppc64 crosscompiler? I
> tried to build gcc for ppc64 but the build failed on x86_64.

Usually, we build biarch... checked if your existing gcc happen to work
with -m64 ?

Ben.