Skip to contentSkip to conversation

crash in init_ipic_sysfs on efika

PATCH Olaf Hering 8 participants 21 messages Mar 17, 2008 – Mar 24, 2008 PowerPC

lore
Share & tools
lore
#0 lore raw

I cant reproduce this bug on my board, but:

The global primary_ipic in arch/powerpc/sysdev/ipic.c can remain NULL if ipic_init() fails. init_ipic_sysfs() will crash in that case.

Something like this may fix it:

arch/powerpc/sysdev/ipic.c +1 -1
Index: linux-2.6.25-rc6/arch/powerpc/sysdev/ipic.c
===================================================================
@@ -906,7 +906,7 @@ static int __init init_ipic_sysfs(void)
 {
        int rc;
 
-       if (!primary_ipic->regs)
+       if (!primary_ipic || !primary_ipic->regs)
                return -ENODEV;
        printk(KERN_DEBUG "Registering ipic with sysfs...\n");
 

ok boot eth:192.168.2.52,inst32 inst32 console=ttyPSC0,115200

SuSE Linux zImage starting: loaded at 00040000-00d24cbc (0/0/01003ed8;
sp: 017ffe80)
uncompressing ELF header done. (00000100 bytes)
Allocated 008584d4 bytes for kernel @ 02000000
Allocated 00a963a2 bytes for initrd @ 02859000 uncompressing kernel done. (004faeb8 bytes)
entering kernel at 02010000(2859000/a963a2/01003ed8)
OF stdout device is: /failsafe
command line: console=ttyPSC0,115200
memory layout at init:
alloc_bottom : 032f0000
alloc_top : 30000000
alloc_top_hi : f000c000
rmo_top : 30000000
ram_top : f000c000
Looking for displays
instantiating rtas at 0x07ffb000 ... done
Applying EFIKA device tree fixups
Fixing bestcomm interrupts property
Adding Ethernet MDIO node
Adding Ethernet PHY node
copying OF device tree ...
Building dt strings...
Building dt structure...
Device tree strings 0x032f1000 -> 0x032f17e0
Device tree struct 0x032f2000 -> 0x03315000
Calling quiesce ...
returning from prom_init
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes) Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 113264k/131072k available (4808k kernel code, 17648k reserved, 164k data, 461k bss, 228k init)
Security Framework initialized
AppArmor: AppArmor initialized
AppArmor: Unable to log event (1505) to audit subsys
AppArmor: Registered secondary security module name="capability"
AppArmor: Unable to log event (1505) to audit subsys Capability LSM initialized as secondary
Failure registering Root Plug module with the kernel
AppArmor: Unable to register %s as a secondary security module name="root_plug"
AppArmor: Unable to log event (1505) to audit subsys Failure registering Root Plug module with primary security module. Mount-cache hash table entries: 512
net_namespace: 544 bytes
NET: Registered protocol family 16
PCI: Probing PCI hardware
DMA: MPC52xx BestComm driver
DMA: MPC52xx BestComm engine @f0001200 ok !

Unable to handle kernel paging request for data at address 0x00000000
Faulting instruction address: 0xc0486aac
Oops: Kernel access of bad area, sig: 11 [#1]
Efika
Modules linked in:
NIP: c0486aac LR: c0479200 CTR: c0486a90
REGS: c782bea0 TRAP: 0300   Not tainted  (2.6.25-rc5-git2-5-default)
MSR: 00009032 <EE,ME,IR,DR>  CR: 44002082  XER: 20000000
DAR: 00000000, DSISR: 20000000

TASK = c78237c0[1] 'swapper' THREAD: c782a000
GPR00: c0479200 c782bf50 c78237c0 ffffffed 00000003 00000000 00000000 00000000
GPR08: fffffffc 00000000 c7800780 000f06a0 22002022 dffffff7 c0405540 c0405558
GPR16: c0405568 c040558c c0405594 c04055a4 c04055d0 c0400000 024184a4 ffffffff
GPR24: 00000000 c04a6468 c0405550 c782a000 c04e0000 00000000 00000000 c04af198
NIP [c0486aac] init_ipic_sysfs+0x1c/0x90
LR [c0479200] kernel_init+0xf8/0x2a0

Call Trace:
[c782bf50] [c04869fc] mpc52xx_bcom_init+0x24/0x34 (unreliable)
[c782bf60] [c0479200] kernel_init+0xf8/0x2a0
[c782bff0] [c001330c] kernel_thread+0x44/0x60
Instruction dump:
80010024 bb61000c 38210020 7c0803a6 4e800020 9421fff0 7c0802a6 3d20c04f
3860ffed 90010014 93e1000c 81299730 <80090000> 2f800000 41be0058 3c60c041
---[ end trace 8640abe69a316dee ]---
Kernel panic - not syncing: Attempted to kill init!

Rebooting in 180 seconds..

#1 lore raw
Quoted 6 lines · Olaf Hering

I cant reproduce this bug on my board, but:

The global primary_ipic in arch/powerpc/sysdev/ipic.c can remain NULL if ipic_init() fails. init_ipic_sysfs() will crash in that case.

Something like this may fix it:

Is this needed for 2.6.25? Is the system at all usable if ipic_init fails?

Paul.

#3 lore raw
In reply to Olaf Hering
Quoted 10 lines · Olaf Hering

The global primary_ipic in arch/powerpc/sysdev/ipic.c can remain NULL if ipic_init() fails. init_ipic_sysfs() will crash in that case.

Something like this may fix it:

Index: linux-2.6.25-rc6/arch/powerpc/sysdev/ipic.c
===================================================================

arch/powerpc/sysdev/ipic.c static int __init init_ipic_sysfs(void) · line 911

Quoted 7 lines
arch/powerpc/sysdev/ipic.c +1 -1
@@ -906,7 +906,7 @@ static int __init init_ipic_sysfs(void)
 {
        int rc;
 
-       if (!primary_ipic->regs)
+       if (!primary_ipic || !primary_ipic->regs)
                return -ENODEV;
        printk(KERN_DEBUG "Registering ipic with sysfs...\n");

ipic_init() is not called for every board.
This change for the used config fixes the crash as well.

@@ -168,14 +168,14 @@ CONFIG_PPC_MULTIPLATFORM=y
# CONFIG_PPC_86xx is not set
CONFIG_CLASSIC32=y
CONFIG_PPC_CHRP=y
-CONFIG_PPC_MPC512x=y
-CONFIG_PPC_MPC5121=y
-CONFIG_MPC5121_ADS=y
+# CONFIG_PPC_MPC512x is not set
+# CONFIG_PPC_MPC5121 is not set
+# CONFIG_MPC5121_ADS is not set
CONFIG_PPC_MPC52xx=y
-CONFIG_PPC_MPC5200_SIMPLE=y
+# CONFIG_PPC_MPC5200_SIMPLE is not set
CONFIG_PPC_EFIKA=y
# CONFIG_PPC_LITE5200 is not set
-CONFIG_PPC_MPC5200_BUGFIX=y
+# CONFIG_PPC_MPC5200_BUGFIX is not set
CONFIG_PPC_PMAC=y
# CONFIG_PPC_CELL is not set
# CONFIG_PPC_CELL_NATIVE is not set

#2 lore raw
In reply to Paul Mackerras
Quoted 11 lines · Paul Mackerras
Quoted 6 lines · Olaf Hering

I cant reproduce this bug on my board, but:

The global primary_ipic in arch/powerpc/sysdev/ipic.c can remain NULL if ipic_init() fails. init_ipic_sysfs() will crash in that case.

Something like this may fix it:

Is this needed for 2.6.25? Is the system at all usable if ipic_init fails?

CONFIG_PPC_MPC51* needs to be disabled for pmac/chrp/bplan .configs.

A full featured ppc32_defconfig will probably catch such errors.

#4 lore raw
In reply to Olaf Hering

This was a good catch. IPIC is the controller on the MPC83xx type boards (and MPC5121E) so building a kernel with this controller code in there, but without the controller present, should gladly fail.

However removing the boards from the config does not fix this obvious error. I like your patch better than changing the config options to disable entire swathes of board support :D

What I'm concerned about is that the IPIC code is registering with sysfs even though there is no controller present. How on EARTH does it even get that far? If ipic_init fails, no further code should be run from this file, in my view.

subsys_initcall(init_ipic_sysfs); <-- this, in my eyes, is the culprit. If init_ipic() runs, init_ipic_sysfs should be called from that, not left for some further subsystem to blindly try and register sysfs nodes for devices which may not even be present..

I'd love someone to explain to me how this works and why, and why it isn't braindead? :D

Signature · 2 lines
Matt Sealey <[email protected]>
Genesi, Manager, Developer Relations
Quoted 49 lines · Olaf Hering
Quoted 10 lines · Olaf Hering

The global primary_ipic in arch/powerpc/sysdev/ipic.c can remain NULL if ipic_init() fails. init_ipic_sysfs() will crash in that case.

Something like this may fix it:

Index: linux-2.6.25-rc6/arch/powerpc/sysdev/ipic.c
===================================================================

arch/powerpc/sysdev/ipic.c static int __init init_ipic_sysfs(void) · line 911

Quoted 7 lines
arch/powerpc/sysdev/ipic.c +1 -1
@@ -906,7 +906,7 @@ static int __init init_ipic_sysfs(void)
 {
        int rc;
 
-       if (!primary_ipic->regs)
+       if (!primary_ipic || !primary_ipic->regs)
                return -ENODEV;
        printk(KERN_DEBUG "Registering ipic with sysfs...\n");

ipic_init() is not called for every board.
This change for the used config fixes the crash as well.

(quoted diff) +5 -5
@@ -168,14 +168,14 @@ CONFIG_PPC_MULTIPLATFORM=y
 # CONFIG_PPC_86xx is not set
 CONFIG_CLASSIC32=y
 CONFIG_PPC_CHRP=y
-CONFIG_PPC_MPC512x=y
-CONFIG_PPC_MPC5121=y
-CONFIG_MPC5121_ADS=y
+# CONFIG_PPC_MPC512x is not set
+# CONFIG_PPC_MPC5121 is not set
+# CONFIG_MPC5121_ADS is not set
 CONFIG_PPC_MPC52xx=y
-CONFIG_PPC_MPC5200_SIMPLE=y
+# CONFIG_PPC_MPC5200_SIMPLE is not set
 CONFIG_PPC_EFIKA=y
 # CONFIG_PPC_LITE5200 is not set
-CONFIG_PPC_MPC5200_BUGFIX=y
+# CONFIG_PPC_MPC5200_BUGFIX is not set
 CONFIG_PPC_PMAC=y
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

#6 lore raw
In reply to Olaf Hering
Quoted 13 lines · Olaf Hering

I cant reproduce this bug on my board, but:

The global primary_ipic in arch/powerpc/sysdev/ipic.c can remain NULL if ipic_init() fails. init_ipic_sysfs() will crash in that case.

Something like this may fix it:

Index: linux-2.6.25-rc6/arch/powerpc/sysdev/ipic.c
===================================================================

arch/powerpc/sysdev/ipic.c static int __init init_ipic_sysfs(void) · line 911

Quoted 7 lines
arch/powerpc/sysdev/ipic.c +1 -1
@@ -906,7 +906,7 @@ static int __init init_ipic_sysfs(void)
 {
       int rc;
 
-       if (!primary_ipic->regs)
+       if (!primary_ipic || !primary_ipic->regs)
               return -ENODEV;
       printk(KERN_DEBUG "Registering ipic with sysfs...\n");

We should look and see if we can change init_ipic_sysfs() from a subsys_initcall() to just getting called at the end of ipic_init().

- k

#7 lore raw
Quoted 2 lines · Kumar Gala

We should look and see if we can change init_ipic_sysfs() from a subsys_initcall() to just getting called at the end of ipic_init().

If init_ipic is called from init_IRQ then I would expect that's way too early to be calling sysfs stuff.

Paul.

#8 lore raw
In reply to Olaf Hering
Quoted 13 lines · Olaf Hering

I cant reproduce this bug on my board, but:

The global primary_ipic in arch/powerpc/sysdev/ipic.c can remain NULL if ipic_init() fails. init_ipic_sysfs() will crash in that case.

Something like this may fix it:

Index: linux-2.6.25-rc6/arch/powerpc/sysdev/ipic.c
===================================================================
--- linux-2.6.25-rc6.orig/arch/powerpc/sysdev/ipic.c +++ linux-2.6.25-rc6/arch/powerpc/sysdev/ipic.c @@ -906,7 +906,7 @@ static int __init init_ipic_sysfs(void)

Quoted 7 lines
  {
        int rc;

- if (!primary_ipic->regs)
+ if (!primary_ipic || !primary_ipic->regs)

                return -ENODEV;
        printk(KERN_DEBUG "Registering ipic with sysfs...\n");

Confirmed, this patch fixes the problem. Paulus or Kumar, can you please pick it up for .25?

Thanks,
g.

Quoted 90 lines

ok boot eth:192.168.2.52,inst32 inst32 console=ttyPSC0,115200

SuSE Linux zImage starting: loaded at 00040000-00d24cbc (0/0/01003ed8;
sp: 017ffe80)
uncompressing ELF header done. (00000100 bytes)
Allocated 008584d4 bytes for kernel @ 02000000
Allocated 00a963a2 bytes for initrd @ 02859000 uncompressing kernel done. (004faeb8 bytes)
entering kernel at 02010000(2859000/a963a2/01003ed8)
OF stdout device is: /failsafe
command line: console=ttyPSC0,115200
memory layout at init:
alloc_bottom : 032f0000
alloc_top : 30000000
alloc_top_hi : f000c000
rmo_top : 30000000
ram_top : f000c000
Looking for displays
instantiating rtas at 0x07ffb000 ... done
Applying EFIKA device tree fixups
Fixing bestcomm interrupts property
Adding Ethernet MDIO node
Adding Ethernet PHY node
copying OF device tree ...
Building dt strings...
Building dt structure...
Device tree strings 0x032f1000 -> 0x032f17e0
Device tree struct 0x032f2000 -> 0x03315000
Calling quiesce ...
returning from prom_init
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes) Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 113264k/131072k available (4808k kernel code, 17648k reserved, 164k data, 461k bss, 228k init)
Security Framework initialized
AppArmor: AppArmor initialized
AppArmor: Unable to log event (1505) to audit subsys
AppArmor: Registered secondary security module name="capability"
AppArmor: Unable to log event (1505) to audit subsys Capability LSM initialized as secondary
Failure registering Root Plug module with the kernel
AppArmor: Unable to register %s as a secondary security module name="root_plug"
AppArmor: Unable to log event (1505) to audit subsys Failure registering Root Plug module with primary security module. Mount-cache hash table entries: 512
net_namespace: 544 bytes
NET: Registered protocol family 16
PCI: Probing PCI hardware
DMA: MPC52xx BestComm driver
DMA: MPC52xx BestComm engine @f0001200 ok !

 Unable to handle kernel paging request for data at address 0x00000000
 Faulting instruction address: 0xc0486aac
 Oops: Kernel access of bad area, sig: 11 [#1]
 Efika
 Modules linked in:
 NIP: c0486aac LR: c0479200 CTR: c0486a90
 REGS: c782bea0 TRAP: 0300   Not tainted  (2.6.25-rc5-git2-5-default)
 MSR: 00009032 <EE,ME,IR,DR>  CR: 44002082  XER: 20000000
 DAR: 00000000, DSISR: 20000000
 TASK = c78237c0[1] 'swapper' THREAD: c782a000
 GPR00: c0479200 c782bf50 c78237c0 ffffffed 00000003 00000000 00000000
 00000000
 GPR08: fffffffc 00000000 c7800780 000f06a0 22002022 dffffff7 c0405540
 c0405558
 GPR16: c0405568 c040558c c0405594 c04055a4 c04055d0 c0400000 024184a4
 ffffffff
 GPR24: 00000000 c04a6468 c0405550 c782a000 c04e0000 00000000 00000000
 c04af198
 NIP [c0486aac] init_ipic_sysfs+0x1c/0x90
 LR [c0479200] kernel_init+0xf8/0x2a0
 Call Trace:
 [c782bf50] [c04869fc] mpc52xx_bcom_init+0x24/0x34 (unreliable)
 [c782bf60] [c0479200] kernel_init+0xf8/0x2a0
 [c782bff0] [c001330c] kernel_thread+0x44/0x60
 Instruction dump:
 80010024 bb61000c 38210020 7c0803a6 4e800020 9421fff0 7c0802a6 3d20c04f
 3860ffed 90010014 93e1000c 81299730 <80090000> 2f800000 41be0058 3c60c041
 ---[ end trace 8640abe69a316dee ]---
 Kernel panic - not syncing: Attempted to kill init!
 Rebooting in 180 seconds..

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#9 lore raw
Quoted 2 lines · Grant Likely

Confirmed, this patch fixes the problem. Paulus or Kumar, can you please pick it up for .25?

Sure, will do. I thought about putting it in the last batch but I wanted an ack from you.

Anyone else got any last-minute things for 2.6.25?

Paul.

#10 lore raw
Quoted 9 lines · Paul Mackerras
Quoted 2 lines · Grant Likely

Confirmed, this patch fixes the problem. Paulus or Kumar, can you please pick it up for .25?

Sure, will do. I thought about putting it in the last batch but I wanted an ack from you.

Anyone else got any last-minute things for 2.6.25?

since you are going to send something to linus let me update the fsl defconfigs and send you a pull request.

- k

#5 lore raw
In reply to Matt Sealey
Quoted 7 lines · Matt Sealey

subsys_initcall(init_ipic_sysfs); <-- this, in my eyes, is the culprit. If init_ipic() runs, init_ipic_sysfs should be called from that, not left for some further subsystem to blindly try and register sysfs nodes for devices which may not even be present..

I'd love someone to explain to me how this works and why, and why it isn't braindead? :D

init_ipic() is called way too early to be able to manpipulate sysfs.

Ben.

#13 lore raw
In reply to Paul Mackerras

Is the MPC5200B PSC-AC97 driver in there?

Signature · 2 lines
Matt Sealey <[email protected]>
Genesi, Manager, Developer Relations
Quoted 15 lines · Paul Mackerras
Quoted 2 lines · Grant Likely

Confirmed, this patch fixes the problem. Paulus or Kumar, can you please pick it up for .25?

Sure, will do. I thought about putting it in the last batch but I wanted an ack from you.

Anyone else got any last-minute things for 2.6.25?

Paul.
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

#14 lore raw
Quoted 1 line · Matt Sealey

Is the MPC5200B PSC-AC97 driver in there?

Audio drivers need to go in via one of the ALSA developers and I haven't been paying close enough attention to know if it has not in yet.

g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#15 lore raw
Quoted 6 lines · Grant Likely
Quoted 1 line · Matt Sealey

Is the MPC5200B PSC-AC97 driver in there?

Audio drivers need to go in via one of the ALSA developers and I haven't been paying close enough attention to know if it has not in yet.

BTW, it was reported to me that the ethernet drivers don't get autoloaded by udev. Is this a failure of udev missing the of_plateform support, or a deficiency of the ethernet drivers ?

Friendly,

Sven Luther

#16 lore raw
Quoted 3 lines · Sven Luther

BTW, it was reported to me that the ethernet drivers don't get autoloaded by udev. Is this a failure of udev missing the of_plateform support, or a deficiency of the ethernet drivers ?

As far as I know, they _are_ being loaded properly. Otherwise, the Fedora installer wouldn't work.

Signature · 1 line
dwmw2
#17 lore raw
Quoted 7 lines · David Woodhouse
Quoted 3 lines · Sven Luther

BTW, it was reported to me that the ethernet drivers don't get autoloaded by udev. Is this a failure of udev missing the of_plateform support, or a deficiency of the ethernet drivers ?

As far as I know, they _are_ being loaded properly. Otherwise, the Fedora installer wouldn't work.

Yes, but you probably have the of_plateform udev patch, no ?

Friendly,

Sven Luther

#18 lore raw
Quoted 10 lines · Sven Luther
Quoted 7 lines · David Woodhouse
Quoted 3 lines · Sven Luther

BTW, it was reported to me that the ethernet drivers don't get autoloaded by udev. Is this a failure of udev missing the of_plateform support, or a deficiency of the ethernet drivers ?

As far as I know, they _are_ being loaded properly. Otherwise, the Fedora installer wouldn't work.

Yes, but you probably have the of_plateform udev patch, no ?

Not any more. That was merged a while ago, wasn't it?

Signature · 1 line
dwmw2
#19 lore raw
Quoted 7 lines · David Woodhouse
Quoted 6 lines · Sven Luther
Quoted 5 lines · David Woodhouse
Quoted 3 lines · Sven Luther

BTW, it was reported to me that the ethernet drivers don't get autoloaded by udev. Is this a failure of udev missing the of_plateform support, or a deficiency of the ethernet drivers ?

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

As far as I know, they _are_ being loaded properly. Otherwise, the Fedora installer wouldn't work.

Yes, but you probably have the of_plateform udev patch, no ?

Not any more. That was merged a while ago, wasn't it?

So, the only explanation would be if debian had a very outdated udev which does not include this patch.

Friendly,

Sven Luther

#11 lore raw
In reply to Kumar Gala
Quoted 2 lines · Kumar Gala

since you are going to send something to linus let me update the fsl defconfigs and send you a pull request.

OK -- I'm about to send Linus a pull request now in case he feels like releasing 2.6.25 this weekend. I'll send him another pull request with your defconfig update and whatever else has turned up when I get your pull request.

Paul.

#20 lore raw
In reply to Grant Likely

My assessment of the situation is: not at all.

Signature · 2 lines
Matt Sealey <[email protected]>
Genesi, Manager, Developer Relations
Quoted 10 lines · Grant Likely
Quoted 1 line · Matt Sealey

Is the MPC5200B PSC-AC97 driver in there?

Audio drivers need to go in via one of the ALSA developers and I haven't been paying close enough attention to know if it has not in yet.

g.

#12 lore raw
In reply to Paul Mackerras
Quoted 9 lines · Paul Mackerras
Quoted 2 lines · Kumar Gala

since you are going to send something to linus let me update the fsl defconfigs and send you a pull request.

OK -- I'm about to send Linus a pull request now in case he feels like releasing 2.6.25 this weekend. I'll send him another pull request with your defconfig update and whatever else has turned up when I get your pull request.

ok and sent you a pull request.

- k