From: Helge Deller <deller@gmx.de>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: linux-parisc <linux-parisc@vger.kernel.org>,
Linux Kernel Development <linux-kernel@vger.kernel.org>,
Kyle McMartin <kyle@mcmartin.ca>,
Randolph Chung <randolph@tausq.org>,
Linus <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
Sam Ravnborg <sam@ravnborg.org>,
John David Anglin <dave@hiauly1.hia.nrc.ca>
Subject: Re: [PATCH] parisc: fix module loading failure of large kernel modules (take 4)
Date: Thu, 01 Jan 2009 13:02:43 +0100 [thread overview]
Message-ID: <495CB0E3.70509@gmx.de> (raw)
In-Reply-To: <200901011122.01109.rusty@rustcorp.com.au>
Rusty Russell wrote:
> On Thursday 01 January 2009 00:43:56 Helge Deller wrote:
>> Rusty Russell wrote:
>>> Not quite what I had in mind... let me show you:
>>> ...
>>> Otherwise I'd have called it "arch_module_extra_size()".
>> This would mean that I can increase the section size in the arch-specific function
>> by returning a bigger value than sh_size.
>> This would give me space at the end of the section, but not at the beginning
>> (which is what I need), as sh_entsize (the offset into memory) will stay the
>> same as before.
>
> Ah, OK. I assumed that extra room at the end was sufficient.
>
> So I've taken your previous patch and renamed the function to
> arch_mod_section_prepend().
Thanks a lot !!!!
Patch below is ok and I'll adjust the parisc-specific patch
acordingly.
> If we decide not to kill those bad gcc versions,
> I'll stick it in some other random file (lib/weak.c? Blech...)
Andrew has pulled in the patch from Adrian in his -mm tree, so we should
be safe now.
> BTW, this is very late for this merge window. I would have liked to see
> this a month ago :(
Yes, sorry, I didn't had a patch available earlier.
I hope it's still in-time though, esp. as this will fix one of our longest
outstanding bugs on parisc and is quite important for us.
Thanks,
Helge
> Subject: module: fix module loading failure of large kernel modules for parisc
> Date: Wed, 31 Dec 2008 12:31:18 +0100
> From: Helge Deller <deller@gmx.de>
>
> When creating the final layout of a kernel module in memory, allow the
> module loader to reserve some additional memory in front of a given section.
> This is currently only needed for the parisc port which needs to put the
> stub entries there to fulfill the 17/22bit PCREL relocations with large
> kernel modules like xfs.
>
> Signed-off-by: Helge Deller <deller@gmx.de>
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (renamed fn)
>
> diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h
> --- a/include/linux/moduleloader.h
> +++ b/include/linux/moduleloader.h
> @@ -12,6 +12,9 @@ int module_frob_arch_sections(Elf_Ehdr *
> Elf_Shdr *sechdrs,
> char *secstrings,
> struct module *mod);
> +
> +/* Additional bytes needed by arch in front of individual sections */
> +unsigned int arch_mod_section_prepend(struct module *mod, unsigned int section);
>
> /* Allocator used for allocating struct module, core sections and init
> sections. Returns NULL on failure. */
> diff --git a/kernel/module.c b/kernel/module.c
> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@ -1588,11 +1588,21 @@ static int simplify_symbols(Elf_Shdr *se
> return ret;
> }
>
> +/* Additional bytes needed by arch in front of individual sections */
> +unsigned int __weak arch_mod_section_prepend(struct module *mod,
> + unsigned int section)
> +{
> + /* default implementation just returns zero */
> + return 0;
> +}
> +
> /* Update size with this section: return offset. */
> -static long get_offset(unsigned int *size, Elf_Shdr *sechdr)
> +static long get_offset(struct module *mod, unsigned int *size,
> + Elf_Shdr *sechdr, unsigned int section)
> {
> long ret;
>
> + *size += arch_mod_section_prepend(mod, section);
> ret = ALIGN(*size, sechdr->sh_addralign ?: 1);
> *size = ret + sechdr->sh_size;
> return ret;
> @@ -1632,7 +1642,7 @@ static void layout_sections(struct modul
> || strncmp(secstrings + s->sh_name,
> ".init", 5) == 0)
> continue;
> - s->sh_entsize = get_offset(&mod->core_size, s);
> + s->sh_entsize = get_offset(mod, &mod->core_size, s, i);
> DEBUGP("\t%s\n", secstrings + s->sh_name);
> }
> if (m == 0)
> @@ -1650,7 +1660,7 @@ static void layout_sections(struct modul
> || strncmp(secstrings + s->sh_name,
> ".init", 5) != 0)
> continue;
> - s->sh_entsize = (get_offset(&mod->init_size, s)
> + s->sh_entsize = (get_offset(mod, &mod->init_size, s, i)
> | INIT_OFFSET_MASK);
> DEBUGP("\t%s\n", secstrings + s->sh_name);
> }
>
next prev parent reply other threads:[~2009-01-01 12:02 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-29 20:34 [PATCH] parisc: fix module loading failure of large kernel modules (take 2) Helge Deller
2008-12-29 20:43 ` [PATCH 1/2] module.c: fix module loading failure of large " Helge Deller
[not found] ` <20081230180724.GA15235@bombadil.infradead.org>
2008-12-30 18:10 ` Kyle McMartin
2008-12-30 18:18 ` Helge Deller
2008-12-30 19:42 ` [PATCH 1/2] module.c: fix module loading failure of large modules (take 3) Helge Deller
2008-12-29 20:45 ` [PATCH 2/2] parisc: fix module loading failure of large modules (take 2) Helge Deller
2008-12-30 19:55 ` [PATCH 2/2] parisc: fix module loading failure of large modules (take 3) Helge Deller
2008-12-30 22:45 ` [PATCH] parisc: fix module loading failure of large kernel modules (take 2) Rusty Russell
2008-12-30 23:02 ` Helge Deller
2008-12-31 4:08 ` Rusty Russell
2008-12-31 11:31 ` [PATCH] parisc: fix module loading failure of large kernel modules (take 4) Helge Deller
2008-12-31 11:36 ` [PATCH 2/2] parisc: fix module loading failure of large modules Helge Deller
2008-12-31 13:32 ` [PATCH] parisc: fix module loading failure of large kernel modules (take 4) Rusty Russell
2008-12-31 14:13 ` Helge Deller
2009-01-01 0:52 ` Rusty Russell
2009-01-01 12:02 ` Helge Deller [this message]
2008-12-31 17:29 ` Linus Torvalds
2008-12-31 17:36 ` Roland Dreier
2008-12-31 17:47 ` Linus Torvalds
2008-12-31 18:02 ` Linus Torvalds
2008-12-31 18:11 ` Sam Ravnborg
2009-01-02 11:31 ` Ingo Molnar
2008-12-31 18:54 ` Andrew Morton
2008-12-31 21:22 ` Linus Torvalds
2008-12-31 22:14 ` David Miller
2009-01-02 11:55 ` [PATCH] kbuild: Disallow GCC 4.1.0 / 4.1.1 Ingo Molnar
2009-01-02 13:43 ` Bartlomiej Zolnierkiewicz
2009-01-02 15:21 ` [PATCH] kbuild: Remove gcc 4.1.0 quirk from init/main.c Ingo Molnar
2009-01-02 18:05 ` Sam Ravnborg
2009-01-02 16:49 ` [PATCH] kbuild: Disallow GCC 4.1.0 / 4.1.1 Linus Torvalds
2009-01-02 17:38 ` Linus Torvalds
2009-01-02 17:46 ` Ingo Molnar
2009-01-02 17:54 ` [PATCH] Disallow gcc versions 3.{0,1} Ingo Molnar
2009-01-02 17:58 ` [PATCH] kbuild: Disallow GCC 4.1.0 / 4.1.1 Linus Torvalds
2009-01-02 18:01 ` Ingo Molnar
2009-01-02 18:05 ` Linus Torvalds
2009-01-02 18:08 ` Linus Torvalds
2009-01-02 19:54 ` Willy Tarreau
2009-01-02 20:18 ` Linus Torvalds
2009-01-02 17:57 ` Sam Ravnborg
2009-01-02 18:04 ` Linus Torvalds
2009-01-02 18:27 ` Sam Ravnborg
2009-01-02 18:28 ` Randy Dunlap
2009-01-02 18:51 ` Al Viro
2009-01-02 19:14 ` Andi Kleen
2009-01-02 22:52 ` Al Viro
2009-01-03 14:03 ` Krzysztof Halasa
2009-01-02 18:22 ` Ingo Molnar
2009-01-02 18:29 ` Sam Ravnborg
2009-01-02 18:33 ` Ingo Molnar
2009-01-02 19:05 ` Detlef Riekenberg
2009-01-02 22:27 ` Benjamin Herrenschmidt
2009-01-02 22:37 ` Sam Ravnborg
2009-01-02 17:44 ` Ingo Molnar
2009-01-01 14:24 ` [PATCH] parisc: fix module loading failure of large kernel modules (take 4) Ingo Molnar
2009-01-01 16:37 ` Andrew Morton
2008-12-31 17:39 ` Helge Deller
2008-12-31 18:24 ` James Bottomley
2008-12-31 22:16 ` Rusty Russell
2009-01-01 7:12 ` Jeremy Fitzhardinge
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=495CB0E3.70509@gmx.de \
--to=deller@gmx.de \
--cc=akpm@linux-foundation.org \
--cc=dave@hiauly1.hia.nrc.ca \
--cc=kyle@mcmartin.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=randolph@tausq.org \
--cc=rusty@rustcorp.com.au \
--cc=sam@ravnborg.org \
--cc=torvalds@linux-foundation.org \
/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