Skip to contentSkip to conversation

percpu: Per cpu code simplification linux-2.6.git

PATCH In review [email protected] 4 participants 16 messages Jan 30, 2008 – Jan 31, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover percpu: Per cpu code simplification linux-2.6.git

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 <[email protected]>
Cc Tony Luck <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc David Miller <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Rusty Russell <[email protected]>
Cc Martin Schwidefsky <[email protected]>
Cc Geert Uytterhoeven <[email protected]>

---

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>
Signature · 5 lines
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw

PATCH 1/6 modules: Fold percpu_modcopy into module.c linux-2.6.git

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 <[email protected]>
Cc Tony Luck <[email protected]>
Cc David Miller <[email protected]>
Cc Rusty Russell <[email protected]>
Cc Geert Uytterhoeven <[email protected]>

---
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(-)
arch/ia64/kernel/module.c +0 -11
@@ -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 */
include/asm-ia64/percpu.h +0 -5
@@ -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);
 
include/asm-powerpc/percpu.h +0 -9
@@ -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 */
include/asm-s390/percpu.h +0 -9
@@ -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)
#2 lore raw

PATCH 2/6 percpu: Change Kconfig to HAVE_SETUP_PER_CPU_AREA linux-2.6.git

In reply to [email protected]

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 <[email protected]>
Cc Tony Luck <[email protected]>
Cc David Miller <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Rusty Russell <[email protected]>
Cc Geert Uytterhoeven <[email protected]>

---
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(-)
arch/ia64/Kconfig +1 -1
@@ -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
arch/powerpc/Kconfig +1 -1
@@ -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
arch/sparc64/Kconfig +1 -1
@@ -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
init/main.c +2 -0
@@ -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) {
#3 lore raw

Re: [PATCH 2/6] percpu: Change Kconfig to HAVE_SETUP_PER_CPU_AREA linux-2.6.git

Quoted 4 lines · * [email protected] <[email protected]> wrote:

Change:
config ARCH_SETS_UP_PER_CPU_AREA
to:
config HAVE_SETUP_PER_CPU_AREA

undocumented change:

init/main.c static void __init setup_per_cpu_areas(v · line 385

Quoted 10 lines

config ARCH_NO_VIRT_TO_BUS

init/main.c +2 -0
@@ -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

#4 lore raw

Re: [PATCH 2/6] percpu: Change Kconfig to HAVE_SETUP_PER_CPU_AREA linux-2.6.git

Quoted 22 lines · Ingo Molnar
Quoted 4 lines · * [email protected] <[email protected]> wrote:

Change:
config ARCH_SETS_UP_PER_CPU_AREA
to:
config HAVE_SETUP_PER_CPU_AREA

undocumented change:

init/main.c static void __init setup_per_cpu_areas(v · line 385

Quoted 10 lines

config ARCH_NO_VIRT_TO_BUS

init/main.c +2 -0
@@ -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.

Quoted 1 line

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

#5 lore raw

PATCH 3/6 sparc64: Use generic percpu linux-2.6.git

In reply to [email protected]

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 <[email protected]>

---
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(-)
arch/sparc64/mm/init.c +5 -0
@@ -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;
include/asm-sparc64/percpu.h +3 -19
@@ -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__ */
Signature · 5 lines
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#6 lore raw

Re: [PATCH 3/6] sparc64: Use generic percpu linux-2.6.git

Quoted 5 lines · * [email protected] <[email protected]> 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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#7 lore raw

Re: [PATCH 3/6] sparc64: Use generic percpu linux-2.6.git

From: Ingo Molnar <[email protected]>
Date: Wed, 30 Jan 2008 22:52:23 +0100

Quoted 10 lines · * [email protected] <[email protected]> wrote:
Quoted 6 lines

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.

#8 lore raw

PATCH 4/6 ia64: Use generic percpu linux-2.6.git

In reply to [email protected]

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

---
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(-)
include/asm-ia64/percpu.h +7 -17
@@ -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__ */
 
include/linux/percpu.h +0 -4
@@ -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")))			\
#9 lore raw

PATCH 5/6 powerpc: Use generic per cpu linux-2.6.git

In reply to [email protected]

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 <[email protected]>
Cc Geert Uytterhoeven <[email protected]>

---
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(-)
include/asm-powerpc/percpu.h +2 -18
@@ -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_ */
Signature · 5 lines
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#10 lore raw

Re: [PATCH 5/6] powerpc: Use generic per cpu linux-2.6.git

Quoted 4 lines · * [email protected] <[email protected]> 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 <[email protected]>

---
 include/asm-powerpc/percpu.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/asm-powerpc/percpu.h +1 -1
Index: 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 */

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#11 lore raw

Re: [PATCH 5/6] powerpc: Use generic per cpu linux-2.6.git

Quoted 10 lines · Ingo Molnar
Quoted 4 lines · * [email protected] <[email protected]> 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

Quoted 15 lines

-------------->
Subject: powerpc: percpu build fix
From: Ingo Molnar <[email protected]>

---
 include/asm-powerpc/percpu.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-x86.q/include/asm-powerpc/percpu.h
===================================================================

include/asm-powerpc/percpu.h line 19

Quoted 8 lines
include/asm-powerpc/percpu.h +1 -1
@@ -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 */

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#12 lore raw

PATCH 6/6 s390: Use generic percpu linux-2.6.git

In reply to [email protected]

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

Based on latest linux-2.6.git

Cc Martin Schwidefsky <[email protected]>

---
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(-)
include/asm-s390/percpu.h +9 -24
@@ -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__ */
Signature · 5 lines
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#13 lore raw

Re: [PATCH 6/6] s390: Use generic percpu linux-2.6.git

Quoted 1 line · * [email protected] <[email protected]> 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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#14 lore raw

Re: [PATCH 6/6] s390: Use generic percpu linux-2.6.git

Quoted 6 lines · Ingo Molnar
Quoted 1 line · * [email protected] <[email protected]> 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 ?

Signature · 11 lines
blue skies,
  Martin.

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


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#15 lore raw

Re: [PATCH 6/6] s390: Use generic percpu linux-2.6.git

Quoted 5 lines · Martin Schwidefsky
Quoted 4 lines · Ingo Molnar
Quoted 1 line · * [email protected] <[email protected]> wrote:

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

Quoted 8 lines
Quoted 2 lines

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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>