LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* Avoid section mismatch involving arch_register_cpu
@ 2008-02-01 14:56 Alexander van Heukelum
  2008-02-01 15:03 ` Sam Ravnborg
  2008-02-01 16:44 ` Sam Ravnborg
  0 siblings, 2 replies; 6+ messages in thread
From: Alexander van Heukelum @ 2008-02-01 14:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: Sam Ravnborg, Alexander van Heukelum

Avoid section mismatch involving arch_register_cpu.

Marking arch_register_cpu as __init and removing the export
for non-hotplug-cpu configurations makes the following warning
go away:

Section mismatch in reference from the function 
arch_register_cpu() to the function .devinit.text:register_cpu()
The function  arch_register_cpu() references
the function __devinit register_cpu().
This is often because arch_register_cpu lacks a __devinit 
annotation or the annotation of register_cpu is wrong.

The only external user of arch_register_cpu in the tree is
in drivers/acpi/processor_core.c where it is guarded by
ACPI_HOTPLUG_CPU (which depends on HOTPLUG_CPU).

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
CC: Sam Ravnborg <sam@ravnborg.org>


diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index 78cbb65..e6757aa 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -57,11 +57,10 @@ void arch_unregister_cpu(int num)
 }
 EXPORT_SYMBOL(arch_unregister_cpu);
 #else
-int arch_register_cpu(int num)
+static int __init arch_register_cpu(int num)
 {
 	return register_cpu(&per_cpu(cpu_devices, num).cpu, num);
 }
-EXPORT_SYMBOL(arch_register_cpu);
 #endif /*CONFIG_HOTPLUG_CPU*/
 
 static int __init topology_init(void)
diff --git a/include/asm-x86/cpu.h b/include/asm-x86/cpu.h
index 85ece5f..73f2ea8 100644
--- a/include/asm-x86/cpu.h
+++ b/include/asm-x86/cpu.h
@@ -10,8 +10,9 @@
 struct x86_cpu {
 	struct cpu cpu;
 };
-extern int arch_register_cpu(int num);
+
 #ifdef CONFIG_HOTPLUG_CPU
+extern int arch_register_cpu(int num);
 extern void arch_unregister_cpu(int);
 #endif


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

* Re: Avoid section mismatch involving arch_register_cpu
  2008-02-01 14:56 Avoid section mismatch involving arch_register_cpu Alexander van Heukelum
@ 2008-02-01 15:03 ` Sam Ravnborg
  2008-02-01 15:21   ` Alexander van Heukelum
  2008-02-01 16:44 ` Sam Ravnborg
  1 sibling, 1 reply; 6+ messages in thread
From: Sam Ravnborg @ 2008-02-01 15:03 UTC (permalink / raw)
  To: Alexander van Heukelum; +Cc: linux-kernel, Alexander van Heukelum

Hi Alexander.

See below for my take on the same warning.
It is already in x86.git pending merge.

Comments welcome.

	Sam

>From b7b4f3e109c742d32d255e04b7c2f90d08599ea8 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@ravnborg.org>
Date: Sat, 26 Jan 2008 21:25:08 +0100
Subject: [PATCH] x86: fix section mismatch warning in topology.c

Fix following warning:
WARNING: arch/x86/kernel/built-in.o(__ksymtab+0x2b0): Section mismatch: reference to .cpuinit.text:arch_register_cpu in '__ksymtab_arch_register_cpu'

Annotating exported symbols are wrong.
Previously the warning were hidden by avoiding the export
in the non HOTPLUG_CPU case but the improved checks in
modpost caught it anyway.
Fix it by removing the __cpuinit annotation and rearrange the
code a bit to save one ifdef/endif pair.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 arch/x86/kernel/topology.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index a0d1719..78cbb65 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -33,7 +33,8 @@
 
 static DEFINE_PER_CPU(struct x86_cpu, cpu_devices);
 
-int __cpuinit arch_register_cpu(int num)
+#ifdef CONFIG_HOTPLUG_CPU
+int arch_register_cpu(int num)
 {
 	/*
 	 * CPU0 cannot be offlined due to several
@@ -44,21 +45,23 @@ int __cpuinit arch_register_cpu(int num)
 	 * Also certain PCI quirks require not to enable hotplug control
 	 * for all CPU's.
 	 */
-#ifdef CONFIG_HOTPLUG_CPU
 	if (num)
 		per_cpu(cpu_devices, num).cpu.hotpluggable = 1;
-#endif
-
 	return register_cpu(&per_cpu(cpu_devices, num).cpu, num);
 }
+EXPORT_SYMBOL(arch_register_cpu);
 
-#ifdef CONFIG_HOTPLUG_CPU
 void arch_unregister_cpu(int num)
 {
 	return unregister_cpu(&per_cpu(cpu_devices, num).cpu);
 }
-EXPORT_SYMBOL(arch_register_cpu);
 EXPORT_SYMBOL(arch_unregister_cpu);
+#else
+int arch_register_cpu(int num)
+{
+	return register_cpu(&per_cpu(cpu_devices, num).cpu, num);
+}
+EXPORT_SYMBOL(arch_register_cpu);
 #endif /*CONFIG_HOTPLUG_CPU*/
 
 static int __init topology_init(void)
-- 
1.5.4.rc3.14.g44397


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

* Re: Avoid section mismatch involving arch_register_cpu
  2008-02-01 15:03 ` Sam Ravnborg
@ 2008-02-01 15:21   ` Alexander van Heukelum
  2008-02-01 16:37     ` Sam Ravnborg
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander van Heukelum @ 2008-02-01 15:21 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: linux-kernel


On Fri, 1 Feb 2008 16:03:12 +0100, "Sam Ravnborg" <sam@ravnborg.org>
said:
> Hi Alexander.
> 
> See below for my take on the same warning.
> It is already in x86.git pending merge.

Hi!

The patch you forwarded is in Linus' tree already. It only
changed one warning into another one, however. My guess is
that you did not see the new warning due to inlining, but I
compiled with CONFIG_CC_OPTIMIZE_FOR_SIZE=y.

Greetings,
    Alexander
-- 
  Alexander van Heukelum
  heukelum@fastmail.fm

-- 
http://www.fastmail.fm - And now for something completely different…


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

* Re: Avoid section mismatch involving arch_register_cpu
  2008-02-01 15:21   ` Alexander van Heukelum
@ 2008-02-01 16:37     ` Sam Ravnborg
  0 siblings, 0 replies; 6+ messages in thread
From: Sam Ravnborg @ 2008-02-01 16:37 UTC (permalink / raw)
  To: Alexander van Heukelum; +Cc: linux-kernel

On Fri, Feb 01, 2008 at 04:21:12PM +0100, Alexander van Heukelum wrote:
> 
> On Fri, 1 Feb 2008 16:03:12 +0100, "Sam Ravnborg" <sam@ravnborg.org>
> said:
> > Hi Alexander.
> > 
> > See below for my take on the same warning.
> > It is already in x86.git pending merge.
> 
> Hi!
> 
> The patch you forwarded is in Linus' tree already. It only
> changed one warning into another one, however. My guess is
> that you did not see the new warning due to inlining, but I
> compiled with CONFIG_CC_OPTIMIZE_FOR_SIZE=y.

You are right - now I actually looked at your patch.

	Sam

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

* Re: Avoid section mismatch involving arch_register_cpu
  2008-02-01 14:56 Avoid section mismatch involving arch_register_cpu Alexander van Heukelum
  2008-02-01 15:03 ` Sam Ravnborg
@ 2008-02-01 16:44 ` Sam Ravnborg
  2008-02-01 16:51   ` Ingo Molnar
  1 sibling, 1 reply; 6+ messages in thread
From: Sam Ravnborg @ 2008-02-01 16:44 UTC (permalink / raw)
  To: Alexander van Heukelum; +Cc: linux-kernel, Alexander van Heukelum, Ingo Molnar

On Fri, Feb 01, 2008 at 03:56:50PM +0100, Alexander van Heukelum wrote:
> Avoid section mismatch involving arch_register_cpu.
> 
> Marking arch_register_cpu as __init and removing the export
> for non-hotplug-cpu configurations makes the following warning
> go away:
> 
> Section mismatch in reference from the function 
> arch_register_cpu() to the function .devinit.text:register_cpu()
> The function  arch_register_cpu() references
> the function __devinit register_cpu().
> This is often because arch_register_cpu lacks a __devinit 
> annotation or the annotation of register_cpu is wrong.
> 
> The only external user of arch_register_cpu in the tree is
> in drivers/acpi/processor_core.c where it is guarded by
> ACPI_HOTPLUG_CPU (which depends on HOTPLUG_CPU).
> 
> Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
> CC: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>

Added Ingo so he can pick it up.

	Sam

> 
> 
> diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
> index 78cbb65..e6757aa 100644
> --- a/arch/x86/kernel/topology.c
> +++ b/arch/x86/kernel/topology.c
> @@ -57,11 +57,10 @@ void arch_unregister_cpu(int num)
>  }
>  EXPORT_SYMBOL(arch_unregister_cpu);
>  #else
> -int arch_register_cpu(int num)
> +static int __init arch_register_cpu(int num)
>  {
>  	return register_cpu(&per_cpu(cpu_devices, num).cpu, num);
>  }
> -EXPORT_SYMBOL(arch_register_cpu);
>  #endif /*CONFIG_HOTPLUG_CPU*/
>  
>  static int __init topology_init(void)
> diff --git a/include/asm-x86/cpu.h b/include/asm-x86/cpu.h
> index 85ece5f..73f2ea8 100644
> --- a/include/asm-x86/cpu.h
> +++ b/include/asm-x86/cpu.h
> @@ -10,8 +10,9 @@
>  struct x86_cpu {
>  	struct cpu cpu;
>  };
> -extern int arch_register_cpu(int num);
> +
>  #ifdef CONFIG_HOTPLUG_CPU
> +extern int arch_register_cpu(int num);
>  extern void arch_unregister_cpu(int);
>  #endif
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

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

* Re: Avoid section mismatch involving arch_register_cpu
  2008-02-01 16:44 ` Sam Ravnborg
@ 2008-02-01 16:51   ` Ingo Molnar
  0 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2008-02-01 16:51 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Alexander van Heukelum, linux-kernel, Alexander van Heukelum


* Sam Ravnborg <sam@ravnborg.org> wrote:

> > The only external user of arch_register_cpu in the tree is in 
> > drivers/acpi/processor_core.c where it is guarded by 
> > ACPI_HOTPLUG_CPU (which depends on HOTPLUG_CPU).
> > 
> > Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
> > CC: Sam Ravnborg <sam@ravnborg.org>
> Acked-by: Sam Ravnborg <sam@ravnborg.org>
> 
> Added Ingo so he can pick it up.

yep, already did so.

	Ingo

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

end of thread, other threads:[~2008-02-01 16:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-01 14:56 Avoid section mismatch involving arch_register_cpu Alexander van Heukelum
2008-02-01 15:03 ` Sam Ravnborg
2008-02-01 15:21   ` Alexander van Heukelum
2008-02-01 16:37     ` Sam Ravnborg
2008-02-01 16:44 ` Sam Ravnborg
2008-02-01 16:51   ` 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).