From: Rusty Russell <rusty@rustcorp.com.au>
To: Christoph Hellwig <hch@lst.de>
Cc: torvalds@transmeta.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] module_arch_cleanup()
Date: Fri, 09 May 2003 09:02:58 +1000 [thread overview]
Message-ID: <20030508230732.906A92C018@lists.samba.org> (raw)
In-Reply-To: Your message of "Thu, 08 May 2003 18:41:17 +0200." <20030508184117.A26726@lst.de>
In message <20030508184117.A26726@lst.de> you write:
> IA64 needs to be able to hook into module unloading to get rid of
> the unwind tables for modules. (The actual implementation already
> is in arch/ia64/kernel/module.c, David just seems to be to shy to
> submit core changes :))
Or he was waiting for me. Sorry David. Linus, please apply.
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 -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .12078-linux-2.5.69/arch/alpha/kernel/module.c .12078-linux-2.5.69.updated/arch/alpha/kernel/module.c
--- .12078-linux-2.5.69/arch/alpha/kernel/module.c 2003-04-08 11:13:37.000000000 +1000
+++ .12078-linux-2.5.69.updated/arch/alpha/kernel/module.c 2003-05-05 12:47:35.000000000 +1000
@@ -300,3 +300,8 @@ module_finalize(const Elf_Ehdr *hdr, con
{
return 0;
}
+
+void
+module_arch_cleanup(struct module *mod)
+{
+}
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .12078-linux-2.5.69/arch/arm/kernel/module.c .12078-linux-2.5.69.updated/arch/arm/kernel/module.c
--- .12078-linux-2.5.69/arch/arm/kernel/module.c 2003-02-07 19:21:51.000000000 +1100
+++ .12078-linux-2.5.69.updated/arch/arm/kernel/module.c 2003-05-05 12:47:35.000000000 +1000
@@ -159,3 +159,8 @@ module_finalize(const Elf32_Ehdr *hdr, c
{
return 0;
}
+
+void
+module_arch_cleanup(struct module *mod)
+{
+}
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .12078-linux-2.5.69/arch/i386/kernel/module.c .12078-linux-2.5.69.updated/arch/i386/kernel/module.c
--- .12078-linux-2.5.69/arch/i386/kernel/module.c 2003-05-05 12:36:54.000000000 +1000
+++ .12078-linux-2.5.69.updated/arch/i386/kernel/module.c 2003-05-05 12:47:35.000000000 +1000
@@ -123,3 +123,7 @@ int module_finalize(const Elf_Ehdr *hdr,
}
return 0;
}
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .12078-linux-2.5.69/arch/parisc/kernel/module.c .12078-linux-2.5.69.updated/arch/parisc/kernel/module.c
--- .12078-linux-2.5.69/arch/parisc/kernel/module.c 2003-03-25 12:16:58.000000000 +1100
+++ .12078-linux-2.5.69.updated/arch/parisc/kernel/module.c 2003-05-05 12:47:35.000000000 +1000
@@ -568,3 +568,7 @@ int module_finalize(const Elf_Ehdr *hdr,
#endif
return 0;
}
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .12078-linux-2.5.69/arch/ppc/kernel/module.c .12078-linux-2.5.69.updated/arch/ppc/kernel/module.c
--- .12078-linux-2.5.69/arch/ppc/kernel/module.c 2003-02-07 19:21:52.000000000 +1100
+++ .12078-linux-2.5.69.updated/arch/ppc/kernel/module.c 2003-05-05 12:47:35.000000000 +1000
@@ -269,3 +269,7 @@ int module_finalize(const Elf_Ehdr *hdr,
{
return 0;
}
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .12078-linux-2.5.69/arch/ppc64/kernel/module.c .12078-linux-2.5.69.updated/arch/ppc64/kernel/module.c
--- .12078-linux-2.5.69/arch/ppc64/kernel/module.c 2003-02-11 14:25:58.000000000 +1100
+++ .12078-linux-2.5.69.updated/arch/ppc64/kernel/module.c 2003-05-05 12:47:35.000000000 +1000
@@ -386,3 +386,7 @@ int module_finalize(const Elf_Ehdr *hdr,
me->extable.entry + me->extable.num_entries);
return 0;
}
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .12078-linux-2.5.69/arch/s390/kernel/module.c .12078-linux-2.5.69.updated/arch/s390/kernel/module.c
--- .12078-linux-2.5.69/arch/s390/kernel/module.c 2003-04-20 18:05:03.000000000 +1000
+++ .12078-linux-2.5.69.updated/arch/s390/kernel/module.c 2003-05-05 12:47:35.000000000 +1000
@@ -386,3 +386,7 @@ int module_finalize(const Elf_Ehdr *hdr,
kfree(me->arch.syminfo);
return 0;
}
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .12078-linux-2.5.69/arch/sparc/kernel/module.c .12078-linux-2.5.69.updated/arch/sparc/kernel/module.c
--- .12078-linux-2.5.69/arch/sparc/kernel/module.c 2003-04-08 11:13:48.000000000 +1000
+++ .12078-linux-2.5.69.updated/arch/sparc/kernel/module.c 2003-05-05 12:47:35.000000000 +1000
@@ -145,3 +145,7 @@ int module_finalize(const Elf_Ehdr *hdr,
{
return 0;
}
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .12078-linux-2.5.69/arch/sparc64/kernel/module.c .12078-linux-2.5.69.updated/arch/sparc64/kernel/module.c
--- .12078-linux-2.5.69/arch/sparc64/kernel/module.c 2003-04-08 11:13:50.000000000 +1000
+++ .12078-linux-2.5.69.updated/arch/sparc64/kernel/module.c 2003-05-05 12:47:35.000000000 +1000
@@ -273,3 +273,7 @@ int module_finalize(const Elf_Ehdr *hdr,
{
return 0;
}
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .12078-linux-2.5.69/arch/v850/kernel/module.c .12078-linux-2.5.69.updated/arch/v850/kernel/module.c
--- .12078-linux-2.5.69/arch/v850/kernel/module.c 2003-02-07 19:21:52.000000000 +1100
+++ .12078-linux-2.5.69.updated/arch/v850/kernel/module.c 2003-05-05 12:47:35.000000000 +1000
@@ -230,3 +230,8 @@ int apply_relocate_add (Elf32_Shdr *sech
return 0;
}
+
+void
+module_arch_cleanup(struct module *mod)
+{
+}
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .12078-linux-2.5.69/arch/x86_64/kernel/module.c .12078-linux-2.5.69.updated/arch/x86_64/kernel/module.c
--- .12078-linux-2.5.69/arch/x86_64/kernel/module.c 2003-02-17 11:37:44.000000000 +1100
+++ .12078-linux-2.5.69.updated/arch/x86_64/kernel/module.c 2003-05-05 12:47:35.000000000 +1000
@@ -231,3 +231,7 @@ int module_finalize(const Elf_Ehdr *hdr,
{
return 0;
}
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .12078-linux-2.5.69/include/linux/moduleloader.h .12078-linux-2.5.69.updated/include/linux/moduleloader.h
--- .12078-linux-2.5.69/include/linux/moduleloader.h 2003-02-07 19:21:54.000000000 +1100
+++ .12078-linux-2.5.69.updated/include/linux/moduleloader.h 2003-05-05 12:47:35.000000000 +1000
@@ -41,4 +41,7 @@ int module_finalize(const Elf_Ehdr *hdr,
const Elf_Shdr *sechdrs,
struct module *mod);
+/* Any cleanup needed when module leaves. */
+void module_arch_cleanup(struct module *mod);
+
#endif
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .12078-linux-2.5.69/kernel/module.c .12078-linux-2.5.69.updated/kernel/module.c
--- .12078-linux-2.5.69/kernel/module.c 2003-05-05 12:37:13.000000000 +1000
+++ .12078-linux-2.5.69.updated/kernel/module.c 2003-05-05 12:47:35.000000000 +1000
@@ -910,6 +910,9 @@ static void free_module(struct module *m
list_del(&mod->list);
spin_unlock_irq(&modlist_lock);
+ /* Arch-specific cleanup. */
+ module_arch_cleanup(mod);
+
/* Module unload stuff */
module_unload_free(mod);
@@ -1276,6 +1279,7 @@ static struct module *load_module(void _
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;
@@ -1293,6 +1297,7 @@ static struct module *load_module(void _
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;
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
prev parent reply other threads:[~2003-05-08 22:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-08 16:41 [PATCH] module_arch_cleanup() Christoph Hellwig
2003-05-08 20:43 ` David Mosberger
2003-05-08 23:02 ` Rusty Russell [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030508230732.906A92C018@lists.samba.org \
--to=rusty@rustcorp.com.au \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox