All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lguest: clean up some l"references .init.text" warnings
@ 2007-03-22  2:57 Rusty Russell
  2007-03-22 10:09 ` [PATCH] lguest: clean rest of linkage warnings (bar one) Rusty Russell
  0 siblings, 1 reply; 5+ messages in thread
From: Rusty Russell @ 2007-03-22  2:57 UTC (permalink / raw)
  To: Andrew Morton; +Cc: virtualization, lkml - Kernel Mailing List

Thanks to Andrew for pointing these out.

This patch moves the parvirtprobe section into .init.data: it's only
used in very very early boot, and for similar reasons, puts
lguest_maybe_init and lguest_memory_setup in init.text.

As well as fixing some warnings, this frees up a tiny bit more memory.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

diff -r ecec388180b2 arch/i386/kernel/vmlinux.lds.S
--- a/arch/i386/kernel/vmlinux.lds.S	Mon Mar 19 14:58:08 2007 +1100
+++ b/arch/i386/kernel/vmlinux.lds.S	Tue Mar 20 12:10:39 2007 +1100
@@ -81,12 +81,6 @@ SECTIONS
 	CONSTRUCTORS
 	} :data
 
-  .paravirtprobe : AT(ADDR(.paravirtprobe) - LOAD_OFFSET) {
-  	__start_paravirtprobe = .;
-	*(.paravirtprobe)
-  	__stop_paravirtprobe = .;
-  }
-
   . = ALIGN(4096);
   .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
   	__nosave_begin = .;
@@ -151,7 +145,12 @@ SECTIONS
 	*(.init.text)
 	_einittext = .;
   }
-  .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
+  .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
+	*(.init.data)
+  	__start_paravirtprobe = .;
+	*(.paravirtprobe)
+  	__stop_paravirtprobe = .;
+  }
   . = ALIGN(16);
   .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
   	__setup_start = .;
diff -r ecec388180b2 arch/i386/lguest/lguest.c
--- a/arch/i386/lguest/lguest.c	Mon Mar 19 14:58:08 2007 +1100
+++ b/arch/i386/lguest/lguest.c	Tue Mar 20 11:34:07 2007 +1100
@@ -136,7 +136,7 @@ static struct notifier_block paniced = {
 	.notifier_call = lguest_panic
 };
 
-static char *lguest_memory_setup(void)
+static __init char *lguest_memory_setup(void)
 {
 	/* We do this here because lockcheck barfs if before start_kernel */
 	atomic_notifier_chain_register(&panic_notifier_list, &paniced);
@@ -549,7 +549,8 @@ static __attribute_used__ __init void lg
 	start_kernel();
 }
 
-asm("lguest_maybe_init:\n"
+asm(".section .init.text\n"
+    "lguest_maybe_init:\n"
     "	cmpl $"__stringify(LGUEST_MAGIC_EBP)", %ebp\n"
     "	jne 1f\n"
     "	cmpl $"__stringify(LGUEST_MAGIC_EDI)", %edi\n"



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

* [PATCH] lguest: clean rest of linkage warnings (bar one)
  2007-03-22  2:57 [PATCH] lguest: clean up some l"references .init.text" warnings Rusty Russell
@ 2007-03-22 10:09 ` Rusty Russell
  2007-03-22 11:45   ` Sam Ravnborg
  0 siblings, 1 reply; 5+ messages in thread
From: Rusty Russell @ 2007-03-22 10:09 UTC (permalink / raw)
  To: Andrew Morton; +Cc: virtualization, lkml - Kernel Mailing List, Sam Ravnborg

My previous warning fix broke lguest if your text size wasn't correct
to make the __start_paravirtprobe aligned correctly.  Put the separate
paravirtprobe section back, but inside the init section so it gets
discarded.

It also fixes the remaining warnings, except one.  The code in
modpost.c which needs to be taught that it's legal to link from
.paravirtprobe to .init.text is horrible, and I'm pretty sure I'd just
make it worse.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

diff -r a38b5b461807 arch/i386/kernel/vmlinux.lds.S
--- a/arch/i386/kernel/vmlinux.lds.S	Thu Mar 22 19:28:55 2007 +1100
+++ b/arch/i386/kernel/vmlinux.lds.S	Thu Mar 22 20:12:26 2007 +1100
@@ -145,12 +145,7 @@ SECTIONS
 	*(.init.text)
 	_einittext = .;
   }
-  .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
-	*(.init.data)
-  	__start_paravirtprobe = .;
-	*(.paravirtprobe)
-  	__stop_paravirtprobe = .;
-  }
+  .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
   . = ALIGN(16);
   .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
   	__setup_start = .;
@@ -178,6 +173,11 @@ SECTIONS
 	*(.altinstr_replacement)
   }
   . = ALIGN(4);
+  .paravirtprobe : AT(ADDR(.paravirtprobe) - LOAD_OFFSET) {
+ 	__start_paravirtprobe = .;
+	*(.paravirtprobe)
+  	__stop_paravirtprobe = .;
+  }
   .parainstructions : AT(ADDR(.parainstructions) - LOAD_OFFSET) {
   	__start_parainstructions = .;
 	*(.parainstructions)
diff -r a38b5b461807 arch/i386/lguest/core.c
--- a/arch/i386/lguest/core.c	Thu Mar 22 19:28:55 2007 +1100
+++ b/arch/i386/lguest/core.c	Thu Mar 22 20:21:21 2007 +1100
@@ -131,7 +131,7 @@ free_some_pages:
 	return err;
 }
 
-static __exit void unmap_hypervisor(void)
+static void unmap_hypervisor(void)
 {
 	unsigned int i;
 
diff -r a38b5b461807 arch/i386/lguest/lg.h
--- a/arch/i386/lguest/lg.h	Thu Mar 22 19:28:55 2007 +1100
+++ b/arch/i386/lguest/lg.h	Thu Mar 22 20:20:15 2007 +1100
@@ -38,7 +38,7 @@ struct lguest_regs
 	u32 ss;
 };
 
-__exit void free_pagetables(void);
+void free_pagetables(void);
 __init int init_pagetables(struct page **hype_page, int pages);
 
 /* Full 4G segment descriptors, suitable for CS and DS. */
diff -r a38b5b461807 arch/i386/lguest/lguest.c
--- a/arch/i386/lguest/lguest.c	Thu Mar 22 19:28:55 2007 +1100
+++ b/arch/i386/lguest/lguest.c	Thu Mar 22 20:40:22 2007 +1100
@@ -550,7 +550,7 @@ static __attribute_used__ __init void lg
 	start_kernel();
 }
 
-asm(".section .init.text\n"
+asm(".pushsection .init.text,\"ax\",@progbits\n"
     "lguest_maybe_init:\n"
     "	cmpl $"__stringify(LGUEST_MAGIC_EBP)", %ebp\n"
     "	jne 1f\n"
@@ -558,6 +558,7 @@ asm(".section .init.text\n"
     "	jne 1f\n"
     "	cmpl $"__stringify(LGUEST_MAGIC_ESI)", %esi\n"
     "	je lguest_init\n"
-    "1: ret");
+    "1: ret\n"
+    ".popsection");
 extern void asmlinkage lguest_maybe_init(void);
 paravirt_probe(lguest_maybe_init);
diff -r a38b5b461807 arch/i386/lguest/page_tables.c
--- a/arch/i386/lguest/page_tables.c	Thu Mar 22 19:28:55 2007 +1100
+++ b/arch/i386/lguest/page_tables.c	Thu Mar 22 20:06:03 2007 +1100
@@ -381,7 +381,7 @@ __init int init_pagetables(struct page *
 	return 0;
 }
 
-__exit void free_pagetables(void)
+void free_pagetables(void)
 {
 	free_hypervisor_pte_pages();
 }



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

* Re: [PATCH] lguest: clean rest of linkage warnings (bar one)
  2007-03-22 10:09 ` [PATCH] lguest: clean rest of linkage warnings (bar one) Rusty Russell
@ 2007-03-22 11:45   ` Sam Ravnborg
  2007-03-23  7:25     ` Rusty Russell
  0 siblings, 1 reply; 5+ messages in thread
From: Sam Ravnborg @ 2007-03-22 11:45 UTC (permalink / raw)
  To: Rusty Russell; +Cc: Andrew Morton, virtualization, lkml - Kernel Mailing List

On Thu, Mar 22, 2007 at 09:09:42PM +1100, Rusty Russell wrote:
> My previous warning fix broke lguest if your text size wasn't correct
> to make the __start_paravirtprobe aligned correctly.  Put the separate
> paravirtprobe section back, but inside the init section so it gets
> discarded.
> 
> It also fixes the remaining warnings, except one.  The code in
> modpost.c which needs to be taught that it's legal to link from
> .paravirtprobe to .init.text is horrible, and I'm pretty sure I'd just
> make it worse.

If you drop me a sample of the exact warning I will add this one too.
Current kbuild.git contains a lot of fixes in this area so I refer to
do so on top of that tree.

	Sam

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

* Re: [PATCH] lguest: clean rest of linkage warnings (bar one)
  2007-03-22 11:45   ` Sam Ravnborg
@ 2007-03-23  7:25     ` Rusty Russell
  2007-03-23 19:05       ` Sam Ravnborg
  0 siblings, 1 reply; 5+ messages in thread
From: Rusty Russell @ 2007-03-23  7:25 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Andrew Morton, virtualization, lkml - Kernel Mailing List

On Thu, 2007-03-22 at 12:45 +0100, Sam Ravnborg wrote:
> On Thu, Mar 22, 2007 at 09:09:42PM +1100, Rusty Russell wrote:
> > It also fixes the remaining warnings, except one.  The code in
> > modpost.c which needs to be taught that it's legal to link from
> > .paravirtprobe to .init.text is horrible, and I'm pretty sure I'd just
> > make it worse.
> 
> If you drop me a sample of the exact warning I will add this one too.
> Current kbuild.git contains a lot of fixes in this area so I refer to
> do so on top of that tree.

WARNING: vmlinux - Section mismatch: reference to .init.text: from .paravirtprobe between '__start_paravirtprobe' (at offset 0xc0464c7c) and '__stop_paravirtprobe'

Sam, you're always so polite and damn helpful: I'm pretty sure that
violates the core tenets of Linux etiquette.

Perhaps you could work on that?
Rusty.



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

* Re: [PATCH] lguest: clean rest of linkage warnings (bar one)
  2007-03-23  7:25     ` Rusty Russell
@ 2007-03-23 19:05       ` Sam Ravnborg
  0 siblings, 0 replies; 5+ messages in thread
From: Sam Ravnborg @ 2007-03-23 19:05 UTC (permalink / raw)
  To: Rusty Russell; +Cc: Andrew Morton, virtualization, lkml - Kernel Mailing List

On Fri, Mar 23, 2007 at 06:25:39PM +1100, Rusty Russell wrote:
> On Thu, 2007-03-22 at 12:45 +0100, Sam Ravnborg wrote:
> > On Thu, Mar 22, 2007 at 09:09:42PM +1100, Rusty Russell wrote:
> > > It also fixes the remaining warnings, except one.  The code in
> > > modpost.c which needs to be taught that it's legal to link from
> > > .paravirtprobe to .init.text is horrible, and I'm pretty sure I'd just
> > > make it worse.
> > 
> > If you drop me a sample of the exact warning I will add this one too.
> > Current kbuild.git contains a lot of fixes in this area so I refer to
> > do so on top of that tree.
> 
> WARNING: vmlinux - Section mismatch: reference to .init.text: from .paravirtprobe between '__start_paravirtprobe' (at offset 0xc0464c7c) and '__stop_paravirtprobe'
> 
> Sam, you're always so polite and damn helpful: I'm pretty sure that
> violates the core tenets of Linux etiquette.
I get this strange feeling that you are planning to ask me to do much more....

Anyway I have added following path to kbuild.git.
Two small unrelated changes sneaked in (deleting a wrong part of a 
comment and adding an empty line)

It should apply on top of latest -mm

	Sam

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 06a16ac..1e578fd 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -626,7 +626,6 @@ static int strrcmp(const char *s, const char *sub)
  *   tosec   = .init.text
  *   fromsec = .text
  *   atsym = kernel_init
- *   Some symbols belong to init section but still it is ok to reference
  *
  * Pattern 7:
  *  Logos used in drivers/video/logo reside in __initdata but the
@@ -643,6 +642,13 @@ static int strrcmp(const char *s, const char *sub)
  *  The pattern is:
  *  tosec    = .init.text
  *  fromsec  = __ksymtab*
+ *
+ * Pattern 9:
+ *  Symbols contained in .paravirtprobe amy safely reference
+ *  .init.text.
+ *  The pattern is:
+ *  tosec   = .init.text
+ *  fromsec  = .paravirtprobe
  **/
 static int secref_whitelist(const char *modname, const char *tosec,
 			    const char *fromsec, const char *atsym,
@@ -720,10 +726,17 @@ static int secref_whitelist(const char *modname, const char *tosec,
 	    (strncmp(fromsec, ".text", strlen(".text")) == 0) &&
 	    (strncmp(refsymname, "logo_", strlen("logo_")) == 0))
 		return 1;
+
 	/* Check for pattern 8 */
 	if ((strcmp(tosec, ".init.text") == 0) &&
 	    (strncmp(fromsec, "__ksymtab", strlen("__ksymtab")) == 0))
 		return 1;
+
+	/* Check for pattern 9 */
+	if ((strcmp(tosec, ".init.text") == 0) &&
+	    (strcmp(fromsec, ".paravirtprobe") == 0))
+		return 1;
+
 	return 0;
 }
 

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

end of thread, other threads:[~2007-03-23 19:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-22  2:57 [PATCH] lguest: clean up some l"references .init.text" warnings Rusty Russell
2007-03-22 10:09 ` [PATCH] lguest: clean rest of linkage warnings (bar one) Rusty Russell
2007-03-22 11:45   ` Sam Ravnborg
2007-03-23  7:25     ` Rusty Russell
2007-03-23 19:05       ` Sam Ravnborg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.