LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/6] percpu: Per cpu code simplification fixup
@ 2008-01-17 22:35 travis
2008-01-17 22:35 ` [PATCH 1/6] Modules: Fold percpu_modcopy into module.c travis
` (6 more replies)
0 siblings, 7 replies; 11+ messages in thread
From: travis @ 2008-01-17 22:35 UTC (permalink / raw)
To: Andrew Morton, Andi Kleen, mingo
Cc: Christoph Lameter, linux-mm, linux-kernel
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.
The patch also unifies the x86 arch so that there is only a single
asm-x86/percpu.h
Based on: 2.6.24-rc8-mm1
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Mike Travis <travis@sgi.com>
---
fixup:
- rebased from 2.6.24-rc6-mm1 to 2.6.24-rc8-mm1
(removed changes that are in the git-x86.patch)
- added back in missing fold-percpu_modcopy pieces
V3->V4:
- rebased patchset on 2.6.24-rc6-mm1
(removes the percpu_modcopy changes that are already in.)
- change config ARCH_SETS_UP_PER_CPU_AREA to a global var
and use select HAVE_SETUP_PER_CPU_AREA to specify.
V2->V3:
- fix x86_64 non-SMP case
- change SHIFT_PTR to SHIFT_PERCPU_PTR
- fix various percpu_modcopy()'s to reference correct per_cpu_offset()
- s390 has a special way to determine the pointer to a per cpu area
V1->V2:
- Add support for specifying attributes for per cpu declarations (preserves
IA64 model(small) attribute).
- Drop first patch that removes the model(small) attribute for IA64
- Missing #endif in powerpc generic config / Wrong Kconfig
- Follow Randy's suggestions on how to do the Kconfig settings
--
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/6] Modules: Fold percpu_modcopy into module.c
2008-01-17 22:35 [PATCH 0/6] percpu: Per cpu code simplification fixup travis
@ 2008-01-17 22:35 ` travis
2008-01-17 22:35 ` [PATCH 2/6] percpu: Change Kconfig ARCH_SETS_UP_PER_CPU_AREA to HAVE_SETUP_PER_CPU_AREA travis
` (5 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: travis @ 2008-01-17 22:35 UTC (permalink / raw)
To: Andrew Morton, Andi Kleen, mingo
Cc: Christoph Lameter, linux-mm, linux-kernel, Rusty Russell
[-- Attachment #1: fold-percpu_modcopy --]
[-- Type: text/plain, Size: 4034 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.
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Mike Travis <travis@sgi.com>
---
arch/ia64/kernel/module.c | 11 -----------
include/asm-generic/percpu.h | 8 --------
include/asm-ia64/percpu.h | 5 -----
include/asm-powerpc/percpu.h | 9 ---------
include/asm-s390/percpu.h | 9 ---------
kernel/module.c | 8 ++++++++
6 files changed, 8 insertions(+), 42 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-generic/percpu.h
+++ b/include/asm-generic/percpu.h
@@ -63,14 +63,6 @@ extern unsigned long __per_cpu_offset[NR
extern void setup_per_cpu_areas(void);
#endif
-/* 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 per_cpu(var, cpu) (*((void)(cpu), &per_cpu_var(var)))
--- 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)
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -422,6 +422,14 @@ static unsigned int find_pcpusec(Elf_Ehd
return find_sec(hdr, sechdrs, secstrings, ".data.percpu");
}
+static void percpu_modcopy(void *pcpudest, const void *from, unsigned long size)
+{
+ int cpu;
+
+ for_each_possible_cpu(cpu)
+ memcpy(pcpudest + per_cpu_offset(cpu), from, size);
+}
+
static int percpu_modinit(void)
{
pcpu_num_used = 2;
--
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/6] percpu: Change Kconfig ARCH_SETS_UP_PER_CPU_AREA to HAVE_SETUP_PER_CPU_AREA
2008-01-17 22:35 [PATCH 0/6] percpu: Per cpu code simplification fixup travis
2008-01-17 22:35 ` [PATCH 1/6] Modules: Fold percpu_modcopy into module.c travis
@ 2008-01-17 22:35 ` travis
2008-01-18 5:11 ` Sam Ravnborg
2008-01-17 22:35 ` [PATCH 3/6] Sparc64: Use generic percpu travis
` (4 subsequent siblings)
6 siblings, 1 reply; 11+ messages in thread
From: travis @ 2008-01-17 22:35 UTC (permalink / raw)
To: Andrew Morton, Andi Kleen, mingo
Cc: Christoph Lameter, linux-mm, linux-kernel, Rusty Russell, Sam Ravnborg
[-- Attachment #1: config-to-select --]
[-- Type: text/plain, Size: 3015 bytes --]
Change "config ARCH_SETS_UP_PER_CPU_AREA" to "select
HAVE_SETUP_PER_CPU_AREA" as suggested by Sam.
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andi Kleen <ak@suse.de>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Mike Travis <travis@sgi.com>
---
arch/ia64/Kconfig | 4 +---
arch/powerpc/Kconfig | 4 +---
arch/sparc64/Kconfig | 4 +---
arch/x86/Kconfig | 4 +---
include/asm-generic/percpu.h | 2 +-
init/main.c | 4 ++--
6 files changed, 7 insertions(+), 15 deletions(-)
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -17,6 +17,7 @@ config IA64
select ARCH_SUPPORTS_MSI
select HAVE_OPROFILE
select HAVE_KPROBES
+ select HAVE_SETUP_PER_CPU_AREA
default y
help
The Itanium Processor Family is Intel's 64-bit successor to
@@ -82,9 +83,6 @@ config GENERIC_TIME_VSYSCALL
bool
default y
-config ARCH_SETS_UP_PER_CPU_AREA
- def_bool y
-
config DMI
bool
default y
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -42,9 +42,6 @@ config GENERIC_HARDIRQS
bool
default y
-config ARCH_SETS_UP_PER_CPU_AREA
- def_bool PPC64
-
config IRQ_PER_CPU
bool
default y
@@ -89,6 +86,7 @@ config PPC
default y
select HAVE_OPROFILE
select HAVE_KPROBES
+ select HAVE_SETUP_PER_CPU_AREA if PPC64
config EARLY_PRINTK
bool
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -10,6 +10,7 @@ config SPARC
default y
select HAVE_OPROFILE
select HAVE_KPROBES
+ select HAVE_SETUP_PER_CPU_AREA
config SPARC64
bool
@@ -68,9 +69,6 @@ config AUDIT_ARCH
bool
default y
-config ARCH_SETS_UP_PER_CPU_AREA
- def_bool y
-
config ARCH_NO_VIRT_TO_BUS
def_bool y
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -20,6 +20,7 @@ config X86
def_bool y
select HAVE_OPROFILE
select HAVE_KPROBES
+ select HAVE_SETUP_PER_CPU_AREA if ARCH = "x86_64"
config GENERIC_LOCKBREAK
def_bool n
@@ -106,9 +107,6 @@ config GENERIC_TIME_VSYSCALL
bool
default X86_64
-config ARCH_SETS_UP_PER_CPU_AREA
- def_bool X86_64
-
config ARCH_SUPPORTS_OPROFILE
bool
default y
--- a/include/asm-generic/percpu.h
+++ b/include/asm-generic/percpu.h
@@ -59,7 +59,7 @@ extern unsigned long __per_cpu_offset[NR
(*SHIFT_PERCPU_PTR(&per_cpu_var(var), __my_cpu_offset))
-#ifdef CONFIG_ARCH_SETS_UP_PER_CPU_AREA
+#ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA
extern void setup_per_cpu_areas(void);
#endif
--- a/init/main.c
+++ b/init/main.c
@@ -363,7 +363,7 @@ static inline void smp_prepare_cpus(unsi
#else
-#ifndef CONFIG_ARCH_SETS_UP_PER_CPU_AREA
+#ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA
unsigned long __per_cpu_offset[NR_CPUS] __read_mostly;
EXPORT_SYMBOL(__per_cpu_offset);
@@ -384,7 +384,7 @@ static void __init setup_per_cpu_areas(v
ptr += size;
}
}
-#endif /* CONFIG_ARCH_SETS_UP_CPU_AREA */
+#endif /* CONFIG_HAVE_SETUP_PER_CPU_AREA */
/* Called by boot processor to activate the rest. */
static void __init smp_init(void)
--
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 3/6] Sparc64: Use generic percpu
2008-01-17 22:35 [PATCH 0/6] percpu: Per cpu code simplification fixup travis
2008-01-17 22:35 ` [PATCH 1/6] Modules: Fold percpu_modcopy into module.c travis
2008-01-17 22:35 ` [PATCH 2/6] percpu: Change Kconfig ARCH_SETS_UP_PER_CPU_AREA to HAVE_SETUP_PER_CPU_AREA travis
@ 2008-01-17 22:35 ` travis
2008-01-17 22:35 ` [PATCH 4/6] ia64: " travis
` (3 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: travis @ 2008-01-17 22:35 UTC (permalink / raw)
To: Andrew Morton, Andi Kleen, mingo
Cc: Christoph Lameter, linux-mm, linux-kernel, David Miller
[-- Attachment #1: sparc64_generic_percpu --]
[-- Type: text/plain, Size: 2394 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.
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Mike Travis <travis@sgi.com>
---
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] 11+ messages in thread
* [PATCH 4/6] ia64: Use generic percpu
2008-01-17 22:35 [PATCH 0/6] percpu: Per cpu code simplification fixup travis
` (2 preceding siblings ...)
2008-01-17 22:35 ` [PATCH 3/6] Sparc64: Use generic percpu travis
@ 2008-01-17 22:35 ` travis
2008-01-17 22:35 ` [PATCH 5/6] Powerpc: Use generic per cpu travis
` (2 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: travis @ 2008-01-17 22:35 UTC (permalink / raw)
To: Andrew Morton, Andi Kleen, mingo
Cc: Christoph Lameter, linux-mm, linux-kernel, linux-ia64, tony.luck
[-- Attachment #1: ia64_generic_percpu --]
[-- Type: text/plain, Size: 2515 bytes --]
ia64 has a special processor specific mapping that can be used to locate the
offset for the current per cpu area.
Cc: linux-ia64@vger.kernel.org
Cc: tony.luck@intel.com
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Mike Travis <travis@sgi.com>
---
V1->V2:
- Merge fixes
- Remove transitional check for PER_CPU_ATTRIBUTES from linux/percpu.h
V2-.V3:
- use generic percpy_modcopy()
---
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] 11+ messages in thread
* [PATCH 5/6] Powerpc: Use generic per cpu
2008-01-17 22:35 [PATCH 0/6] percpu: Per cpu code simplification fixup travis
` (3 preceding siblings ...)
2008-01-17 22:35 ` [PATCH 4/6] ia64: " travis
@ 2008-01-17 22:35 ` travis
2008-01-17 22:35 ` [PATCH 6/6] s390: Use generic percpu travis
2008-01-17 22:41 ` [PATCH 0/6] percpu: Per cpu code simplification fixup Mike Travis
6 siblings, 0 replies; 11+ messages in thread
From: travis @ 2008-01-17 22:35 UTC (permalink / raw)
To: Andrew Morton, Andi Kleen, mingo
Cc: Christoph Lameter, linux-mm, linux-kernel, Paul Mackerras
[-- Attachment #1: power_generic_percpu --]
[-- Type: text/plain, Size: 1527 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).
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Mike Travis <travis@sgi.com>
---
V1->V2:
- add missing #endif
V2->V3:
- use generic percpy_modcopy()
---
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] 11+ messages in thread
* [PATCH 6/6] s390: Use generic percpu
2008-01-17 22:35 [PATCH 0/6] percpu: Per cpu code simplification fixup travis
` (4 preceding siblings ...)
2008-01-17 22:35 ` [PATCH 5/6] Powerpc: Use generic per cpu travis
@ 2008-01-17 22:35 ` travis
2008-01-17 22:41 ` [PATCH 0/6] percpu: Per cpu code simplification fixup Mike Travis
6 siblings, 0 replies; 11+ messages in thread
From: travis @ 2008-01-17 22:35 UTC (permalink / raw)
To: Andrew Morton, Andi Kleen, mingo
Cc: Christoph Lameter, linux-mm, linux-kernel, schwidefsky
[-- Attachment #1: s390_generic_percpu --]
[-- Type: text/plain, Size: 2594 bytes --]
Change s390 percpu.h to use asm-generic/percpu.h
Cc: schwidefsky@de.ibm.com
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Mike Travis <travis@sgi.com>
---
V2->V3:
On Thu, 29 Nov 2007, Martin Schwidefsky wrote:
> On Wed, 2007-11-28 at 13:09 -0800, Christoph Lameter wrote:
> > s390 has a special way to determine the pointer to a per cpu area
> > plus there is a way to access the base of the per cpu area of the
> > currently executing processor.
> >
> > Note: I had to do a minor change to ASM code. Please check that
> > this was done right.
>
> Hi Christoph,
>
> after fixing the trainwreck with Gregs kset changes I've got rc3-mm2
> compiled with your percpu patches. The new s390 percpu code works fine:
>
> Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---
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] 11+ messages in thread
* Re: [PATCH 0/6] percpu: Per cpu code simplification fixup
2008-01-17 22:35 [PATCH 0/6] percpu: Per cpu code simplification fixup travis
` (5 preceding siblings ...)
2008-01-17 22:35 ` [PATCH 6/6] s390: Use generic percpu travis
@ 2008-01-17 22:41 ` Mike Travis
6 siblings, 0 replies; 11+ messages in thread
From: Mike Travis @ 2008-01-17 22:41 UTC (permalink / raw)
To: Andrew Morton, Andi Kleen, mingo
Cc: Christoph Lameter, linux-mm, linux-kernel
Hi Andrew,
My automatic scripts accidentally sent this mail prematurely. Please hold
off applying yet.
Thanks,
Mike
travis@sgi.com wrote:
> 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.
>
> The patch also unifies the x86 arch so that there is only a single
> asm-x86/percpu.h
>
> Based on: 2.6.24-rc8-mm1
>
> Signed-off-by: Christoph Lameter <clameter@sgi.com>
> Signed-off-by: Mike Travis <travis@sgi.com>
> ---
>
> fixup:
>
> - rebased from 2.6.24-rc6-mm1 to 2.6.24-rc8-mm1
> (removed changes that are in the git-x86.patch)
> - added back in missing fold-percpu_modcopy pieces
>
> V3->V4:
> - rebased patchset on 2.6.24-rc6-mm1
> (removes the percpu_modcopy changes that are already in.)
> - change config ARCH_SETS_UP_PER_CPU_AREA to a global var
> and use select HAVE_SETUP_PER_CPU_AREA to specify.
>
> V2->V3:
> - fix x86_64 non-SMP case
> - change SHIFT_PTR to SHIFT_PERCPU_PTR
> - fix various percpu_modcopy()'s to reference correct per_cpu_offset()
> - s390 has a special way to determine the pointer to a per cpu area
>
> V1->V2:
> - Add support for specifying attributes for per cpu declarations (preserves
> IA64 model(small) attribute).
> - Drop first patch that removes the model(small) attribute for IA64
> - Missing #endif in powerpc generic config / Wrong Kconfig
> - Follow Randy's suggestions on how to do the Kconfig settings
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/6] percpu: Change Kconfig ARCH_SETS_UP_PER_CPU_AREA to HAVE_SETUP_PER_CPU_AREA
2008-01-17 22:35 ` [PATCH 2/6] percpu: Change Kconfig ARCH_SETS_UP_PER_CPU_AREA to HAVE_SETUP_PER_CPU_AREA travis
@ 2008-01-18 5:11 ` Sam Ravnborg
2008-01-18 12:46 ` Mike Travis
2008-01-18 15:46 ` Mike Travis
0 siblings, 2 replies; 11+ messages in thread
From: Sam Ravnborg @ 2008-01-18 5:11 UTC (permalink / raw)
To: travis
Cc: Andrew Morton, Andi Kleen, mingo, Christoph Lameter, linux-mm,
linux-kernel, Rusty Russell
Hi Mike.
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -20,6 +20,7 @@ config X86
> def_bool y
> select HAVE_OPROFILE
> select HAVE_KPROBES
> + select HAVE_SETUP_PER_CPU_AREA if ARCH = "x86_64"
It is simpler to just say:
> + select HAVE_SETUP_PER_CPU_AREA if X86_64
And this is the way we do it in the rest of the
x86 Kconfig files.
Sam
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/6] percpu: Change Kconfig ARCH_SETS_UP_PER_CPU_AREA to HAVE_SETUP_PER_CPU_AREA
2008-01-18 5:11 ` Sam Ravnborg
@ 2008-01-18 12:46 ` Mike Travis
2008-01-18 15:46 ` Mike Travis
1 sibling, 0 replies; 11+ messages in thread
From: Mike Travis @ 2008-01-18 12:46 UTC (permalink / raw)
To: Sam Ravnborg
Cc: Andrew Morton, Andi Kleen, mingo, Christoph Lameter, linux-mm,
linux-kernel, Rusty Russell
Sam Ravnborg wrote:
> Hi Mike.
>
>> --- a/arch/x86/Kconfig
>> +++ b/arch/x86/Kconfig
>> @@ -20,6 +20,7 @@ config X86
>> def_bool y
>> select HAVE_OPROFILE
>> select HAVE_KPROBES
>> + select HAVE_SETUP_PER_CPU_AREA if ARCH = "x86_64"
>
> It is simpler to just say:
>> + select HAVE_SETUP_PER_CPU_AREA if X86_64
>
> And this is the way we do it in the rest of the
> x86 Kconfig files.
>
> Sam
Thanks. Done. :-)
And sorry about the premature mailing. I have a set of scripts that
package everything up to send to test machines and it wasn't supposed
to trigger the "sendmail" phase to the distro list. There are a few
build errors (as Ingo has noted) and I'm debugging an X86_64 !NUMA
problem that dies at network startup time.
But I'll add in all the suggestions from the "premature" reviews... :-)
Thanks again,
Mike
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/6] percpu: Change Kconfig ARCH_SETS_UP_PER_CPU_AREA to HAVE_SETUP_PER_CPU_AREA
2008-01-18 5:11 ` Sam Ravnborg
2008-01-18 12:46 ` Mike Travis
@ 2008-01-18 15:46 ` Mike Travis
1 sibling, 0 replies; 11+ messages in thread
From: Mike Travis @ 2008-01-18 15:46 UTC (permalink / raw)
To: Sam Ravnborg
Cc: Andrew Morton, Andi Kleen, mingo, Christoph Lameter, linux-mm,
linux-kernel, Rusty Russell
Sam Ravnborg wrote:
> Hi Mike.
>
>> --- a/arch/x86/Kconfig
>> +++ b/arch/x86/Kconfig
>> @@ -20,6 +20,7 @@ config X86
>> def_bool y
>> select HAVE_OPROFILE
>> select HAVE_KPROBES
>> + select HAVE_SETUP_PER_CPU_AREA if ARCH = "x86_64"
>
> It is simpler to just say:
>> + select HAVE_SETUP_PER_CPU_AREA if X86_64
>
> And this is the way we do it in the rest of the
> x86 Kconfig files.
>
> Sam
I'm trying to trigger an increase in NR_CPUS if SMP_MAX
is set. But it doesn't seem to "take". Of the changes
below only NODES_SHIFT is changed. Is there something else
I need to change?
Thanks,
Mike
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -487,19 +487,29 @@ config ARCH_SUPPORTS_KVM
config NR_CPUS
- int "Maximum number of CPUs (2-255)"
- range 2 255
+ int "Maximum number of CPUs (2-4096)"
+ range 2 4096
depends on SMP
+ default "1024" if X86_SMP_MAX
default "32" if X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000
default "8"
help
This allows you to specify the maximum number of CPUs which this
- kernel will support. The maximum supported value is 255 and the
+ kernel will support. The maximum supported value is 4096 and the
minimum value which makes sense is 2.
This is purely to save memory - each supported CPU adds
approximately eight kilobytes to the kernel image.
+config THREAD_ORDER
+ int "Kernel stack size (in page order)"
+ range 1 3
+ depends on X86_64_SMP
+ default "3" if X86_SMP_MAX
+ default "1"
+ help
+ Increases kernel stack size.
+
config SCHED_SMT
bool "SMT (Hyperthreading) scheduler support"
depends on (X86_64 && SMP) || (X86_32 && X86_HT)
@@ -882,6 +892,7 @@ config NUMA_EMU
config NODES_SHIFT
int
+ default "9" if X86_SMP_MAX
default "6" if X86_64
default "4" if X86_NUMAQ
default "3"
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -73,6 +73,16 @@ config X86_FIND_SMP_CONFIG
depends on X86_LOCAL_APIC || X86_VOYAGER
depends on X86_32
+config X86_SMP_MAX
+ bool "Enable Maximum SMP configuration"
+ def_bool n
+ depends on X86_64_SMP
+ help
+ Say Y here to enable a "large" SMP configuration for testing
+ purposes. It does this by increasing the number of possible
+ cpus to the NR_CPUS count. It also triggers an increase in
+ NR_CPUS, NODES_SHIFT and THREAD_ORDER.
+
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2008-01-18 15:46 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-17 22:35 [PATCH 0/6] percpu: Per cpu code simplification fixup travis
2008-01-17 22:35 ` [PATCH 1/6] Modules: Fold percpu_modcopy into module.c travis
2008-01-17 22:35 ` [PATCH 2/6] percpu: Change Kconfig ARCH_SETS_UP_PER_CPU_AREA to HAVE_SETUP_PER_CPU_AREA travis
2008-01-18 5:11 ` Sam Ravnborg
2008-01-18 12:46 ` Mike Travis
2008-01-18 15:46 ` Mike Travis
2008-01-17 22:35 ` [PATCH 3/6] Sparc64: Use generic percpu travis
2008-01-17 22:35 ` [PATCH 4/6] ia64: " travis
2008-01-17 22:35 ` [PATCH 5/6] Powerpc: Use generic per cpu travis
2008-01-17 22:35 ` [PATCH 6/6] s390: Use generic percpu travis
2008-01-17 22:41 ` [PATCH 0/6] percpu: Per cpu code simplification fixup Mike Travis
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).