Skip to contentSkip to conversation

BBC I2C doesn't work on V880

DISCUSSION Patrick Finnegan 2 participants 4 messages Dec 2, 2009 – Jan 17, 2010 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

Going through the remaining problems I'm having with my V880, it looks like the SPARC bbc i2c driver won't load. This is with Linus's git tree from a few days ago. When I do a "modprobe bbc", I get this:

[ 3735.308284] i2c-0: Regs at 000007fc7e00002e, 2 devices, own a0, clock 10.
[ 3735.388677] bbc_i2c: probe of f00bd100 failed with error -22
[ 3735.456691] i2c-0: Regs at 000007fc7e50002e, 8 devices, own a0, clock 10.
[ 3735.537696] bbc_i2c: probe of f00cd000 failed with error -22

And, when I try to rmmod bbc, I get a kernel NULL pointer bug:

[ 3878.082842] Unable to handle kernel NULL pointer dereference                 
[ 3878.149656] tsk->{mm,active_mm}->context = 00000000000008f9
[ 3878.216303] tsk->{mm,active_mm}->pgd = fffff8d0fd78e000
[ 3878.278804]               \|/ ____ \|/
[ 3878.278808]               "@'/ .. \`@"
[ 3878.278813]               /_| \__/ |_\
[ 3878.278817]                  \__U_/
[ 3878.454861] rmmod(2401): Oops [#1]
[ 3878.495484] TSTATE: 0000000011001601 TPC: 00000000101f45f4 TNPC: 00000000101f463c Y: 00000000    
Not tainted
[ 3878.613208] TPC: <bbc_envctrl_cleanup+0x34/0xfc [bbc]>
[ 3878.674650] g0: fffff8c004701b20 g1: 0000000000400400 g2: 000000000088b000 g3: 
000000000000000b
[ 3878.778825] g4: fffff8d0fb25e6c0 g5: fffff8c003b34000 g6: fffff8d0fb6e4000 g7: 
000000000000002c
[ 3878.882985] o0: 0000000000000000 o1: fffff8d0fe2c5260 o2: 0000000000000001 o3: 
fffff8d0fe2c5260
[ 3878.987153] o4: 0000000000000000 o5: 0000000000000000 sp: fffff8d0fb6e7101 ret_pc: 
0000000000550410
[ 3879.095513] RPC: <release_sysfs_dirent+0xc8/0xe4>
[ 3879.151849] l0: 0000000000000000 l1: fffff8d0fe2c5260 l2: fffff8c0ffb91208 l3: 
0000000000100100
[ 3879.255911] l4: 0000000000200200 l5: 0000000000000000 l6: fffff8c004701b20 l7: 
0000000000000000
[ 3879.360087] i0: fffff8c0ffb911c0 i1: fffff8d0fab5edb0 i2: 0000000000000001 i3: 
fffff8d0fe2c5260
[ 3879.464249] i4: 0000000000000001 i5: fffff8d0fbe5cae8 i6: fffff8d0fb6e71c1 i7: 
00000000101f5328
[ 3879.568419] I7: <bbc_i2c_remove+0xc/0x5c [bbc]>
[ 3879.622590] Disabling lock debugging due to kernel taint
[ 3879.686132] Caller[00000000101f5328]: bbc_i2c_remove+0xc/0x5c [bbc]
[ 3879.761137] Caller[00000000006939dc]: of_platform_device_remove+0x1c/0x2c
[ 3879.842394] Caller[0000000000607200]: __device_release_driver+0x6c/0xac
[ 3879.921562] Caller[00000000006072c0]: driver_detach+0x80/0xb4
[ 3879.990303] Caller[0000000000606438]: bus_remove_driver+0x98/0xd0
[ 3880.063228] Caller[0000000000490368]: SyS_delete_module+0x1c0/0x234
[ 3880.138230] Caller[0000000000406214]: linux_sparc_syscall32+0x34/0x40
[ 3880.215314] Caller[000000000001154c]: 0x1154c
[ 3880.267386] Instruction DUMP: a9307001  a7307002  10680013 <e25c0000> c25c0000  c2708000  

c4706008 c45c2018 c25c2010

I still have the prtconf output available up at:

http://ned.cc.purdue.edu/prtconf-v880

Any suggestions?

Thanks,

Pat

Signature · 2 lines
Purdue University Research Computing ---  http://www.rcac.purdue.edu/
The Computer Refuge                  ---  http://computer-refuge.org
maintainer
#1 lore raw

From: Patrick Finnegan <[email protected]>
Date: Wed, 2 Dec 2009 11:05:03 -0500

Quoted 10 lines

Going through the remaining problems I'm having with my V880, it looks like the SPARC bbc i2c driver won't load. This is with Linus's git tree from a few days ago. When I do a "modprobe bbc", I get this:

[ 3735.308284] i2c-0: Regs at 000007fc7e00002e, 2 devices, own a0, clock 10.
[ 3735.388677] bbc_i2c: probe of f00bd100 failed with error -22
[ 3735.456691] i2c-0: Regs at 000007fc7e50002e, 8 devices, own a0, clock 10.
[ 3735.537696] bbc_i2c: probe of f00cd000 failed with error -22

And, when I try to rmmod bbc, I get a kernel NULL pointer bug:

Yes I know it has a lot of problems. I'll try to look into it when I get a chance.

Quoted 3 lines

I still have the prtconf output available up at:

http://ned.cc.purdue.edu/prtconf-v880

BTW, I added this to our prtconf repo at:

git://git.kernel.org/pub/scm/linux/kernel/git/davem/prtconfs.git

so that we can refer to it in the future.

Thanks for your report. I'll see what I can do.

maintainer
#2 lore raw
In reply to Patrick Finnegan

From: Patrick Finnegan <[email protected]>
Date: Wed, 2 Dec 2009 11:05:03 -0500

Quoted 4 lines

Going through the remaining problems I'm having with my V880, it looks like the SPARC bbc i2c driver won't load. This is with Linus's git tree from a few days ago. When I do a "modprobe bbc", I get this:

Quoted 8 lines
[ 3735.308284] i2c-0: Regs at 000007fc7e00002e, 2 devices, own a0, clock 10.
[ 3735.388677] bbc_i2c: probe of f00bd100 failed with error -22
[ 3735.456691] i2c-0: Regs at 000007fc7e50002e, 8 devices, own a0, clock 10.
[ 3735.537696] bbc_i2c: probe of f00cd000 failed with error -22

And, when I try to rmmod bbc, I get a kernel NULL pointer bug:

[ 3878.082842] Unable to handle kernel NULL pointer dereference                 

Ok, the following patch should fix the crash.

But I can't see why kthread_run() should fail and that's the only patch I can see which can return -EINVAL during the probe.

Can you do me a favor after you make sure rmmod no longer causes a crash? Add some printk() diagnostics to kernel/fork.c:copy_process() for all those checks there that return ERR_PTR(-EINVAL). See if any of them trigger, and if so which one.

Thanks!

commit c7c17c2779075e675cb3c7fe2ecde67e226771fb

Author: David S. Miller <[email protected]>
Date:   Mon Jan 4 15:31:10 2010 -0800

bbc_envctrl: Clean up properly if kthread_run() fails.

In bbc_envctrl_init() we have to unlink the fan and temp instances from the lists because our caller is going to free up the 'bp' object if we return an error.

We can't rely upon bbc_envctrl_cleanup() to do this work for us in this case.

drivers/sbus/char/bbc_envctrl.c +38 -26
index 7c815d3..28d86f9 100644
@@ -522,6 +522,40 @@ static void attach_one_fan(struct bbc_i2c_bus *bp, struct of_device *op,
 	set_fan_speeds(fp);
 }
 
+static void destroy_one_temp(struct bbc_cpu_temperature *tp)
+{
+	bbc_i2c_detach(tp->client);
+	kfree(tp);
+}
+
+static void destroy_all_temps(struct bbc_i2c_bus *bp)
+{
+	struct bbc_cpu_temperature *tp, *tpos;
+
+	list_for_each_entry_safe(tp, tpos, &bp->temps, bp_list) {
+		list_del(&tp->bp_list);
+		list_del(&tp->glob_list);
+		destroy_one_temp(tp);
+	}
+}
+
+static void destroy_one_fan(struct bbc_fan_control *fp)
+{
+	bbc_i2c_detach(fp->client);
+	kfree(fp);
+}
+
+static void destroy_all_fans(struct bbc_i2c_bus *bp)
+{
+	struct bbc_fan_control *fp, *fpos;
+
+	list_for_each_entry_safe(fp, fpos, &bp->fans, bp_list) {
+		list_del(&fp->bp_list);
+		list_del(&fp->glob_list);
+		destroy_one_fan(fp);
+	}
+}
+
 int bbc_envctrl_init(struct bbc_i2c_bus *bp)
 {
 	struct of_device *op;
@@ -541,6 +575,8 @@ int bbc_envctrl_init(struct bbc_i2c_bus *bp)
 			int err = PTR_ERR(kenvctrld_task);
 
 			kenvctrld_task = NULL;
+			destroy_all_temps(bp);
+			destroy_all_fans(bp);
 			return err;
 		}
 	}
@@ -548,35 +584,11 @@ int bbc_envctrl_init(struct bbc_i2c_bus *bp)
 	return 0;
 }
 
-static void destroy_one_temp(struct bbc_cpu_temperature *tp)
-{
-	bbc_i2c_detach(tp->client);
-	kfree(tp);
-}
-
-static void destroy_one_fan(struct bbc_fan_control *fp)
-{
-	bbc_i2c_detach(fp->client);
-	kfree(fp);
-}
-
 void bbc_envctrl_cleanup(struct bbc_i2c_bus *bp)
 {
-	struct bbc_cpu_temperature *tp, *tpos;
-	struct bbc_fan_control *fp, *fpos;
-
 	if (kenvctrld_task)
 		kthread_stop(kenvctrld_task);
 
-	list_for_each_entry_safe(tp, tpos, &bp->temps, bp_list) {
-		list_del(&tp->bp_list);
-		list_del(&tp->glob_list);
-		destroy_one_temp(tp);
-	}
-
-	list_for_each_entry_safe(fp, fpos, &bp->fans, bp_list) {
-		list_del(&fp->bp_list);
-		list_del(&fp->glob_list);
-		destroy_one_fan(fp);
-	}
+	destroy_all_temps(bp);
+	destroy_all_fans(bp);
 }
#3 lore raw
In reply to Patrick Finnegan
Quoted 18 lines · David Miller

From: Patrick Finnegan <[email protected]>
Date: Wed, 2 Dec 2009 11:05:03 -0500

Quoted 6 lines

Going through the remaining problems I'm having with my V880, it looks like the SPARC bbc i2c driver won't load. This is with Linus's git tree from a few days ago. When I do a "modprobe bbc", I get this:

[ 3735.308284] i2c-0: Regs at 000007fc7e00002e, 2 devices, own a0,
Quoted 8 lines

clock 10. [ 3735.388677] bbc_i2c: probe of f00bd100 failed with error -22 [ 3735.456691] i2c-0: Regs at 000007fc7e50002e, 8 devices, own a0, clock 10. [ 3735.537696] bbc_i2c: probe of f00cd000 failed with error -22

And, when I try to rmmod bbc, I get a kernel NULL pointer bug:

[ 3878.082842] Unable to handle kernel NULL pointer dereference
Quoted 8 lines

Ok, the following patch should fix the crash.

But I can't see why kthread_run() should fail and that's the only patch I can see which can return -EINVAL during the probe.

Can you do me a favor after you make sure rmmod no longer causes a crash?

Ok, I tried this, and it doesn't seem to help.

I still get a kernel BUG, this is the new traceback:

[ 1207.699972] Unable to handle kernel NULL pointer dereference
[ 1207.766801] tsk->{mm,active_mm}->context = 0000000000000dad         
[ 1207.833455] tsk->{mm,active_mm}->pgd = fffff8d0ddc4c000             
[ 1207.895951]               \|/ ____ \|/                              
[ 1207.895956]               "@'/ .. \`@"                              
[ 1207.895960]               /_| \__/ |_\                              
[ 1207.895965]                  \__U_/                                 
[ 1208.072016] rmmod(8911): Oops [#1]                                  
[ 1208.112628] TSTATE: 0000000011001602 TPC: 00000000101e65dc TNPC: 
00000000101e6624 Y: 00000000    Not tainted                                                 
[ 1208.230347] TPC: <destroy_all_temps+0x1c/0x78 [bbc]>                         
[ 1208.289715] g0: fffff8d0f823c000 g1: 0000000000400400 g2: 
000000000088b000 g3: 000000000000002d                                                              
[ 1208.393892] g4: fffff8d0faa5b360 g5: fffff8a007b34000 g6: 
fffff8d0f823c000 g7: 000000000000002f                                                              
[ 1208.498050] o0: 0000000000000001 o1: 0000000000000007 o2: 
0000000000001b2d o3: 0000000000000080                                                              
[ 1208.602231] o4: fffff8d0fe0571a8 o5: fffff8d0f9d833c8 sp: 
fffff8d0f823f041 ret_pc: 000000000050f4dc                                                          
[ 1208.710583] RPC: <__iget+0x18/0x80>                                          
[ 1208.752225] l0: 0000000000000000 l1: fffff8d0fe058000 l2: 
0000000000100100 l3: 0000000000200200                                                              
[ 1208.856394] l4: 0000000000000000 l5: 0000000000000000 l6: 
fffff8a008400010 l7: 0000000000000000                                                              
[ 1208.960564] i0: fffff8d0fb1c4b08 i1: fffff8d0fe4f5240 i2: 
0000000000000001 i3: fffff8d0fe4f5240
[ 1209.064743] i4: fffff8d0fe4b2ea8 i5: 000000081d56b2ee i6: 
fffff8d0f823f101 i7: 00000000101e66cc
[ 1209.168906] I7: <bbc_envctrl_cleanup+0x1c/0x30 [bbc]>
[ 1209.229321] Disabling lock debugging due to kernel taint
[ 1209.292868] Caller[00000000101e66cc]: bbc_envctrl_cleanup+0x1c/0x30 
[bbc]
[ 1209.374133] Caller[00000000101e7360]: bbc_i2c_remove+0xc/0x5c [bbc]
[ 1209.449127] Caller[0000000000693c8c]: 
of_platform_device_remove+0x1c/0x2c
[ 1209.530386] Caller[0000000000607418]: 
__device_release_driver+0x6c/0xac
[ 1209.609545] Caller[00000000006074d8]: driver_detach+0x80/0xb4
[ 1209.678304] Caller[0000000000606650]: bus_remove_driver+0x98/0xd0
[ 1209.751215] Caller[0000000000490458]: SyS_delete_module+0x1c0/0x234
[ 1209.826220] Caller[0000000000406214]: linux_sparc_syscall32+0x34/0x40
[ 1209.903298] Caller[000000000001154c]: 0x1154c
[ 1209.955386] Instruction DUMP: a7307001  a5307002  10680013 <e25c0000> 

c25c0000 c4706008 c2708000 c45c2018 c25c2010

Pat

Signature · 2 lines
Purdue University Research Computing ---  http://www.rcac.purdue.edu/
The Computer Refuge                  ---  http://computer-refuge.org