linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [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
  1 sibling, 0 replies; 4+ messages in thread
From: travis @ 2008-01-30 18:09 UTC (permalink / raw)
  To: Geert Uytterhoeven, Linus Torvalds, mingo, Thomas Gleixner
  Cc: Tony Luck, linux-ia64, linuxppc-dev, Rusty Russell, Andi Kleen,
	linux-kernel, linux-mm, David Miller, Christoph Lameter

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] 4+ 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   ` Ingo Molnar
  1 sibling, 1 reply; 4+ messages in thread
From: travis @ 2008-01-30 18:09 UTC (permalink / raw)
  To: Geert Uytterhoeven, Linus Torvalds, mingo, Thomas Gleixner
  Cc: Tony Luck, linux-ia64, linuxppc-dev, Rusty Russell, Andi Kleen,
	linux-kernel, linux-mm, Sam Ravnborg, David Miller,
	Christoph Lameter

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] 4+ 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; 4+ messages in thread
From: Ingo Molnar @ 2008-01-30 21:50 UTC (permalink / raw)
  To: travis
  Cc: Tony Luck, linux-ia64, linuxppc-dev, Sam Ravnborg, Rusty Russell,
	linux-kernel, Andi Kleen, linux-mm, Geert Uytterhoeven,
	Thomas Gleixner, Linus Torvalds, David Miller, Christoph Lameter


* 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] 4+ 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; 4+ messages in thread
From: Mike Travis @ 2008-01-30 21:57 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Tony Luck, linux-ia64, linuxppc-dev, Sam Ravnborg, Rusty Russell,
	linux-kernel, Andi Kleen, linux-mm, Geert Uytterhoeven,
	Thomas Gleixner, Linus Torvalds, David Miller, Christoph Lameter

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] 4+ messages in thread

end of thread, other threads:[~2008-01-30 21:57 UTC | newest]

Thread overview: 4+ 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   ` Ingo Molnar
2008-01-30 21:57     ` 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).