Skip to contentSkip to conversation

xen: fix section mismatch in reference from the function xen_hvm_init_shared_info()

PATCH In review Stefan Assmann 2 participants 3 messages Nov 30, 2010 – Dec 1, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: fix section mismatch in reference from the function xen_hvm_init_shared_info()

From: Stefan Assmann <[email protected]>

The following warning shows up when building the kernel with make CONFIG_DEBUG_SECTION_MISMATCH=y.

WARNING: arch/x86/built-in.o(.text+0x475): Section mismatch in reference from the function xen_hvm_init_shared_info() to the function .init.text:extend_brk() The function xen_hvm_init_shared_info() references
the function __init extend_brk().
This is often because xen_hvm_init_shared_info lacks a __init
annotation or the annotation of extend_brk is wrong.

The problem is that xen_hvm_init_shared_info() calls extend_brk() which is an __init function. However xen_hvm_init_shared_info() cannot be an __init function as it's called on system resume as well. Easy fix by moving extend_brk() out of the function.

---
 arch/x86/xen/enlighten.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/xen/enlighten.c +4 -4
index 02c710b..13b11fd 100644
@@ -83,6 +83,7 @@ EXPORT_SYMBOL(machine_to_phys_order);
 struct start_info *xen_start_info;
 EXPORT_SYMBOL_GPL(xen_start_info);
 
+struct shared_info *shared_info_page;
 struct shared_info xen_dummy_shared_info;
 
 void *xen_initial_gdt;
@@ -1310,11 +1311,7 @@ void xen_hvm_init_shared_info(void)
 {
 	int cpu;
 	struct xen_add_to_physmap xatp;
-	static struct shared_info *shared_info_page = 0;
 
-	if (!shared_info_page)
-		shared_info_page = (struct shared_info *)
-			extend_brk(PAGE_SIZE, PAGE_SIZE);
 	xatp.domid = DOMID_SELF;
 	xatp.idx = 0;
 	xatp.space = XENMAPSPACE_shared_info;
@@ -1365,6 +1362,9 @@ static void __init xen_hvm_guest_init(void)
 	if (r < 0)
 		return;
 
+	shared_info_page = (struct shared_info *)
+		extend_brk(PAGE_SIZE, PAGE_SIZE);
+
 	xen_hvm_init_shared_info();
 
 	if (xen_feature(XENFEAT_hvm_callback_vector))
Signature · 1 line
1.7.3.2
#1 lore raw
Quoted 26 lines · Stefan Assmann

From: Stefan Assmann <[email protected]>

The following warning shows up when building the kernel with make CONFIG_DEBUG_SECTION_MISMATCH=y.

WARNING: arch/x86/built-in.o(.text+0x475): Section mismatch in reference from the function xen_hvm_init_shared_info() to the function .init.text:extend_brk() The function xen_hvm_init_shared_info() references
the function __init extend_brk().
This is often because xen_hvm_init_shared_info lacks a __init
annotation or the annotation of extend_brk is wrong.

The problem is that xen_hvm_init_shared_info() calls extend_brk() which is an __init function. However xen_hvm_init_shared_info() cannot be an __init function as it's called on system resume as well. Easy fix by moving extend_brk() out of the function.

---
 arch/x86/xen/enlighten.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/xen/enlighten.c +0 -0
index 02c710b..13b11fd 100644

arch/x86/xen/enlighten.c EXPORT_SYMBOL(machine_to_phys_order); · line 89

Quoted 7 lines
arch/x86/xen/enlighten.c +1 -0
@@ -83,6 +83,7 @@ EXPORT_SYMBOL(machine_to_phys_order);
 struct start_info *xen_start_info;
 EXPORT_SYMBOL_GPL(xen_start_info);
 
+struct shared_info *shared_info_page;
 struct shared_info xen_dummy_shared_info;
 
 void *xen_initial_gdt;

why not static?

Quoted 25 lines
arch/x86/xen/enlighten.c +3 -4
@@ -1310,11 +1311,7 @@ void xen_hvm_init_shared_info(void)
 {
 	int cpu;
 	struct xen_add_to_physmap xatp;
-	static struct shared_info *shared_info_page = 0;
 
-	if (!shared_info_page)
-		shared_info_page = (struct shared_info *)
-			extend_brk(PAGE_SIZE, PAGE_SIZE);
 	xatp.domid = DOMID_SELF;
 	xatp.idx = 0;
 	xatp.space = XENMAPSPACE_shared_info;
@@ -1365,6 +1362,9 @@ static void __init xen_hvm_guest_init(void)
 	if (r < 0)
 		return;
 
+	shared_info_page = (struct shared_info *)
+		extend_brk(PAGE_SIZE, PAGE_SIZE);
+
 	xen_hvm_init_shared_info();
 
 	if (xen_feature(XENFEAT_hvm_callback_vector))
Signature · 1 line
1.7.3.2

thanks for the patch,

Stefano

#2 lore raw
Quoted 30 lines · Stefano Stabellini
Quoted 29 lines · Stefan Assmann

From: Stefan Assmann <[email protected]>

The following warning shows up when building the kernel with make CONFIG_DEBUG_SECTION_MISMATCH=y.

WARNING: arch/x86/built-in.o(.text+0x475): Section mismatch in reference from the function xen_hvm_init_shared_info() to the function .init.text:extend_brk() The function xen_hvm_init_shared_info() references
the function __init extend_brk().
This is often because xen_hvm_init_shared_info lacks a __init
annotation or the annotation of extend_brk is wrong.

The problem is that xen_hvm_init_shared_info() calls extend_brk() which is an __init function. However xen_hvm_init_shared_info() cannot be an __init function as it's called on system resume as well. Easy fix by moving extend_brk() out of the function.

---
 arch/x86/xen/enlighten.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/xen/enlighten.c +0 -0
index 02c710b..13b11fd 100644
@@ -83,6 +83,7 @@ EXPORT_SYMBOL(machine_to_phys_order);
 struct start_info *xen_start_info;
 EXPORT_SYMBOL_GPL(xen_start_info);
 
Quoted 6 lines

arch/x86/xen/enlighten.c EXPORT_SYMBOL(machine_to_phys_order); · line 89

Quoted 4 lines
arch/x86/xen/enlighten.c +1 -0
+struct shared_info *shared_info_page;
 struct shared_info xen_dummy_shared_info;
 
 void *xen_initial_gdt;

why not static?

No particular reason, feel free to make it static. Thx for the review!

Stefan
--

Stefan Assmann         | Red Hat GmbH
Software Engineer      | Otto-Hahn-Strasse 20, 85609 Dornach
                       | HR: Amtsgericht Muenchen HRB 153243
                       | GF: Brendan Lane, Charlie Peters,
sassmann at redhat.com |     Michael Cunningham, Charles Cachera