2004-10-16 16:51:10

by martin f krafft

[permalink] [raw]
Subject: XFS oops on loading the module

I just tried to mount an XFS filesystem on this AMD K6 machine,
booted with the 2.6.8 kernel for FAI
(http://www.informatik.uni/koeln.de/fai) (let me know if you need
any information about it), and modprobe segfaults with a kernel bug.
Have you seen this before? Thanks!

sh-2.05b# modprobe xfs
Segmentation fault
------------[ cut here ]------------
kernel BUG at kernel/module.c:264!
invalid operand: 0000 [#1]
SMP
Modules linked in: ext3 jbd mbcache sr_mod sd_mod scsi_mod ide_generic usbmouse usbhid ide_cd cdrom usbkbd floppy rtc via82cxxx slc90e66 sis5513 siimage serverworks rz1000 piix pdc202xx_old pdc202xx_new hpt366 ide_disk hpt34x cs5530 cmd64x amd74xx alim15x3 aec62xx ide_core uhci_hcd usbcore
CPU: 0
EIP: 0060:[<c012bcf6>] Not tainted
EFLAGS: 00010202 (2.6.8-fai)
EIP is at percpu_modalloc+0xe/0xf8
eax: 0000004b ebx: e09f9400 ecx: e09f940c edx: 0000000f
esi: e09f84c4 edi: 00000258 ebp: e09fa9c8 esp: d9963f0c
ds: 007b es: 007b ss: 0068
Process modprobe (pid: 1272, threadinfo=d9962000 task=dfb50650)
Stack: e09f9400 e09f84c4 00000258 e09fa9c8 c012d8be e098f000 c012d8ed 00000148
00000020 40157000 080509b8 c031f504 d9962000 c416c0a0 00000044 00000060
df0ad4e0 00000000 00000000 e09f9400 0000000f 00000000 00000000 00000000
Call Trace:
[<c012d8be>] load_module+0x3c6/0x904
[<c012d8ed>] load_module+0x3f5/0x904
[<c012de59>] sys_init_module+0x5d/0x200
[<c0105d5f>] syscall_call+0x7/0xb
Code: 0f 0b 08 01 6f a5 2b c0 89 f6 bd a0 10 40 c0 31 f6 a1 2c 64

--
martin; (greetings from the heart of the sun.)
\____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck

invalid/expired pgp subkeys? use subkeys.pgp.net as keyserver!
spamtraps: [email protected]

because light travels faster than sound,
some people appear to be intelligent,
until you hear them speak.


Attachments:
(No filename) (1.81 kB)
signature.asc (189.00 B)
Digital signature
Download all attachments

2004-10-19 00:51:24

by Nathan Scott

[permalink] [raw]
Subject: Re: XFS oops on loading the module

Hi there,

On Sat, Oct 16, 2004 at 06:50:58PM +0200, martin f krafft wrote:
> I just tried to mount an XFS filesystem on this AMD K6 machine,
> booted with the 2.6.8 kernel for FAI
> (http://www.informatik.uni/koeln.de/fai) (let me know if you need
> any information about it), and modprobe segfaults with a kernel bug.
> Have you seen this before? Thanks!
>
> sh-2.05b# modprobe xfs
> Segmentation fault
> ------------[ cut here ]------------
> kernel BUG at kernel/module.c:264!

IOW... this, I guess:

for (i = 0; i < pcpu_num_used; ptr += block_size(pcpu_size[i]), i++) {
/* Extra for alignment requirement. */
extra = ALIGN((unsigned long)ptr, align) - (unsigned long)ptr;
BUG_ON(i == 0 && extra != 0);

> Modules linked in: ext3 jbd mbcache sr_mod sd_mod scsi_mod ide_generic usbmouse usbhid ide_cd cdrom usbkbd floppy rtc via82cxxx slc90e66 sis5513 siimage serverworks rz1000 piix pdc202xx_old pdc202xx_new hpt366 ide_disk hpt34x cs5530 cmd64x amd74xx alim15x3 aec62xx ide_core uhci_hcd usbcore
> CPU: 0
> EIP: 0060:[<c012bcf6>] Not tainted
> EFLAGS: 00010202 (2.6.8-fai)
> EIP is at percpu_modalloc+0xe/0xf8
> eax: 0000004b ebx: e09f9400 ecx: e09f940c edx: 0000000f
> esi: e09f84c4 edi: 00000258 ebp: e09fa9c8 esp: d9963f0c
> ds: 007b es: 007b ss: 0068
> Process modprobe (pid: 1272, threadinfo=d9962000 task=dfb50650)
> Stack: e09f9400 e09f84c4 00000258 e09fa9c8 c012d8be e098f000 c012d8ed 00000148
> 00000020 40157000 080509b8 c031f504 d9962000 c416c0a0 00000044 00000060
> df0ad4e0 00000000 00000000 e09f9400 0000000f 00000000 00000000 00000000
> Call Trace:
> [<c012d8be>] load_module+0x3c6/0x904
> [<c012d8ed>] load_module+0x3f5/0x904
> [<c012de59>] sys_init_module+0x5d/0x200
> [<c0105d5f>] syscall_call+0x7/0xb
> Code: 0f 0b 08 01 6f a5 2b c0 89 f6 bd a0 10 40 c0 31 f6 a1 2c 64
>

I haven't come across this before - the only percpu variables
in XFS are the performance stats. I've CC'd a couple of people
who may have more of a clue as to whats gone wrong here.

cheers.

--
Nathan

2004-10-19 06:06:16

by Rusty Russell

[permalink] [raw]
Subject: Re: XFS oops on loading the module

On Tue, 2004-10-19 at 10:49, Nathan Scott wrote:
> Hi there,
>
> On Sat, Oct 16, 2004 at 06:50:58PM +0200, martin f krafft wrote:
> > I just tried to mount an XFS filesystem on this AMD K6 machine,
> > booted with the 2.6.8 kernel for FAI
> > (http://www.informatik.uni/koeln.de/fai) (let me know if you need
> > any information about it), and modprobe segfaults with a kernel bug.
> > Have you seen this before? Thanks!
> >
> > sh-2.05b# modprobe xfs
> > Segmentation fault
> > ------------[ cut here ]------------
> > kernel BUG at kernel/module.c:264!
>
> IOW... this, I guess:
>
> for (i = 0; i < pcpu_num_used; ptr += block_size(pcpu_size[i]), i++) {
> /* Extra for alignment requirement. */
> extra = ALIGN((unsigned long)ptr, align) - (unsigned long)ptr;
> BUG_ON(i == 0 && extra != 0);

Somehow, your per-cpu section was not aligned sufficiently for this
alignment request. Since you passed the BUG_ON(align > SMP_CACHE_BYTES)
above, it implies that your per-cpu section isn't correctly aligned.

Does this fix it?

Name: Align per-cpu Section Correctly
Status: Untested
Signed-off-by: Rusty Russell <[email protected]>

The per-cpu section must be aligned to a cacheline: it's currently
aligned to a hardcoded 32 bytes on x86, which is wrong in some
configs. On x86 the .data.cacheline_aligned is also 32-byte aligned,
which seems wrong too.

We can't use SMP_CACHE_BYTES because we can't include linux/cache.h
from asm.

Other archs need similar changes.

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26520-linux-2.6.9-rc4-bk2/arch/i386/kernel/vmlinux.lds.S .26520-linux-2.6.9-rc4-bk2.updated/arch/i386/kernel/vmlinux.lds.S
--- .26520-linux-2.6.9-rc4-bk2/arch/i386/kernel/vmlinux.lds.S 2004-10-11 15:16:58.000000000 +1000
+++ .26520-linux-2.6.9-rc4-bk2.updated/arch/i386/kernel/vmlinux.lds.S 2004-10-19 12:45:54.000000000 +1000
@@ -5,6 +5,7 @@
#include <asm-generic/vmlinux.lds.h>
#include <asm/thread_info.h>
#include <asm/page.h>
+#include <asm/cache.h>

OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
@@ -47,7 +48,7 @@ SECTIONS
. = ALIGN(4096);
.data.page_aligned : { *(.data.idt) }

- . = ALIGN(32);
+ . = ALIGN(L1_CACHE_BYTES);
.data.cacheline_aligned : { *(.data.cacheline_aligned) }

_edata = .; /* End of data section */
@@ -96,7 +97,7 @@ SECTIONS
__initramfs_start = .;
.init.ramfs : { *(.init.ramfs) }
__initramfs_end = .;
- . = ALIGN(32);
+ . = ALIGN(L1_CACHE_BYTES);
__per_cpu_start = .;
.data.percpu : { *(.data.percpu) }
__per_cpu_end = .;

--
Anyone who quotes me in their signature is an idiot -- Rusty Russell