* [PATCH 1/6] modules: Fold percpu_modcopy into module.c linux-2.6.git
[not found] <20080130180940.022172000@sgi.com>
@ 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
2008-01-30 18:09 ` [PATCH 4/6] ia64: Use generic percpu linux-2.6.git travis
2 siblings, 0 replies; 5+ 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
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] 5+ messages in thread
* [PATCH 2/6] percpu: Change Kconfig to HAVE_SETUP_PER_CPU_AREA linux-2.6.git
[not found] <20080130180940.022172000@sgi.com>
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 ` [PATCH 2/6] percpu: Change Kconfig to HAVE_SETUP_PER_CPU_AREA Ingo Molnar
2008-01-30 18:09 ` [PATCH 4/6] ia64: Use generic percpu linux-2.6.git travis
2 siblings, 1 reply; 5+ 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
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] 5+ messages in thread
* [PATCH 4/6] ia64: Use generic percpu linux-2.6.git
[not found] <20080130180940.022172000@sgi.com>
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
2 siblings, 0 replies; 5+ 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
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] 5+ messages in thread
* Re: [PATCH 2/6] percpu: Change Kconfig to HAVE_SETUP_PER_CPU_AREA
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; 5+ 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] 5+ messages in thread
* Re: [PATCH 2/6] percpu: Change Kconfig to HAVE_SETUP_PER_CPU_AREA
2008-01-30 21:50 ` [PATCH 2/6] percpu: Change Kconfig to HAVE_SETUP_PER_CPU_AREA Ingo Molnar
@ 2008-01-30 21:57 ` Mike Travis
0 siblings, 0 replies; 5+ 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] 5+ messages in thread
end of thread, other threads:[~2008-01-30 21:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20080130180940.022172000@sgi.com>
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 ` [PATCH 2/6] percpu: Change Kconfig to HAVE_SETUP_PER_CPU_AREA Ingo Molnar
2008-01-30 21:57 ` Mike Travis
2008-01-30 18:09 ` [PATCH 4/6] ia64: Use generic percpu linux-2.6.git travis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox