Skip to contentSkip to conversation

2.6.31-rc7 : kernel BUG at drivers/rtc/rtc-ps3.c:36!

PATCH In review Sachin Sant 4 participants 7 messages Aug 24, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

While trying to boot 2.6.31-rc7 on a power6 machine came across the following Bug.

Starting udev: ------------[ cut here ]------------ kernel BUG at drivers/rtc/rtc-ps3.c:36!
cpu 0x0: Vector: 700 (Program Check) at [c0000000f70f3570]
pc: c00000000059a020: .ps3_get_time+0x3c/0x84
lr: c00000000059a018: .ps3_get_time+0x34/0x84
sp: c0000000f70f37f0
msr: 8000000000029032
current = 0xc0000000f8d14ee0
paca = 0xc0000000012cc300
pid = 159, comm = hwclock
kernel BUG at drivers/rtc/rtc-ps3.c:36!
enter ? for help
[c0000000f70f3890] c000000000593918 .rtc_read_time+0xac/0xe8 [c0000000f70f3930] c000000000594508 .rtc_dev_ioctl+0x358/0x5a4 [c0000000f70f3a40] c0000000001df868 .vfs_ioctl+0x70/0x10c [c0000000f70f3af0] c0000000001e00a0 .do_vfs_ioctl+0x6d8/0x748 [c0000000f70f3be0] c0000000001e0198 .SyS_ioctl+0x88/0xd0 [c0000000f70f3ca0] c000000000221fc8 .do_ioctl32_pointer+0x3c/0x5c [c0000000f70f3d40] c000000000226ef0 .compat_sys_ioctl+0x43c/0x4c4 [c0000000f70f3e30] c0000000000085f0 syscall_exit+0x0/0x40 --- Exception: c01 (System Call) at 000000000fee33e8
SP (ffe0c7d0) is in userspace
0:mon> 0:mon> di $.ps3_get_time

c000000000599fe4  7c0802a6      mflr    r0
c000000000599fe8  f8010010      std     r0,16(r1)
c000000000599fec  fb81ffe0      std     r28,-32(r1)
c000000000599ff0  fba1ffe8      std     r29,-24(r1)
c000000000599ff4  fbe1fff8      std     r31,-8(r1)
c000000000599ff8  f821ff61      stdu    r1,-160(r1)
c000000000599ffc  7c3f0b78      mr      r31,r1
c00000000059a000  7c9d2378      mr      r29,r4
c00000000059a004  60000000      nop
...
c00000000059a00c  387f0070      addi    r3,r31,112
c00000000059a010  389f0078      addi    r4,r31,120
c00000000059a014  4baf1235      bl      c00000000008b248        #
._lv1_get_rtc+0x0/0x3c
c00000000059a018  60000000      nop
c00000000059a01c  7c6307b4      extsw   r3,r3
c00000000059a020  0b030000      tdnei   r3,0
0:mon> 0:mon> r
R00 = c00000000059a018   R16 = 0000000000000000
R01 = c0000000f70f37f0   R17 = 00000000ffe0cb50
R02 = c000000001274d30   R18 = 0000000000000000
R03 = fffffffffffffffe   R19 = 0000000010020000
R04 = c0000000f70f3868   R20 = 0000000000000000
R05 = 0000000000000004   R21 = 0000000000033790
R06 = c0000000f70f39d4   R22 = 000000004a923592
R07 = 0000000000000000   R23 = 0000000000000001
R08 = 07c0000000000000   R24 = 0000000040247009
R09 = c00000000125d708   R25 = c000000000783208
R10 = c0000000f742cf80   R26 = ffffffffffffffea
R11 = c0000000f70f3868   R27 = c0000000f70f39b0
R12 = 0000000000004000   R28 = c0000000f742cd10
R13 = c0000000012cc300   R29 = c0000000f70f39b0
R14 = 0000000010019d40   R30 = c000000001213148
R15 = 00000000ffe0cc7b   R31 = c0000000f70f37f0

pc = c00000000059a020 .ps3_get_time+0x3c/0x84
lr = c00000000059a018 .ps3_get_time+0x34/0x84
msr = 8000000000029032 cr = 44222424
ctr = c000000000599fe4 xer = 0000000000000001 trap = 700
0:mon>

Corresponding c code is :

static u64 read_rtc(void)
{
....
result = lv1_get_rtc(&rtc_val, &tb_val);
BUG_ON(result);

I had never tried enabling CONFIG_RTC_DRV_PS3 option before so not sure if this is a new problem or an old one.

Thanks
-Sachin

Signature · 6 lines
---------------------------------
Sachin Sant
IBM Linux Technology Center
India Systems and Technology Labs
Bangalore, India
---------------------------------
#1 lore raw
Quoted 15 lines · Sachin Sant

While trying to boot 2.6.31-rc7 on a power6 machine came across the following Bug.

Starting udev: ------------[ cut here ]------------ kernel BUG at drivers/rtc/rtc-ps3.c:36!
cpu 0x0: Vector: 700 (Program Check) at [c0000000f70f3570]

    pc: c00000000059a020: .ps3_get_time+0x3c/0x84
    lr: c00000000059a018: .ps3_get_time+0x34/0x84
    sp: c0000000f70f37f0

msr: 8000000000029032
current = 0xc0000000f8d14ee0
paca = 0xc0000000012cc300
pid = 159, comm = hwclock
kernel BUG at drivers/rtc/rtc-ps3.c:36!

Quoted 8 lines

static u64 read_rtc(void)
{
....
result = lv1_get_rtc(&rtc_val, &tb_val);
BUG_ON(result);

I had never tried enabling CONFIG_RTC_DRV_PS3 option before so not sure if this is a new problem or an old one.

Looks like an old one, or at least as long as the driver has existed.

The code needs to cope with being called on something other than a PS3. Either the platform driver is only registered if the machine is a PS3, or ps3_rtc_probe() actually does something to check it's on a PS3 before registering the rtc_device.

cheers

#2 lore raw
Quoted 25 lines · Michael Ellerman
Quoted 15 lines · Sachin Sant

While trying to boot 2.6.31-rc7 on a power6 machine came across the following Bug.

Starting udev: ------------[ cut here ]------------ kernel BUG at drivers/rtc/rtc-ps3.c:36!
cpu 0x0: Vector: 700 (Program Check) at [c0000000f70f3570]

    pc: c00000000059a020: .ps3_get_time+0x3c/0x84
    lr: c00000000059a018: .ps3_get_time+0x34/0x84
    sp: c0000000f70f37f0

msr: 8000000000029032
current = 0xc0000000f8d14ee0
paca = 0xc0000000012cc300
pid = 159, comm = hwclock
kernel BUG at drivers/rtc/rtc-ps3.c:36!

Quoted 8 lines

static u64 read_rtc(void)
{
....
result = lv1_get_rtc(&rtc_val, &tb_val);
BUG_ON(result);

I had never tried enabling CONFIG_RTC_DRV_PS3 option before so not sure if this is a new problem or an old one.

Quoted 6 lines

Looks like an old one, or at least as long as the driver has existed.

The code needs to cope with being called on something other than a PS3. Either the platform driver is only registered if the machine is a PS3, or ps3_rtc_probe() actually does something to check it's on a PS3 before registering the rtc_device.

Bummer, how could we have missed that one? Cooking a patch...

With kind regards,

Geert Uytterhoeven
Software Architect
Techsoft Centre

Technology and Software Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone:    +32 (0)2 700 8453
Fax:      +32 (0)2 700 8622
E-mail:   [email protected]
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V. VAT BE 0413.825.160 · RPR Brussels Fortis · BIC GEBABEBB · IBAN BE41293037680010

#3 lore raw

PATCH 1/1 powerpc/ps3: Add missing check for PS3 to rtc-ps3 platform device registration

In reply to Michael Ellerman

On non-PS3, we get:

| kernel BUG at drivers/rtc/rtc-ps3.c:36!

because the rtc-ps3 platform device is registered unconditionally in a kernel with builtin support for PS3.

---
 arch/powerpc/platforms/ps3/time.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
arch/powerpc/platforms/ps3/time.c +4 -0
index b178a1e..40b5cb4 100644
@@ -21,6 +21,7 @@
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 
+#include <asm/firmware.h>
 #include <asm/rtc.h>
 #include <asm/lv1call.h>
 #include <asm/ps3.h>
@@ -84,6 +85,9 @@ static int __init ps3_rtc_init(void)
 {
 	struct platform_device *pdev;
 
+	if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
+		return -ENODEV;
+
 	pdev = platform_device_register_simple("rtc-ps3", -1, NULL, 0);
 	if (IS_ERR(pdev))
 		return PTR_ERR(pdev);
Signature · 19 lines
1.6.2.4

With kind regards,

Geert Uytterhoeven
Software Architect
Techsoft Centre

Technology and Software Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone:    +32 (0)2 700 8453
Fax:      +32 (0)2 700 8622
E-mail:   [email protected]
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 · RPR Brussels
Fortis · BIC GEBABEBB · IBAN BE41293037680010
author Tested-by on v1 1/1
#4 lore raw

Re: [PATCH for 2.6.31] powerpc/ps3: Add missing check for PS3 to rtc-ps3 platform device registration

Quoted 4 lines · Geert Uytterhoeven

On non-PS3, we get:

| kernel BUG at drivers/rtc/rtc-ps3.c:36!

Quoted 8 lines

because the rtc-ps3 platform device is registered unconditionally in a kernel with builtin support for PS3.

---
 arch/powerpc/platforms/ps3/time.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Thanks, boots fine now.

Regards
-Sachin

Signature · 6 lines
---------------------------------
Sachin Sant
IBM Linux Technology Center
India Systems and Technology Labs
Bangalore, India
---------------------------------
#5 lore raw

Re: [PATCH for 2.6.31] powerpc/ps3: Add missing check for PS3 to rtc-ps3 platform device registration

Quoted 9 lines · Sachin Sant
Quoted 8 lines · Geert Uytterhoeven

On non-PS3, we get:

| kernel BUG at drivers/rtc/rtc-ps3.c:36!

because the rtc-ps3 platform device is registered unconditionally in a kernel
with builtin support for PS3.

Quoted 8 lines
Quoted 5 lines
---
 arch/powerpc/platforms/ps3/time.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Thanks, boots fine now.

Thanks for testing! We want this for 2.6.30-stable, too.

With kind regards,

Geert Uytterhoeven
Software Architect
Techsoft Centre

Technology and Software Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone:    +32 (0)2 700 8453
Fax:      +32 (0)2 700 8622
E-mail:   [email protected]
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V. VAT BE 0413.825.160 · RPR Brussels Fortis · BIC GEBABEBB · IBAN BE41293037680010

Acked-by on v1 1/1
#6 lore raw

Re: [PATCH for 2.6.31] powerpc/ps3: Add missing check for PS3 to rtc-ps3 platform device registration

In reply to Geert Uytterhoeven
Quoted 4 lines · Geert Uytterhoeven

On non-PS3, we get:

| kernel BUG at drivers/rtc/rtc-ps3.c:36!

Quoted 8 lines

because the rtc-ps3 platform device is registered unconditionally in a kernel with builtin support for PS3.

---
 arch/powerpc/platforms/ps3/time.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)