Skip to contentSkip to conversation

i386: fix section mismatches for init code with !HOTPLUG_CPU

PATCH In review Jan Beulich 2 participants 4 messages Aug 18, 2009 – Aug 19, 2009 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i386: fix section mismatches for init code with !HOTPLUG_CPU

Commit 0e83815be719d3391bf5ea24b7fe696c07dbd417 changed the section the initial_code variable gets allocated in, in an attempt to address a section conflict warning. This, however created a new section conflict when building without HOTPLUG_CPU. The apparently only (reasonable) way to address this is to always use __REFDATA.

Once at it, also fix a second section mismatch when not using HOTPLUG_CPU.

Cc Robert Richter <[email protected]>
---
 arch/x86/kernel/head_32.S |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
arch/x86/kernel/head_32.S +1 -7
@@ -261,9 +261,7 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
  * which will be freed later
  */
 
-#ifndef CONFIG_HOTPLUG_CPU
-.section .init.text,"ax",@progbits
-#endif
+__CPUINIT
 
 #ifdef CONFIG_SMP
 ENTRY(startup_32_smp)
@@ -602,11 +600,7 @@ ignore_int:
 #endif
 	iret
 
-#ifndef CONFIG_HOTPLUG_CPU
-	__CPUINITDATA
-#else
 	__REFDATA
-#endif
 .align 4
 ENTRY(initial_code)
 	.long i386_start_kernel
#1 lore raw

[tip:x86/urgent] i386: Fix section mismatches for init code with !HOTPLUG_CPU

Commit-ID:  78b89ecd731798f2fec8cc26ca90739253cec33c
Gitweb:     http://git.kernel.org/tip/78b89ecd731798f2fec8cc26ca90739253cec33c
Author:     Jan Beulich <[email protected]>
AuthorDate: Tue, 18 Aug 2009 16:41:33 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 18 Aug 2009 17:52:35 +0200

i386: Fix section mismatches for init code with !HOTPLUG_CPU

Commit 0e83815be719d3391bf5ea24b7fe696c07dbd417 changed the section the initial_code variable gets allocated in, in an attempt to address a section conflict warning. This, however created a new section conflict when building without HOTPLUG_CPU. The apparently only (reasonable) way to address this is to always use __REFDATA.

Once at it, also fix a second section mismatch when not using HOTPLUG_CPU.

Cc Robert Richter <[email protected]>

LKML-Reference: <[email protected]>

---
 arch/x86/kernel/head_32.S |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)
arch/x86/kernel/head_32.S +1 -7
index 0d98a01..cc827ac 100644
@@ -261,9 +261,7 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
  * which will be freed later
  */
 
-#ifndef CONFIG_HOTPLUG_CPU
-.section .init.text,"ax",@progbits
-#endif
+__CPUINIT
 
 #ifdef CONFIG_SMP
 ENTRY(startup_32_smp)
@@ -602,11 +600,7 @@ ignore_int:
 #endif
 	iret
 
-#ifndef CONFIG_HOTPLUG_CPU
-	__CPUINITDATA
-#else
 	__REFDATA
-#endif
 .align 4
 ENTRY(initial_code)
 	.long i386_start_kernel
#2 lore raw
In reply to Jan Beulich
Quoted 5 lines · Jan Beulich

Commit 0e83815be719d3391bf5ea24b7fe696c07dbd417 changed the section the initial_code variable gets allocated in, in an attempt to address a section conflict warning. This, however created a new section conflict when building without HOTPLUG_CPU. The apparently only (reasonable) way to address this is to always use __REFDATA.

Hmm, not sure if I am missing something, but my patch actually shouldn't have changed the !HOTPLUG_CPU case:

arch/x86/kernel/head_32.S +5 -1
index 8663afb..0d98a01 100644
@@ -602,7 +602,11 @@ ignore_int:
 #endif
        iret
 
-.section .cpuinit.data,"wa"
+#ifndef CONFIG_HOTPLUG_CPU
+       __CPUINITDATA
+#else
+       __REFDATA
+#endif
 .align 4
 ENTRY(initial_code)
        .long i386_start_kernel

I compiled -rc6 with HOTPLUG_CPU disabled and got with and without my patch the following warning:

WARNING: vmlinux.o(.cpuinit.data+0x0): Section mismatch in reference from the variable initial_code to the function .init.text:i386_start_kernel() The variable __cpuinitdata initial_code references
a function __init i386_start_kernel().
If i386_start_kernel is only used by initial_code then
annotate i386_start_kernel with a matching annotation.

So, the warning was there before.

The problem with that warning is that i386_start_kernel() is in __init that is calling a chain of other __init functions. Thomas moved initial_code to __CPUINITDATA (commit 583323b9), and thus, also i386_start_kernel() should be __cpuinit. But initial_code seems to be overwritten before with __cpuinit start_secondary() in smpboot.c. Weird ...

Quoted 14 lines

Once at it, also fix a second section mismatch when not using HOTPLUG_CPU.

Cc Robert Richter <[email protected]>
---
 arch/x86/kernel/head_32.S |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

arch/x86/kernel/head_32.S 2009-08-18 10:38:31.000000000 +0200 page_pde_offset = (__PAGE_OFFSET >> 20); · line 264

Quoted 7 lines
arch/x86/kernel/head_32.S 2009-08-18 10:38:31.000000000 +0200 renamed from arch/x86/kernel/head_32.S 2009-08-18 15:31:16.000000000 +0200 +1 -3
@@ -261,9 +261,7 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
  * which will be freed later
  */
 
-#ifndef CONFIG_HOTPLUG_CPU
-.section .init.text,"ax",@progbits
-#endif
+__CPUINIT

This was here before (HOTPLUG_CPU case):

.section .text.head,"ax",@progbits

In the case a cpu is enabled again, do __cpuinit sections still exist?

-Robert

Quoted 19 lines
arch/x86/kernel/head_32.S 2009-08-18 10:38:31.000000000 +0200 renamed from arch/x86/kernel/head_32.S 2009-08-18 15:31:16.000000000 +0200 +0 -4
 #ifdef CONFIG_SMP
 ENTRY(startup_32_smp)
@@ -602,11 +600,7 @@ ignore_int:
 #endif
      iret
 
-#ifndef CONFIG_HOTPLUG_CPU
-     __CPUINITDATA
-#else
      __REFDATA
-#endif
 .align 4
 ENTRY(initial_code)
      .long i386_start_kernel
Signature · 3 lines
Advanced Micro Devices, Inc.
Operating System Research Center
email: [email protected]
#3 lore raw

Re: [PATCH] i386: fix section mismatches for init code with!HOTPLUG_CPU

Quoted 10 lines
Quoted 1 line
Quoted 1 line

Robert Richter <[email protected]> 18.08.09 19:57 >>>

Quoted 5 lines · Jan Beulich

Commit 0e83815be719d3391bf5ea24b7fe696c07dbd417 changed the section the initial_code variable gets allocated in, in an attempt to address a section conflict warning. This, however created a new section conflict when building without HOTPLUG_CPU. The apparently only (reasonable) way to address this is to always use __REFDATA.

Hmm, not sure if I am missing something, but my patch actually shouldn't have changed the !HOTPLUG_CPU case:

Correct, but it also didn't take care of it, despite changing the code in question.

Jan