All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Daniel Drake <dsd@gentoo.org>
Cc: Andrew Morton <akpm@osdl.org>,
	zaitcev@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: percpu_modalloc oops when loading netfilter modules
Date: Mon, 01 Aug 2005 15:27:17 +1000	[thread overview]
Message-ID: <1122874037.7496.33.camel@localhost.localdomain> (raw)
In-Reply-To: <42EAC06A.5080807@gentoo.org>

On Sat, 2005-07-30 at 00:48 +0100, Daniel Drake wrote:
> Pete, Rusty,
> 
> I found a snippet of a previous discussion of yours here:
> 
> http://www.ussg.iu.edu/hypermail/linux/kernel/0408.3/2901.html
> http://www.ussg.iu.edu/hypermail/linux/kernel/0409.0/0768.html
> 
> Did anything become of this issue?
> 
> A Gentoo user has reported what appears to be the same problem on 2.6.12:
> http://bugs.gentoo.org/show_bug.cgi?id=97006

Name: Module per-cpu alignment cannot always be met.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (authored)

The module code assumes noone will ever ask for a per-cpu area more
than SMP_CACHE_BYTES aligned.  However, as these cases show, gcc asks
sometimes asks for 32-byte alignment for the per-cpu section on a
module, and if CONFIG_X86_L1_CACHE_SHIFT is 4, we hit that BUG_ON().
This is obviously an unusual combination, as there have been few
reports, but better to warn than die.

See:
	http://www.ussg.iu.edu/hypermail/linux/kernel/0409.0/0768.html

And more recently:
	http://bugs.gentoo.org/show_bug.cgi?id=97006

Index: linux-2.6.13-rc4-git3-Netfilter/kernel/module.c
===================================================================
--- linux-2.6.13-rc4-git3-Netfilter.orig/kernel/module.c	2005-08-01 14:58:44.000000000 +1000
+++ linux-2.6.13-rc4-git3-Netfilter/kernel/module.c	2005-08-01 15:21:30.000000000 +1000
@@ -250,13 +250,18 @@
 /* Created by linker magic */
 extern char __per_cpu_start[], __per_cpu_end[];
 
-static void *percpu_modalloc(unsigned long size, unsigned long align)
+static void *percpu_modalloc(unsigned long size, unsigned long align,
+			     const char *name)
 {
 	unsigned long extra;
 	unsigned int i;
 	void *ptr;
 
-	BUG_ON(align > SMP_CACHE_BYTES);
+	if (align > SMP_CACHE_BYTES) {
+		printk(KERN_WARNING "%s: per-cpu alignment %li > %i\n",
+		       name, align, SMP_CACHE_BYTES);
+		align = SMP_CACHE_BYTES;
+	}
 
 	ptr = __per_cpu_start;
 	for (i = 0; i < pcpu_num_used; ptr += block_size(pcpu_size[i]), i++) {
@@ -348,7 +353,8 @@
 }	
 __initcall(percpu_modinit);
 #else /* ... !CONFIG_SMP */
-static inline void *percpu_modalloc(unsigned long size, unsigned long align)
+static inline void *percpu_modalloc(unsigned long size, unsigned long align,
+				    const char *name)
 {
 	return NULL;
 }
@@ -1644,7 +1650,8 @@
 	if (pcpuindex) {
 		/* We have a special allocation for this section. */
 		percpu = percpu_modalloc(sechdrs[pcpuindex].sh_size,
-					 sechdrs[pcpuindex].sh_addralign);
+					 sechdrs[pcpuindex].sh_addralign,
+					 mod->name);
 		if (!percpu) {
 			err = -ENOMEM;
 			goto free_mod;

-- 
A bad analogy is like a leaky screwdriver -- Richard Braakman


      reply	other threads:[~2005-08-01  5:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-29 23:48 percpu_modalloc oops when loading netfilter modules Daniel Drake
2005-08-01  5:27 ` 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=1122874037.7496.33.camel@localhost.localdomain \
    --to=rusty@rustcorp.com.au \
    --cc=akpm@osdl.org \
    --cc=dsd@gentoo.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zaitcev@redhat.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 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.