LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/6] percpu: Per cpu code simplification linux-2.6.git
@ 2008-01-30 18:09 travis
  2008-01-30 18:09 ` [PATCH 1/6] modules: Fold percpu_modcopy into module.c linux-2.6.git travis
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: travis @ 2008-01-30 18:09 UTC (permalink / raw)
  To: Geert Uytterhoeven, Linus Torvalds, mingo, Thomas Gleixner
  Cc: Christoph Lameter, linux-kernel, linux-mm


Patchset to fixup differences between x86.git and base linux-2.6.git

This patchset simplifies the code that arches need to maintain to support
per cpu functionality. Most of the code is moved into arch independent
code. Only a minimal set of definitions is kept for each arch.

Based on latest linux-2.6.git

Cc: Andi Kleen <ak@suse.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: David Miller <davem@davemloft.net>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>

Cc: linux-ia64@vger.kernel.org
Cc: linuxppc-dev@ozlabs.org

Signed-off-by: Mike Travis <travis@sgi.com>
---

Notes:

* The latest linux-2.6.git as the following errors unrelated to this patch,
which prevents a complete verification:

x86_64: allmodconfig | allyesconfig
drivers/net/sis190.c:329: error: sis190_pci_tbl causes a section type conflict

ia64-sn2:
drivers/md/md.c:5881: error: __param_start_ro causes a section type conflict

s390-default:
include/linux/sched.h:1931: error: implicit declaration of function '__raw_spin_is_contended'

sparc-default:
include/asm/pgtable.h:346: error: expected '=', ',', ';', 'asm' or '__attribute__' before '___f___swp_entry'
include/asm/highmem.h:60: error: implicit declaration of function 'PageHighMem'
include/asm/highmem.h:61: error: implicit declaration of function 'page_address'

* Successful Builds:

	x86_64-default
	x86_64-single
	x86_64-8psmp
	x86_64-debug
	x86_64-numa
	i386-default
	i386-single
	i386-smp
	arm-default
	sparc64-default
	sparc64-smp
	ppc-pmac32
	ppc-smp

* Test Results:

x86_64 all configurations:

kernel BUG at /mdata/lwork/polaris1/travis/workareas/Linus/linux-2.6/drivers/ide/ide-cd.c:1726!
Pid: 1327, comm: udevd Not tainted 2.6.24-defconfig-04890-gdd430ca-dirty #1
Call Trace:
 <IRQ>  [<ffffffff804613ed>] ? cdrom_newpc_intr+0x0/0x2f3
 [<ffffffff80453edd>] ? ide_intr+0x193/0x207
 [<ffffffff80251c0c>] ? handle_IRQ_event+0x25/0x53
 [<ffffffff80253144>] ? handle_edge_irq+0xdd/0x11c
 [<ffffffff8020c1fc>] ? call_softirq+0x1c/0x28
 [<ffffffff8020e332>] ? do_IRQ+0xf1/0x15f
 [<ffffffff8020b581>] ? ret_from_intr+0x0/0xa
 <EOI>

-- 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/6] modules: Fold percpu_modcopy into module.c linux-2.6.git
  2008-01-30 18:09 [PATCH 0/6] percpu: Per cpu code simplification linux-2.6.git travis
@ 2008-01-30 18:09 ` travis
  2008-01-30 18:09 ` [PATCH 2/6] percpu: Change Kconfig to HAVE_SETUP_PER_CPU_AREA linux-2.6.git travis
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 16+ messages in thread
From: travis @ 2008-01-30 18:09 UTC (permalink / raw)
  To: Geert Uytterhoeven, Linus Torvalds, mingo, Thomas Gleixner
  Cc: Christoph Lameter, linux-kernel, linux-mm, Andi Kleen, Tony Luck,
	David Miller, Rusty Russell, linuxppc-dev, linux-ia64

[-- Attachment #1: fold-percpu_modcopy --]
[-- Type: text/plain, Size: 3230 bytes --]

percpu_modcopy() is defined multiple times in arch files. However, the only
user is module.c. Put a static definition into module.c and remove
the definitions from the arch files.

Based on latest linux-2.6.git

Cc: Andi Kleen <ak@suse.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: David Miller <davem@davemloft.net>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Cc: linuxppc-dev@ozlabs.org
Cc: linux-ia64@vger.kernel.org

Signed-off-by: Mike Travis <travis@sgi.com>
---
linux-2.6.git:
  - added back in missing pieces from x86.git merge
---
 arch/ia64/kernel/module.c    |   11 -----------
 include/asm-ia64/percpu.h    |    5 -----
 include/asm-powerpc/percpu.h |    9 ---------
 include/asm-s390/percpu.h    |    9 ---------
 4 files changed, 34 deletions(-)

--- a/arch/ia64/kernel/module.c
+++ b/arch/ia64/kernel/module.c
@@ -940,14 +940,3 @@ module_arch_cleanup (struct module *mod)
 	if (mod->arch.core_unw_table)
 		unw_remove_unwind_table(mod->arch.core_unw_table);
 }
-
-#ifdef CONFIG_SMP
-void
-percpu_modcopy (void *pcpudst, const void *src, unsigned long size)
-{
-	unsigned int i;
-	for_each_possible_cpu(i) {
-		memcpy(pcpudst + per_cpu_offset(i), src, size);
-	}
-}
-#endif /* CONFIG_SMP */
--- a/include/asm-ia64/percpu.h
+++ b/include/asm-ia64/percpu.h
@@ -22,10 +22,6 @@
 #define DECLARE_PER_CPU(type, name)				\
 	extern PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
 
-/*
- * Pretty much a literal copy of asm-generic/percpu.h, except that percpu_modcopy() is an
- * external routine, to avoid include-hell.
- */
 #ifdef CONFIG_SMP
 
 extern unsigned long __per_cpu_offset[NR_CPUS];
@@ -38,7 +34,6 @@ DECLARE_PER_CPU(unsigned long, local_per
 #define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __ia64_per_cpu_var(local_per_cpu_offset)))
 #define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __ia64_per_cpu_var(local_per_cpu_offset)))
 
-extern void percpu_modcopy(void *pcpudst, const void *src, unsigned long size);
 extern void setup_per_cpu_areas (void);
 extern void *per_cpu_init(void);
 
--- a/include/asm-powerpc/percpu.h
+++ b/include/asm-powerpc/percpu.h
@@ -21,15 +21,6 @@
 #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))
 
-/* A macro to avoid #include hell... */
-#define percpu_modcopy(pcpudst, src, size)			\
-do {								\
-	unsigned int __i;					\
-	for_each_possible_cpu(__i)				\
-		memcpy((pcpudst)+__per_cpu_offset(__i),		\
-		       (src), (size));				\
-} while (0)
-
 extern void setup_per_cpu_areas(void);
 
 #else /* ! SMP */
--- a/include/asm-s390/percpu.h
+++ b/include/asm-s390/percpu.h
@@ -39,15 +39,6 @@ extern unsigned long __per_cpu_offset[NR
 #define per_cpu(var,cpu) __reloc_hide(var,__per_cpu_offset[cpu])
 #define per_cpu_offset(x) (__per_cpu_offset[x])
 
-/* A macro to avoid #include hell... */
-#define percpu_modcopy(pcpudst, src, size)			\
-do {								\
-	unsigned int __i;					\
-	for_each_possible_cpu(__i)				\
-		memcpy((pcpudst)+__per_cpu_offset[__i],		\
-		       (src), (size));				\
-} while (0)
-
 #else /* ! SMP */
 
 #define __get_cpu_var(var) __reloc_hide(var,0)

-- 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 2/6] percpu: Change Kconfig to HAVE_SETUP_PER_CPU_AREA linux-2.6.git
  2008-01-30 18:09 [PATCH 0/6] percpu: Per cpu code simplification linux-2.6.git travis
  2008-01-30 18:09 ` [PATCH 1/6] modules: Fold percpu_modcopy into module.c linux-2.6.git travis
@ 2008-01-30 18:09 ` travis
  2008-01-30 21:50   ` Ingo Molnar
  2008-01-30 18:09 ` [PATCH 3/6] sparc64: Use generic percpu linux-2.6.git travis
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: travis @ 2008-01-30 18:09 UTC (permalink / raw)
  To: Geert Uytterhoeven, Linus Torvalds, mingo, Thomas Gleixner
  Cc: Christoph Lameter, linux-kernel, linux-mm, Andi Kleen, Tony Luck,
	David Miller, Sam Ravnborg, Rusty Russell, linuxppc-dev,
	linux-ia64

[-- Attachment #1: change-configs --]
[-- Type: text/plain, Size: 1915 bytes --]

Change:
	config ARCH_SETS_UP_PER_CPU_AREA
to:
	config HAVE_SETUP_PER_CPU_AREA

Based on latest linux-2.6.git

Cc: Andi Kleen <ak@suse.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: David Miller <davem@davemloft.net>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Cc: linuxppc-dev@ozlabs.org
Cc: linux-ia64@vger.kernel.org

Signed-off-by: Mike Travis <travis@sgi.com>
---
linux-2.6.git:
  - added back in missing pieces from x86.git merge

The change to using "select xxx" as suggested by Sam
requires an addition to a non-existant file (arch/Kconfig)
so I went back to using "config xxx" to introduce the flag.

---
 arch/ia64/Kconfig    |    2 +-
 arch/powerpc/Kconfig |    2 +-
 arch/sparc64/Kconfig |    2 +-
 init/main.c          |    2 ++
 4 files changed, 5 insertions(+), 3 deletions(-)

--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -80,7 +80,7 @@ config GENERIC_TIME_VSYSCALL
 	bool
 	default y
 
-config ARCH_SETS_UP_PER_CPU_AREA
+config HAVE_SETUP_PER_CPU_AREA
 	def_bool y
 
 config DMI
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -42,7 +42,7 @@ config GENERIC_HARDIRQS
 	bool
 	default y
 
-config ARCH_SETS_UP_PER_CPU_AREA
+config HAVE_SETUP_PER_CPU_AREA
 	def_bool PPC64
 
 config IRQ_PER_CPU
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -66,7 +66,7 @@ config AUDIT_ARCH
 	bool
 	default y
 
-config ARCH_SETS_UP_PER_CPU_AREA
+config HAVE_SETUP_PER_CPU_AREA
 	def_bool y
 
 config ARCH_NO_VIRT_TO_BUS
--- a/init/main.c
+++ b/init/main.c
@@ -380,6 +380,8 @@ static void __init setup_per_cpu_areas(v
 
 	/* Copy section for each CPU (we discard the original) */
 	size = ALIGN(PERCPU_ENOUGH_ROOM, PAGE_SIZE);
+	printk(KERN_INFO
+	    "PERCPU: Allocating %lu bytes of per cpu data (main)\n", size);
 	ptr = alloc_bootmem_pages(size * nr_possible_cpus);
 
 	for_each_possible_cpu(i) {

-- 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 3/6] sparc64: Use generic percpu linux-2.6.git
  2008-01-30 18:09 [PATCH 0/6] percpu: Per cpu code simplification linux-2.6.git travis
  2008-01-30 18:09 ` [PATCH 1/6] modules: Fold percpu_modcopy into module.c linux-2.6.git travis
  2008-01-30 18:09 ` [PATCH 2/6] percpu: Change Kconfig to HAVE_SETUP_PER_CPU_AREA linux-2.6.git travis
@ 2008-01-30 18:09 ` travis
  2008-01-30 21:52   ` Ingo Molnar
  2008-01-30 18:09 ` [PATCH 4/6] ia64: " travis
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: travis @ 2008-01-30 18:09 UTC (permalink / raw)
  To: Geert Uytterhoeven, Linus Torvalds, mingo, Thomas Gleixner
  Cc: Christoph Lameter, linux-kernel, linux-mm, David Miller

[-- Attachment #1: sparc64_generic_percpu --]
[-- Type: text/plain, Size: 2440 bytes --]

Sparc64 has a way of providing the base address for the per cpu area of the
currently executing processor in a global register.

Sparc64 also provides a way to calculate the address of a per cpu area
from a base address instead of performing an array lookup.

Based on: 2.6.24-rc8-mm1

Cc: David Miller <davem@davemloft.net>

Signed-off-by: Mike Travis <travis@sgi.com>
---
linux-2.6.git:
  - added back in missing pieces from x86.git merge
---
 arch/sparc64/mm/init.c       |    5 +++++
 include/asm-sparc64/percpu.h |   22 +++-------------------
 2 files changed, 8 insertions(+), 19 deletions(-)

--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -1328,6 +1328,11 @@ pgd_t swapper_pg_dir[2048];
 static void sun4u_pgprot_init(void);
 static void sun4v_pgprot_init(void);
 
+/* Dummy function */
+void __init setup_per_cpu_areas(void)
+{
+}
+
 void __init paging_init(void)
 {
 	unsigned long end_pfn, pages_avail, shift, phys_base;
--- a/include/asm-sparc64/percpu.h
+++ b/include/asm-sparc64/percpu.h
@@ -7,7 +7,6 @@ register unsigned long __local_per_cpu_o
 
 #ifdef CONFIG_SMP
 
-#define setup_per_cpu_areas()			do { } while (0)
 extern void real_setup_per_cpu_areas(void);
 
 extern unsigned long __per_cpu_base;
@@ -16,29 +15,14 @@ extern unsigned long __per_cpu_shift;
 	(__per_cpu_base + ((unsigned long)(__cpu) << __per_cpu_shift))
 #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, __local_per_cpu_offset))
-#define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __local_per_cpu_offset))
-
-/* A macro to avoid #include hell... */
-#define percpu_modcopy(pcpudst, src, size)			\
-do {								\
-	unsigned int __i;					\
-	for_each_possible_cpu(__i)				\
-		memcpy((pcpudst)+__per_cpu_offset(__i),		\
-		       (src), (size));				\
-} while (0)
+#define __my_cpu_offset __local_per_cpu_offset
+
 #else /* ! SMP */
 
 #define real_setup_per_cpu_areas()		do { } while (0)
 
-#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
+#include <asm-generic/percpu.h>
 
 #endif /* __ARCH_SPARC64_PERCPU__ */

-- 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 4/6] ia64: Use generic percpu linux-2.6.git
  2008-01-30 18:09 [PATCH 0/6] percpu: Per cpu code simplification linux-2.6.git travis
                   ` (2 preceding siblings ...)
  2008-01-30 18:09 ` [PATCH 3/6] sparc64: Use generic percpu linux-2.6.git travis
@ 2008-01-30 18:09 ` travis
  2008-01-30 18:09 ` [PATCH 5/6] powerpc: Use generic per cpu linux-2.6.git travis
  2008-01-30 18:09 ` [PATCH 6/6] s390: Use generic percpu linux-2.6.git travis
  5 siblings, 0 replies; 16+ messages in thread
From: travis @ 2008-01-30 18:09 UTC (permalink / raw)
  To: Geert Uytterhoeven, Linus Torvalds, mingo, Thomas Gleixner
  Cc: Christoph Lameter, linux-kernel, linux-mm, Tony Luck, linux-ia64

[-- Attachment #1: ia64_generic_percpu --]
[-- Type: text/plain, Size: 2439 bytes --]

ia64 has a special processor specific mapping that can be used to locate the
offset for the current per cpu area.

Based on latest linux-2.6.git

Cc: Tony Luck <tony.luck@intel.com>
Cc: linux-ia64@vger.kernel.org

Signed-off-by: Mike Travis <travis@sgi.com>
---
linux-2.6.git:
  - added back in missing pieces from x86.git merge
---
 include/asm-ia64/percpu.h |   24 +++++++-----------------
 include/linux/percpu.h    |    4 ----
 2 files changed, 7 insertions(+), 21 deletions(-)

--- a/include/asm-ia64/percpu.h
+++ b/include/asm-ia64/percpu.h
@@ -19,29 +19,14 @@
 # define PER_CPU_ATTRIBUTES	__attribute__((__model__ (__small__)))
 #endif
 
-#define DECLARE_PER_CPU(type, name)				\
-	extern PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
-
 #ifdef CONFIG_SMP
 
-extern unsigned long __per_cpu_offset[NR_CPUS];
-#define per_cpu_offset(x) (__per_cpu_offset[x])
-
-/* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */
-DECLARE_PER_CPU(unsigned long, local_per_cpu_offset);
-
-#define per_cpu(var, cpu)  (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
-#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __ia64_per_cpu_var(local_per_cpu_offset)))
-#define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __ia64_per_cpu_var(local_per_cpu_offset)))
+#define __my_cpu_offset	__ia64_per_cpu_var(local_per_cpu_offset)
 
-extern void setup_per_cpu_areas (void);
 extern void *per_cpu_init(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
 #define per_cpu_init()				(__phys_per_cpu_start)
 
 #endif	/* SMP */
@@ -52,7 +37,12 @@ extern void *per_cpu_init(void);
  * On the positive side, using __ia64_per_cpu_var() instead of __get_cpu_var() is slightly
  * more efficient.
  */
-#define __ia64_per_cpu_var(var)	(per_cpu__##var)
+#define __ia64_per_cpu_var(var)	per_cpu__##var
+
+#include <asm-generic/percpu.h>
+
+/* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */
+DECLARE_PER_CPU(unsigned long, local_per_cpu_offset);
 
 #endif /* !__ASSEMBLY__ */
 
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -9,10 +9,6 @@
 
 #include <asm/percpu.h>
 
-#ifndef PER_CPU_ATTRIBUTES
-#define PER_CPU_ATTRIBUTES
-#endif
-
 #ifdef CONFIG_SMP
 #define DEFINE_PER_CPU(type, name)					\
 	__attribute__((__section__(".data.percpu")))			\

-- 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 5/6] powerpc: Use generic per cpu linux-2.6.git
  2008-01-30 18:09 [PATCH 0/6] percpu: Per cpu code simplification linux-2.6.git travis
                   ` (3 preceding siblings ...)
  2008-01-30 18:09 ` [PATCH 4/6] ia64: " travis
@ 2008-01-30 18:09 ` travis
  2008-01-30 18:28   ` Ingo Molnar
  2008-01-30 18:09 ` [PATCH 6/6] s390: Use generic percpu linux-2.6.git travis
  5 siblings, 1 reply; 16+ messages in thread
From: travis @ 2008-01-30 18:09 UTC (permalink / raw)
  To: Geert Uytterhoeven, Linus Torvalds, mingo, Thomas Gleixner
  Cc: Christoph Lameter, linux-kernel, linux-mm, Paul Mackerras

[-- Attachment #1: power_generic_percpu --]
[-- Type: text/plain, Size: 1559 bytes --]

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).

Based on latest linux-2.6.git

Cc: Paul Mackerras <paulus@samba.org>
Cc: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>

Signed-off-by: Mike Travis <travis@sgi.com>
---
linux-2.6.git:
  - added back in missing pieces from x86.git merge
---
 include/asm-powerpc/percpu.h |   20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

--- a/include/asm-powerpc/percpu.h
+++ b/include/asm-powerpc/percpu.h
@@ -16,25 +16,9 @@
 #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))
+#endif /* CONFIG_SMP */
+#endif /* __powerpc64__ */
 
-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_ */

-- 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 6/6] s390: Use generic percpu linux-2.6.git
  2008-01-30 18:09 [PATCH 0/6] percpu: Per cpu code simplification linux-2.6.git travis
                   ` (4 preceding siblings ...)
  2008-01-30 18:09 ` [PATCH 5/6] powerpc: Use generic per cpu linux-2.6.git travis
@ 2008-01-30 18:09 ` travis
  2008-01-30 21:53   ` Ingo Molnar
  5 siblings, 1 reply; 16+ messages in thread
From: travis @ 2008-01-30 18:09 UTC (permalink / raw)
  To: Geert Uytterhoeven, Linus Torvalds, mingo, Thomas Gleixner
  Cc: Christoph Lameter, linux-kernel, linux-mm, Martin Schwidefsky

[-- Attachment #1: s390_generic_percpu --]
[-- Type: text/plain, Size: 2042 bytes --]

Change s390 percpu.h to use asm-generic/percpu.h

Based on latest linux-2.6.git

Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>

Signed-off-by: Mike Travis <travis@sgi.com>
---
linux-2.6.git:
  - added back in missing pieces from x86.git merge
---
 include/asm-s390/percpu.h |   33 +++++++++------------------------
 1 file changed, 9 insertions(+), 24 deletions(-)

--- a/include/asm-s390/percpu.h
+++ b/include/asm-s390/percpu.h
@@ -13,40 +13,25 @@
  */
 #if defined(__s390x__) && defined(MODULE)
 
-#define __reloc_hide(var,offset) (*({			\
+#define SHIFT_PERCPU_PTR(ptr,offset) (({			\
 	extern int simple_identifier_##var(void);	\
 	unsigned long *__ptr;				\
-	asm ( "larl %0,per_cpu__"#var"@GOTENT"		\
-	    : "=a" (__ptr) : "X" (per_cpu__##var) );	\
-	(typeof(&per_cpu__##var))((*__ptr) + (offset));	}))
+	asm ( "larl %0, %1@GOTENT"		\
+	    : "=a" (__ptr) : "X" (ptr) );		\
+	(typeof(ptr))((*__ptr) + (offset));	}))
 
 #else
 
-#define __reloc_hide(var, offset) (*({				\
+#define SHIFT_PERCPU_PTR(ptr, offset) (({				\
 	extern int simple_identifier_##var(void);		\
 	unsigned long __ptr;					\
-	asm ( "" : "=a" (__ptr) : "0" (&per_cpu__##var) );	\
-	(typeof(&per_cpu__##var)) (__ptr + (offset)); }))
+	asm ( "" : "=a" (__ptr) : "0" (ptr) );			\
+	(typeof(ptr)) (__ptr + (offset)); }))
 
 #endif
 
-#ifdef CONFIG_SMP
+#define __my_cpu_offset S390_lowcore.percpu_offset
 
-extern unsigned long __per_cpu_offset[NR_CPUS];
-
-#define __get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset)
-#define __raw_get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset)
-#define per_cpu(var,cpu) __reloc_hide(var,__per_cpu_offset[cpu])
-#define per_cpu_offset(x) (__per_cpu_offset[x])
-
-#else /* ! SMP */
-
-#define __get_cpu_var(var) __reloc_hide(var,0)
-#define __raw_get_cpu_var(var) __reloc_hide(var,0)
-#define per_cpu(var,cpu) __reloc_hide(var,0)
-
-#endif /* SMP */
-
-#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
+#include <asm-generic/percpu.h>
 
 #endif /* __ARCH_S390_PERCPU__ */

-- 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 5/6] powerpc: Use generic per cpu linux-2.6.git
  2008-01-30 18:09 ` [PATCH 5/6] powerpc: Use generic per cpu linux-2.6.git travis
@ 2008-01-30 18:28   ` Ingo Molnar
  2008-01-30 18:38     ` Mike Travis
  0 siblings, 1 reply; 16+ messages in thread
From: Ingo Molnar @ 2008-01-30 18:28 UTC (permalink / raw)
  To: travis
  Cc: Geert Uytterhoeven, Linus Torvalds, Thomas Gleixner,
	Christoph Lameter, linux-kernel, linux-mm, Paul Mackerras


* travis@sgi.com <travis@sgi.com> 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).

i needed the fix below to get my powerpc crosscompile build to succeed.

	Ingo

-------------->
Subject: powerpc: percpu build fix
From: Ingo Molnar <mingo@elte.hu>

Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/asm-powerpc/percpu.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-x86.q/include/asm-powerpc/percpu.h
===================================================================
--- linux-x86.q.orig/include/asm-powerpc/percpu.h
+++ linux-x86.q/include/asm-powerpc/percpu.h
@@ -13,7 +13,7 @@
 #include <asm/paca.h>
 
 #define __per_cpu_offset(cpu) (paca[cpu].data_offset)
-#define __my_cpu_offset() get_paca()->data_offset
+#define __my_cpu_offset get_paca()->data_offset
 #define per_cpu_offset(x) (__per_cpu_offset(x))
 
 #endif /* CONFIG_SMP */

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 5/6] powerpc: Use generic per cpu linux-2.6.git
  2008-01-30 18:28   ` Ingo Molnar
@ 2008-01-30 18:38     ` Mike Travis
  0 siblings, 0 replies; 16+ messages in thread
From: Mike Travis @ 2008-01-30 18:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Geert Uytterhoeven, Linus Torvalds, Thomas Gleixner,
	Christoph Lameter, linux-kernel, linux-mm, Paul Mackerras

Ingo Molnar wrote:
> * travis@sgi.com <travis@sgi.com> 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).
> 
> i needed the fix below to get my powerpc crosscompile build to succeed.
> 
> 	Ingo

Thanks!  I double-checked the logs and my ppc build worked.  But yes, this was
in the original patch.  And wierdly, powerpc was the only arch that had it
dropped.

-Mike
> 
> -------------->
> Subject: powerpc: percpu build fix
> From: Ingo Molnar <mingo@elte.hu>
> 
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> ---
>  include/asm-powerpc/percpu.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Index: linux-x86.q/include/asm-powerpc/percpu.h
> ===================================================================
> --- linux-x86.q.orig/include/asm-powerpc/percpu.h
> +++ linux-x86.q/include/asm-powerpc/percpu.h
> @@ -13,7 +13,7 @@
>  #include <asm/paca.h>
>  
>  #define __per_cpu_offset(cpu) (paca[cpu].data_offset)
> -#define __my_cpu_offset() get_paca()->data_offset
> +#define __my_cpu_offset get_paca()->data_offset
>  #define per_cpu_offset(x) (__per_cpu_offset(x))
>  
>  #endif /* CONFIG_SMP */


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/6] percpu: Change Kconfig to HAVE_SETUP_PER_CPU_AREA linux-2.6.git
  2008-01-30 18:09 ` [PATCH 2/6] percpu: Change Kconfig to HAVE_SETUP_PER_CPU_AREA linux-2.6.git travis
@ 2008-01-30 21:50   ` Ingo Molnar
  2008-01-30 21:57     ` Mike Travis
  0 siblings, 1 reply; 16+ messages in thread
From: Ingo Molnar @ 2008-01-30 21:50 UTC (permalink / raw)
  To: travis
  Cc: Geert Uytterhoeven, Linus Torvalds, Thomas Gleixner,
	Christoph Lameter, linux-kernel, linux-mm, Andi Kleen, Tony Luck,
	David Miller, Sam Ravnborg, Rusty Russell, linuxppc-dev,
	linux-ia64


* travis@sgi.com <travis@sgi.com> wrote:

> Change:
> 	config ARCH_SETS_UP_PER_CPU_AREA
> to:
> 	config HAVE_SETUP_PER_CPU_AREA

undocumented change:

>  config ARCH_NO_VIRT_TO_BUS
> --- a/init/main.c
> +++ b/init/main.c
> @@ -380,6 +380,8 @@ static void __init setup_per_cpu_areas(v
>  
>  	/* Copy section for each CPU (we discard the original) */
>  	size = ALIGN(PERCPU_ENOUGH_ROOM, PAGE_SIZE);
> +	printk(KERN_INFO
> +	    "PERCPU: Allocating %lu bytes of per cpu data (main)\n", size);
>  	ptr = alloc_bootmem_pages(size * nr_possible_cpus);

but looks fine to me.

	Ingo

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/6] sparc64: Use generic percpu linux-2.6.git
  2008-01-30 18:09 ` [PATCH 3/6] sparc64: Use generic percpu linux-2.6.git travis
@ 2008-01-30 21:52   ` Ingo Molnar
  2008-01-31  1:03     ` David Miller
  0 siblings, 1 reply; 16+ messages in thread
From: Ingo Molnar @ 2008-01-30 21:52 UTC (permalink / raw)
  To: travis
  Cc: Geert Uytterhoeven, Linus Torvalds, Thomas Gleixner,
	Christoph Lameter, linux-kernel, linux-mm, David Miller


* travis@sgi.com <travis@sgi.com> wrote:

> Sparc64 has a way of providing the base address for the per cpu area 
> of the currently executing processor in a global register.
> 
> Sparc64 also provides a way to calculate the address of a per cpu area 
> from a base address instead of performing an array lookup.

has this been booted on SPARC64 and does David ACK this conversion?

	Ingo

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 6/6] s390: Use generic percpu linux-2.6.git
  2008-01-30 18:09 ` [PATCH 6/6] s390: Use generic percpu linux-2.6.git travis
@ 2008-01-30 21:53   ` Ingo Molnar
  2008-01-31  8:32     ` Martin Schwidefsky
  0 siblings, 1 reply; 16+ messages in thread
From: Ingo Molnar @ 2008-01-30 21:53 UTC (permalink / raw)
  To: travis
  Cc: Geert Uytterhoeven, Linus Torvalds, Thomas Gleixner,
	Christoph Lameter, linux-kernel, linux-mm, Martin Schwidefsky


* travis@sgi.com <travis@sgi.com> wrote:

> Change s390 percpu.h to use asm-generic/percpu.h

do the s390 maintainer agree with this change (Acks please), and has it 
been tested on s390?

	Ingo

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/6] percpu: Change Kconfig to HAVE_SETUP_PER_CPU_AREA linux-2.6.git
  2008-01-30 21:50   ` Ingo Molnar
@ 2008-01-30 21:57     ` Mike Travis
  0 siblings, 0 replies; 16+ messages in thread
From: Mike Travis @ 2008-01-30 21:57 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Geert Uytterhoeven, Linus Torvalds, Thomas Gleixner,
	Christoph Lameter, linux-kernel, linux-mm, Andi Kleen, Tony Luck,
	David Miller, Sam Ravnborg, Rusty Russell, linuxppc-dev,
	linux-ia64

Ingo Molnar wrote:
> * travis@sgi.com <travis@sgi.com> wrote:
> 
>> Change:
>> 	config ARCH_SETS_UP_PER_CPU_AREA
>> to:
>> 	config HAVE_SETUP_PER_CPU_AREA
> 
> undocumented change:
> 
>>  config ARCH_NO_VIRT_TO_BUS
>> --- a/init/main.c
>> +++ b/init/main.c
>> @@ -380,6 +380,8 @@ static void __init setup_per_cpu_areas(v
>>  
>>  	/* Copy section for each CPU (we discard the original) */
>>  	size = ALIGN(PERCPU_ENOUGH_ROOM, PAGE_SIZE);
>> +	printk(KERN_INFO
>> +	    "PERCPU: Allocating %lu bytes of per cpu data (main)\n", size);
>>  	ptr = alloc_bootmem_pages(size * nr_possible_cpus);
> 
> but looks fine to me.
> 
> 	Ingo

Sorry, I should have noted this.  The primary reason I put this in, is
that if the HAVE_SETUP_PER_CPU_AREA is not set when it should be, then
the incorrect (generic) setup_per_cpu_areas() is used and weird things
happen later on.  The above line documents that PERCPU has been allocated
by init/main.c version of this function in the startup messages.
(Since it's a static function, there is no "duplicate label" error in
the linker.)

Thanks,
Mike

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/6] sparc64: Use generic percpu linux-2.6.git
  2008-01-30 21:52   ` Ingo Molnar
@ 2008-01-31  1:03     ` David Miller
  0 siblings, 0 replies; 16+ messages in thread
From: David Miller @ 2008-01-31  1:03 UTC (permalink / raw)
  To: mingo
  Cc: travis, Geert.Uytterhoeven, torvalds, tglx, clameter,
	linux-kernel, linux-mm

From: Ingo Molnar <mingo@elte.hu>
Date: Wed, 30 Jan 2008 22:52:23 +0100

> 
> * travis@sgi.com <travis@sgi.com> wrote:
> 
> > Sparc64 has a way of providing the base address for the per cpu area 
> > of the currently executing processor in a global register.
> > 
> > Sparc64 also provides a way to calculate the address of a per cpu area 
> > from a base address instead of performing an array lookup.
> 
> has this been booted on SPARC64 and does David ACK this conversion?

Conceptually I'm fine with the changes.

I had these for testing in my backlog right before I came to
LCA08 and I won't be able to do any real testing until I get back
home on Feb 4th.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 6/6] s390: Use generic percpu linux-2.6.git
  2008-01-30 21:53   ` Ingo Molnar
@ 2008-01-31  8:32     ` Martin Schwidefsky
  2008-01-31  8:50       ` Ingo Molnar
  0 siblings, 1 reply; 16+ messages in thread
From: Martin Schwidefsky @ 2008-01-31  8:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: travis, Geert Uytterhoeven, Linus Torvalds, Thomas Gleixner,
	Christoph Lameter, linux-kernel, linux-mm

On Wed, 2008-01-30 at 22:53 +0100, Ingo Molnar wrote:
> * travis@sgi.com <travis@sgi.com> wrote:
> 
> > Change s390 percpu.h to use asm-generic/percpu.h
> 
> do the s390 maintainer agree with this change (Acks please), and has it 
> been tested on s390?

Now I'm confused. The patch has been acked a few weeks ago and the last
5+ version of the patch had the acked line. The lastest version dropped
it for a reason I don't know. And more, the patch is already upstream
with the (correct) acked line, see git commit
f034347470e486835ccdcd7a5bb2ceb417be11c4.
So, what is the problem ?

-- 
blue skies,
  Martin.

"Reality continues to ruin my life." - Calvin.



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 6/6] s390: Use generic percpu linux-2.6.git
  2008-01-31  8:32     ` Martin Schwidefsky
@ 2008-01-31  8:50       ` Ingo Molnar
  0 siblings, 0 replies; 16+ messages in thread
From: Ingo Molnar @ 2008-01-31  8:50 UTC (permalink / raw)
  To: Martin Schwidefsky
  Cc: travis, Geert Uytterhoeven, Linus Torvalds, Thomas Gleixner,
	Christoph Lameter, linux-kernel, linux-mm


* Martin Schwidefsky <schwidefsky@de.ibm.com> wrote:

> On Wed, 2008-01-30 at 22:53 +0100, Ingo Molnar wrote:
> > * travis@sgi.com <travis@sgi.com> wrote:
> > 
> > > Change s390 percpu.h to use asm-generic/percpu.h
> > 
> > do the s390 maintainer agree with this change (Acks please), and has it 
> > been tested on s390?
> 
> Now I'm confused. The patch has been acked a few weeks ago and the 
> last 5+ version of the patch had the acked line. The lastest version 
> dropped it for a reason I don't know. And more, the patch is already 
> upstream with the (correct) acked line, see git commit 
> f034347470e486835ccdcd7a5bb2ceb417be11c4. So, what is the problem ?

the latest patch was sent without your acked line and i asked about 
that. But later on Mike told me that you acked it - so i restored the 
ack and the patch, Linus pulled the fixes and it now all is upstream and 
all architectures should be fine again now.

	Ingo

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2008-01-31  8:50 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-30 18:09 [PATCH 0/6] percpu: Per cpu code simplification linux-2.6.git travis
2008-01-30 18:09 ` [PATCH 1/6] modules: Fold percpu_modcopy into module.c linux-2.6.git travis
2008-01-30 18:09 ` [PATCH 2/6] percpu: Change Kconfig to HAVE_SETUP_PER_CPU_AREA linux-2.6.git travis
2008-01-30 21:50   ` Ingo Molnar
2008-01-30 21:57     ` Mike Travis
2008-01-30 18:09 ` [PATCH 3/6] sparc64: Use generic percpu linux-2.6.git travis
2008-01-30 21:52   ` Ingo Molnar
2008-01-31  1:03     ` David Miller
2008-01-30 18:09 ` [PATCH 4/6] ia64: " travis
2008-01-30 18:09 ` [PATCH 5/6] powerpc: Use generic per cpu linux-2.6.git travis
2008-01-30 18:28   ` Ingo Molnar
2008-01-30 18:38     ` Mike Travis
2008-01-30 18:09 ` [PATCH 6/6] s390: Use generic percpu linux-2.6.git travis
2008-01-30 21:53   ` Ingo Molnar
2008-01-31  8:32     ` Martin Schwidefsky
2008-01-31  8:50       ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).