linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] add module_arch_cleanup() and improve module debugging output
@ 2003-04-09 21:54 David Mosberger
  2003-04-10  2:16 ` Rusty Russell
  0 siblings, 1 reply; 3+ messages in thread
From: David Mosberger @ 2003-04-09 21:54 UTC (permalink / raw)
  To: rusty; +Cc: linux-kernel

Rusty,

The patch below updates the other platforms with
module_arch_cleanup().  Also, I added more debug output to
kernel/module.c since I found it useful to be able to see the final
section layout.

	--david

diff -Nru a/kernel/module.c b/kernel/module.c
--- a/kernel/module.c	Wed Apr  9 14:49:49 2003
+++ b/kernel/module.c	Wed Apr  9 14:49:49 2003
@@ -909,6 +909,9 @@
 	list_del(&mod->list);
 	spin_unlock_irq(&modlist_lock);
 
+	/* Arch-specific cleanup. */
+	module_arch_cleanup(mod);
+
 	/* Module unload stuff */
 	module_unload_free(mod);
 
@@ -1241,6 +1244,7 @@
 	mod->module_init = ptr;
 
 	/* Transfer each section which specifies SHF_ALLOC */
+	DEBUGP("final section addresses:\n");
 	for (i = 0; i < hdr->e_shnum; i++) {
 		void *dest;
 
@@ -1258,6 +1262,7 @@
 			       sechdrs[i].sh_size);
 		/* Update sh_addr to point to copy in image. */
 		sechdrs[i].sh_addr = (unsigned long)dest;
+		DEBUGP("\t0x%lx %s\n", sechdrs[i].sh_addr, secstrings + sechdrs[i].sh_name);
 	}
 	/* Module has been moved. */
 	mod = (void *)sechdrs[modindex].sh_addr;
diff -Nru a/include/linux/moduleloader.h b/include/linux/moduleloader.h
--- a/include/linux/moduleloader.h	Wed Apr  9 14:49:49 2003
+++ b/include/linux/moduleloader.h	Wed Apr  9 14:49:49 2003
@@ -41,4 +41,7 @@
 		    const Elf_Shdr *sechdrs,
 		    struct module *mod);
 
+/* Any cleanup needed when module leaves. */
+void module_arch_cleanup(struct module *mod);
+
 #endif
diff -Nru a/arch/alpha/kernel/module.c b/arch/alpha/kernel/module.c
--- a/arch/alpha/kernel/module.c	Wed Apr  9 14:49:48 2003
+++ b/arch/alpha/kernel/module.c	Wed Apr  9 14:49:48 2003
@@ -300,3 +300,8 @@
 {
 	return 0;
 }
+
+void
+module_arch_cleanup(struct module *mod)
+{
+}
diff -Nru a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
--- a/arch/arm/kernel/module.c	Wed Apr  9 14:49:48 2003
+++ b/arch/arm/kernel/module.c	Wed Apr  9 14:49:48 2003
@@ -159,3 +159,8 @@
 {
 	return 0;
 }
+
+void
+module_arch_cleanup(struct module *mod)
+{
+}
diff -Nru a/arch/i386/kernel/module.c b/arch/i386/kernel/module.c
--- a/arch/i386/kernel/module.c	Wed Apr  9 14:49:49 2003
+++ b/arch/i386/kernel/module.c	Wed Apr  9 14:49:49 2003
@@ -110,3 +110,7 @@
 {
 	return 0;
 }
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -Nru a/arch/parisc/kernel/module.c b/arch/parisc/kernel/module.c
--- a/arch/parisc/kernel/module.c	Wed Apr  9 14:49:50 2003
+++ b/arch/parisc/kernel/module.c	Wed Apr  9 14:49:50 2003
@@ -568,3 +568,7 @@
 #endif
 	return 0;
 }
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -Nru a/arch/ppc/kernel/module.c b/arch/ppc/kernel/module.c
--- a/arch/ppc/kernel/module.c	Wed Apr  9 14:49:48 2003
+++ b/arch/ppc/kernel/module.c	Wed Apr  9 14:49:48 2003
@@ -269,3 +269,7 @@
 {
 	return 0;
 }
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -Nru a/arch/ppc64/kernel/module.c b/arch/ppc64/kernel/module.c
--- a/arch/ppc64/kernel/module.c	Wed Apr  9 14:49:49 2003
+++ b/arch/ppc64/kernel/module.c	Wed Apr  9 14:49:49 2003
@@ -386,3 +386,7 @@
 		      me->extable.entry + me->extable.num_entries);
 	return 0;
 }
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -Nru a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c
--- a/arch/s390/kernel/module.c	Wed Apr  9 14:49:49 2003
+++ b/arch/s390/kernel/module.c	Wed Apr  9 14:49:49 2003
@@ -348,3 +348,7 @@
 		kfree(me->arch.syminfo);
 	return 0;
 }
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -Nru a/arch/s390x/kernel/module.c b/arch/s390x/kernel/module.c
--- a/arch/s390x/kernel/module.c	Wed Apr  9 14:49:50 2003
+++ b/arch/s390x/kernel/module.c	Wed Apr  9 14:49:50 2003
@@ -374,3 +374,7 @@
 		kfree(me->arch.syminfo);
 	return 0;
 }
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -Nru a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c
--- a/arch/sparc/kernel/module.c	Wed Apr  9 14:49:48 2003
+++ b/arch/sparc/kernel/module.c	Wed Apr  9 14:49:48 2003
@@ -145,3 +145,7 @@
 {
 	return 0;
 }
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -Nru a/arch/sparc64/kernel/module.c b/arch/sparc64/kernel/module.c
--- a/arch/sparc64/kernel/module.c	Wed Apr  9 14:49:49 2003
+++ b/arch/sparc64/kernel/module.c	Wed Apr  9 14:49:49 2003
@@ -273,3 +273,7 @@
 {
 	return 0;
 }
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -Nru a/arch/v850/kernel/module.c b/arch/v850/kernel/module.c
--- a/arch/v850/kernel/module.c	Wed Apr  9 14:49:49 2003
+++ b/arch/v850/kernel/module.c	Wed Apr  9 14:49:49 2003
@@ -230,3 +230,8 @@
 
 	return 0;
 }
+
+void
+module_arch_cleanup(struct module *mod)
+{
+}
diff -Nru a/arch/x86_64/kernel/module.c b/arch/x86_64/kernel/module.c
--- a/arch/x86_64/kernel/module.c	Wed Apr  9 14:49:49 2003
+++ b/arch/x86_64/kernel/module.c	Wed Apr  9 14:49:49 2003
@@ -231,3 +231,7 @@
 {
 	return 0;
 }
+
+void module_arch_cleanup(struct module *mod)
+{
+}

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

* Re: [patch] add module_arch_cleanup() and improve module debugging output
  2003-04-09 21:54 [patch] add module_arch_cleanup() and improve module debugging output David Mosberger
@ 2003-04-10  2:16 ` Rusty Russell
  0 siblings, 0 replies; 3+ messages in thread
From: Rusty Russell @ 2003-04-10  2:16 UTC (permalink / raw)
  To: davidm; +Cc: linux-kernel, torvalds

In message <200304092154.h39Lsmop011302@napali.hpl.hp.com> you write:
> Rusty,
> 
> The patch below updates the other platforms with
> module_arch_cleanup().  Also, I added more debug output to
> kernel/module.c since I found it useful to be able to see the final
> section layout.

Yep, looks great.

Linus, please apply if you haven't already.

Thanks,
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

Name: module_arch_cleanup hook
Author: David Mosberger
Status: Trivial

D: The patch below updates the other platforms with
D: module_arch_cleanup().  Also, I added more debug output to
D: kernel/module.c since I found it useful to be able to see the final
D: section layout.

diff -Nru a/kernel/module.c b/kernel/module.c
--- a/kernel/module.c	Wed Apr  9 14:49:49 2003
+++ b/kernel/module.c	Wed Apr  9 14:49:49 2003
@@ -909,6 +909,9 @@
 	list_del(&mod->list);
 	spin_unlock_irq(&modlist_lock);
 
+	/* Arch-specific cleanup. */
+	module_arch_cleanup(mod);
+
 	/* Module unload stuff */
 	module_unload_free(mod);
 
@@ -1241,6 +1244,7 @@
 	mod->module_init = ptr;
 
 	/* Transfer each section which specifies SHF_ALLOC */
+	DEBUGP("final section addresses:\n");
 	for (i = 0; i < hdr->e_shnum; i++) {
 		void *dest;
 
@@ -1258,6 +1262,7 @@
 			       sechdrs[i].sh_size);
 		/* Update sh_addr to point to copy in image. */
 		sechdrs[i].sh_addr = (unsigned long)dest;
+		DEBUGP("\t0x%lx %s\n", sechdrs[i].sh_addr, secstrings + sechdrs[i].sh_name);
 	}
 	/* Module has been moved. */
 	mod = (void *)sechdrs[modindex].sh_addr;
diff -Nru a/include/linux/moduleloader.h b/include/linux/moduleloader.h
--- a/include/linux/moduleloader.h	Wed Apr  9 14:49:49 2003
+++ b/include/linux/moduleloader.h	Wed Apr  9 14:49:49 2003
@@ -41,4 +41,7 @@
 		    const Elf_Shdr *sechdrs,
 		    struct module *mod);
 
+/* Any cleanup needed when module leaves. */
+void module_arch_cleanup(struct module *mod);
+
 #endif
diff -Nru a/arch/alpha/kernel/module.c b/arch/alpha/kernel/module.c
--- a/arch/alpha/kernel/module.c	Wed Apr  9 14:49:48 2003
+++ b/arch/alpha/kernel/module.c	Wed Apr  9 14:49:48 2003
@@ -300,3 +300,8 @@
 {
 	return 0;
 }
+
+void
+module_arch_cleanup(struct module *mod)
+{
+}
diff -Nru a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
--- a/arch/arm/kernel/module.c	Wed Apr  9 14:49:48 2003
+++ b/arch/arm/kernel/module.c	Wed Apr  9 14:49:48 2003
@@ -159,3 +159,8 @@
 {
 	return 0;
 }
+
+void
+module_arch_cleanup(struct module *mod)
+{
+}
diff -Nru a/arch/i386/kernel/module.c b/arch/i386/kernel/module.c
--- a/arch/i386/kernel/module.c	Wed Apr  9 14:49:49 2003
+++ b/arch/i386/kernel/module.c	Wed Apr  9 14:49:49 2003
@@ -110,3 +110,7 @@
 {
 	return 0;
 }
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -Nru a/arch/parisc/kernel/module.c b/arch/parisc/kernel/module.c
--- a/arch/parisc/kernel/module.c	Wed Apr  9 14:49:50 2003
+++ b/arch/parisc/kernel/module.c	Wed Apr  9 14:49:50 2003
@@ -568,3 +568,7 @@
 #endif
 	return 0;
 }
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -Nru a/arch/ppc/kernel/module.c b/arch/ppc/kernel/module.c
--- a/arch/ppc/kernel/module.c	Wed Apr  9 14:49:48 2003
+++ b/arch/ppc/kernel/module.c	Wed Apr  9 14:49:48 2003
@@ -269,3 +269,7 @@
 {
 	return 0;
 }
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -Nru a/arch/ppc64/kernel/module.c b/arch/ppc64/kernel/module.c
--- a/arch/ppc64/kernel/module.c	Wed Apr  9 14:49:49 2003
+++ b/arch/ppc64/kernel/module.c	Wed Apr  9 14:49:49 2003
@@ -386,3 +386,7 @@
 		      me->extable.entry + me->extable.num_entries);
 	return 0;
 }
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -Nru a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c
--- a/arch/s390/kernel/module.c	Wed Apr  9 14:49:49 2003
+++ b/arch/s390/kernel/module.c	Wed Apr  9 14:49:49 2003
@@ -348,3 +348,7 @@
 		kfree(me->arch.syminfo);
 	return 0;
 }
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -Nru a/arch/s390x/kernel/module.c b/arch/s390x/kernel/module.c
--- a/arch/s390x/kernel/module.c	Wed Apr  9 14:49:50 2003
+++ b/arch/s390x/kernel/module.c	Wed Apr  9 14:49:50 2003
@@ -374,3 +374,7 @@
 		kfree(me->arch.syminfo);
 	return 0;
 }
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -Nru a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c
--- a/arch/sparc/kernel/module.c	Wed Apr  9 14:49:48 2003
+++ b/arch/sparc/kernel/module.c	Wed Apr  9 14:49:48 2003
@@ -145,3 +145,7 @@
 {
 	return 0;
 }
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -Nru a/arch/sparc64/kernel/module.c b/arch/sparc64/kernel/module.c
--- a/arch/sparc64/kernel/module.c	Wed Apr  9 14:49:49 2003
+++ b/arch/sparc64/kernel/module.c	Wed Apr  9 14:49:49 2003
@@ -273,3 +273,7 @@
 {
 	return 0;
 }
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -Nru a/arch/v850/kernel/module.c b/arch/v850/kernel/module.c
--- a/arch/v850/kernel/module.c	Wed Apr  9 14:49:49 2003
+++ b/arch/v850/kernel/module.c	Wed Apr  9 14:49:49 2003
@@ -230,3 +230,8 @@
 
 	return 0;
 }
+
+void
+module_arch_cleanup(struct module *mod)
+{
+}
diff -Nru a/arch/x86_64/kernel/module.c b/arch/x86_64/kernel/module.c
--- a/arch/x86_64/kernel/module.c	Wed Apr  9 14:49:49 2003
+++ b/arch/x86_64/kernel/module.c	Wed Apr  9 14:49:49 2003
@@ -231,3 +231,7 @@
 {
 	return 0;
 }
+
+void module_arch_cleanup(struct module *mod)
+{
+}

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

* Re: [patch] add module_arch_cleanup() and improve module debugging output
       [not found] <mailman.1049925502.12924.linux-kernel2news@redhat.com>
@ 2003-04-10  1:21 ` Pete Zaitcev
  0 siblings, 0 replies; 3+ messages in thread
From: Pete Zaitcev @ 2003-04-10  1:21 UTC (permalink / raw)
  To: davidm; +Cc: linux-kernel

> --- a/arch/sparc/kernel/module.c	Wed Apr  9 14:49:48 2003
> +++ b/arch/sparc/kernel/module.c	Wed Apr  9 14:49:48 2003
> @@ -145,3 +145,7 @@
>  {
>  	return 0;
>  }
> +
> +void module_arch_cleanup(struct module *mod)
> +{
> +}

Why not to do #define module_arch_cleanup(mod)  /* */  ?

-- Pete

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

end of thread, other threads:[~2003-04-10  3:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-09 21:54 [patch] add module_arch_cleanup() and improve module debugging output David Mosberger
2003-04-10  2:16 ` Rusty Russell
     [not found] <mailman.1049925502.12924.linux-kernel2news@redhat.com>
2003-04-10  1:21 ` Pete Zaitcev

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).