On Thu, May 20, Wolfgang Grandegger wrote:

> On 05/20/2010 11:07 AM, Olaf Hering wrote:
> > Hello,
> > 
> > when at91_can is compiled as a module, the BUG below occours in dmesg
> > with 2.6.33.4-rt20.
> > I think this does not happen when its compiled into the kernel.
> > 
> > Any ideas how to fix it?
> 
> It seems that you are using the old deprecated SysFS interface. Any
> chance switching to the netlink interface?

I just loaded the driver with modprobe.
The sysfs lines are most likely come from netdev support, when
/sys/class/net/canN is created.

These are the used commands:

modprobe -v at91_can
ip link set can0 up type can bitrate 1000000
ip link set can0 down
ip link set can0 up txqueuelen 1000 type can bitrate 1000000
dmesg

Even ip link set up generates a BUG:



[  100.030000] at91_can netdevice driver
[  100.040000] BUG: sleeping function called from invalid context at 
/opt/cross/sys-root/arm-linux-gnueabi/usr/src/linux-2.6.33-arm9-kernel-source/kernel/rtmutex.c:684
[  100.040000] pcnt: 1 0 in_atomic(): 1, irqs_disabled(): 128, pid: 495, name: 
modprobe
[  100.040000] 3 locks held by modprobe/495:
[  100.040000]  #0:  (&__lockdep_no_validate__){+.+.+.}, at: [<c01e3194>] 
__driver_attach+0x44/0x8c
[  100.040000]  #1:  (&__lockdep_no_validate__){+.+.+.}, at: [<c01e31a0>] 
__driver_attach+0x50/0x8c
[  100.040000]  #2:  (rtnl_mutex){+.+.+.}, at: [<c027ff18>] rtnl_lock+0x14/0x1c
[  100.040000] irq event stamp: 9153
[  100.040000] hardirqs last  enabled at (9152): [<c0324a78>] 
_raw_spin_unlock_irqrestore+0x44/0x70
[  100.040000] hardirqs last disabled at (9153): [<c032495c>] 
_raw_spin_lock_irqsave+0x28/0x6c
[  100.040000] softirqs last  enabled at (0): [<c004844c>] 
copy_process+0x378/0xf68
[  100.040000] softirqs last disabled at (0): [<(null)>] (null)
[  100.040000] [<c0033ea4>] (unwind_backtrace+0x0/0xdc) from [<c032164c>] 
(dump_stack+0x18/0x1c)
[  100.040000] [<c032164c>] (dump_stack+0x18/0x1c) from [<c0041f18>] 
(__might_sleep+0x110/0x130)
[  100.040000] [<c0041f18>] (__might_sleep+0x110/0x130) from [<c0323f14>] 
(rt_spin_lock+0x44/0xa0)
[  100.040000] [<c0323f14>] (rt_spin_lock+0x44/0xa0) from [<c0033b44>] 
(unwind_frame+0x74/0x3d4)
[  100.040000] [<c0033b44>] (unwind_frame+0x74/0x3d4) from [<c0031970>] 
(walk_stackframe+0x34/0x40)
[  100.040000] [<c0031970>] (walk_stackframe+0x34/0x40) from [<c0031a10>] 
(save_stack_trace_tsk+0x94/0xc4)
[  100.040000] [<c0031a10>] (save_stack_trace_tsk+0x94/0xc4) from [<c0031a64>] 
(save_stack_trace+0x24/0x28)
[  100.040000] [<c0031a64>] (save_stack_trace+0x24/0x28) from [<c006e348>] 
(save_trace+0x44/0xd8)
[  100.040000] [<c006e348>] (save_trace+0x44/0xd8) from [<c006e458>] 
(add_lock_to_list+0x7c/0xc8)
[  100.040000] [<c006e458>] (add_lock_to_list+0x7c/0xc8) from [<c0071fd4>] 
(__lock_acquire+0x14e0/0x18a8)
[  100.040000] [<c0071fd4>] (__lock_acquire+0x14e0/0x18a8) from [<c0072408>] 
(lock_acquire+0x6c/0x80)
[  100.040000] [<c0072408>] (lock_acquire+0x6c/0x80) from [<c032498c>] 
(_raw_spin_lock_irqsave+0x58/0x6c)
[  100.040000] [<c032498c>] (_raw_spin_lock_irqsave+0x58/0x6c) from 
[<c0323350>] (rt_spin_lock_slowlock+0x2c/0x23c)
[  100.040000] [<c0323350>] (rt_spin_lock_slowlock+0x2c/0x23c) from 
[<c0323f38>] (rt_spin_lock+0x68/0xa0)
[  100.040000] [<c0323f38>] (rt_spin_lock+0x68/0xa0) from [<c01a1204>] 
(idr_pre_get+0x40/0x7c)
[  100.040000] [<c01a1204>] (idr_pre_get+0x40/0x7c) from [<c01a1258>] 
(ida_pre_get+0x18/0x60)
[  100.040000] [<c01a1258>] (ida_pre_get+0x18/0x60) from [<c00f81bc>] 
(sysfs_new_dirent+0x90/0x11c)
[  100.040000] [<c00f81bc>] (sysfs_new_dirent+0x90/0x11c) from [<c00f77dc>] 
(sysfs_add_file_mode+0x28/0xa0)
[  100.040000] [<c00f77dc>] (sysfs_add_file_mode+0x28/0xa0) from [<c00f9cbc>] 
(internal_create_group+0x128/0x1d4)
[  100.040000] [<c00f9cbc>] (internal_create_group+0x128/0x1d4) from 
[<c00f9d9c>] (sysfs_create_group+0x18/0x1c)
[  100.040000] [<c00f9d9c>] (sysfs_create_group+0x18/0x1c) from [<c01e0648>] 
(device_add_groups+0x24/0x78)
[  100.040000] [<c01e0648>] (device_add_groups+0x24/0x78) from [<c01e0d5c>] 
(device_add+0x294/0x4ac)
[  100.040000] [<c01e0d5c>] (device_add+0x294/0x4ac) from [<c028301c>] 
(netdev_register_kobject+0x58/0x68)
[  100.040000] [<c028301c>] (netdev_register_kobject+0x58/0x68) from 
[<c0277358>] (register_netdevice+0x264/0x464)
[  100.040000] [<c0277358>] (register_netdevice+0x264/0x464) from [<c027759c>] 
(register_netdev+0x44/0x54)
[  100.040000] [<c027759c>] (register_netdev+0x44/0x54) from [<c020f580>] 
(register_candev+0x18/0x20)
[  100.040000] [<c020f580>] (register_candev+0x18/0x20) from [<bf00416c>] 
(at91_can_probe+0x16c/0x218 [at91_can])
[  100.040000] [<bf00416c>] (at91_can_probe+0x16c/0x218 [at91_can]) from 
[<c01e4094>] (platform_drv_probe+0x1c/0x20)
[  100.040000] [<c01e4094>] (platform_drv_probe+0x1c/0x20) from [<c01e30a0>] 
(driver_probe_device+0xb0/0x160)
[  100.040000] [<c01e30a0>] (driver_probe_device+0xb0/0x160) from [<c01e31b8>] 
(__driver_attach+0x68/0x8c)
[  100.040000] [<c01e31b8>] (__driver_attach+0x68/0x8c) from [<c01e2890>] 
(bus_for_each_dev+0x54/0x94)
[  100.040000] [<c01e2890>] (bus_for_each_dev+0x54/0x94) from [<c01e2f04>] 
(driver_attach+0x20/0x28)
[  100.040000] [<c01e2f04>] (driver_attach+0x20/0x28) from [<c01e2170>] 
(bus_add_driver+0xa8/0x22c)
[  100.040000] [<c01e2170>] (bus_add_driver+0xa8/0x22c) from [<c01e34d0>] 
(driver_register+0xb4/0x144)
[  100.040000] [<c01e34d0>] (driver_register+0xb4/0x144) from [<c01e4338>] 
(platform_driver_register+0x4c/0x60)
[  100.040000] [<c01e4338>] (platform_driver_register+0x4c/0x60) from 
[<bf004238>] (at91_can_module_init+0x20/0x30 [at91_can])
[  100.040000] [<bf004238>] (at91_can_module_init+0x20/0x30 [at91_can]) from 
[<c002d3c4>] (do_one_initcall+0x64/0x1d0)
[  100.040000] [<c002d3c4>] (do_one_initcall+0x64/0x1d0) from [<c007c7b4>] 
(sys_init_module+0xc4/0x1f0)
[  100.040000] [<c007c7b4>] (sys_init_module+0xc4/0x1f0) from [<c002e020>] 
(ret_fast_syscall+0x0/0x34)
[  100.050000] at91_can at91_can: device registered (reg_base=c48a8000, irq=12)
[  195.120000] at91_can at91_can: bitrate error 0.0%
[  195.120000] at91_can at91_can: writing AT91_BR: 0x00090222
[  195.130000] BUG: sleeping function called from invalid context at 
/opt/cross/sys-root/arm-linux-gnueabi/usr/src/linux-2.6.33-arm9-kernel-source/kernel/rtmutex.c:684
[  195.130000] pcnt: 1 0 in_atomic(): 1, irqs_disabled(): 128, pid: 497, name: 
ip
[  195.130000] 1 lock held by ip/497:
[  195.130000]  #0:  (rtnl_mutex){+.+.+.}, at: [<c027ff18>] rtnl_lock+0x14/0x1c
[  195.130000] irq event stamp: 20051
[  195.130000] hardirqs last  enabled at (20050): [<c0324a78>] 
_raw_spin_unlock_irqrestore+0x44/0x70
[  195.130000] hardirqs last disabled at (20051): [<c032495c>] 
_raw_spin_lock_irqsave+0x28/0x6c
[  195.130000] softirqs last  enabled at (0): [<c004844c>] 
copy_process+0x378/0xf68
[  195.130000] softirqs last disabled at (0): [<(null)>] (null)
[  195.130000] [<c0033ea4>] (unwind_backtrace+0x0/0xdc) from [<c032164c>] 
(dump_stack+0x18/0x1c)
[  195.130000] [<c032164c>] (dump_stack+0x18/0x1c) from [<c0041f18>] 
(__might_sleep+0x110/0x130)
[  195.130000] [<c0041f18>] (__might_sleep+0x110/0x130) from [<c0323f14>] 
(rt_spin_lock+0x44/0xa0)
[  195.130000] [<c0323f14>] (rt_spin_lock+0x44/0xa0) from [<c0033b44>] 
(unwind_frame+0x74/0x3d4)
[  195.130000] [<c0033b44>] (unwind_frame+0x74/0x3d4) from [<c0031970>] 
(walk_stackframe+0x34/0x40)
[  195.130000] [<c0031970>] (walk_stackframe+0x34/0x40) from [<c0031a10>] 
(save_stack_trace_tsk+0x94/0xc4)
[  195.130000] [<c0031a10>] (save_stack_trace_tsk+0x94/0xc4) from [<c0031a64>] 
(save_stack_trace+0x24/0x28)
[  195.130000] [<c0031a64>] (save_stack_trace+0x24/0x28) from [<c006e348>] 
(save_trace+0x44/0xd8)
[  195.130000] [<c006e348>] (save_trace+0x44/0xd8) from [<c006e458>] 
(add_lock_to_list+0x7c/0xc8)
[  195.130000] [<c006e458>] (add_lock_to_list+0x7c/0xc8) from [<c0071fd4>] 
(__lock_acquire+0x14e0/0x18a8)
[  195.130000] [<c0071fd4>] (__lock_acquire+0x14e0/0x18a8) from [<c0072408>] 
(lock_acquire+0x6c/0x80)
[  195.130000] [<c0072408>] (lock_acquire+0x6c/0x80) from [<c032498c>] 
(_raw_spin_lock_irqsave+0x58/0x6c)
[  195.130000] [<c032498c>] (_raw_spin_lock_irqsave+0x58/0x6c) from 
[<c0323350>] (rt_spin_lock_slowlock+0x2c/0x23c)
[  195.130000] [<c0323350>] (rt_spin_lock_slowlock+0x2c/0x23c) from 
[<c0323f38>] (rt_spin_lock+0x68/0xa0)
[  195.130000] [<c0323f38>] (rt_spin_lock+0x68/0xa0) from [<c00393c0>] 
(clk_enable+0x1c/0x38)
[  195.130000] [<c00393c0>] (clk_enable+0x1c/0x38) from [<bf000420>] 
(at91_open+0x1c/0xdc [at91_can])
[  195.130000] [<bf000420>] (at91_open+0x1c/0xdc [at91_can]) from [<c0276094>] 
(dev_open+0xbc/0x120)
[  195.130000] [<c0276094>] (dev_open+0xbc/0x120) from [<c02754e0>] 
(dev_change_flags+0xac/0x184)
[  195.130000] [<c02754e0>] (dev_change_flags+0xac/0x184) from [<c027f624>] 
(do_setlink+0x23c/0x308)
[  195.130000] [<c027f624>] (do_setlink+0x23c/0x308) from [<c0280410>] 
(rtnl_newlink+0x2bc/0x484)
[  195.130000] [<c0280410>] (rtnl_newlink+0x2bc/0x484) from [<c0280128>] 
(rtnetlink_rcv_msg+0x1dc/0x208)
[  195.130000] [<c0280128>] (rtnetlink_rcv_msg+0x1dc/0x208) from [<c02872bc>] 
(netlink_rcv_skb+0x54/0xb8)
[  195.130000] [<c02872bc>] (netlink_rcv_skb+0x54/0xb8) from [<c027ff40>] 
(rtnetlink_rcv+0x20/0x2c)
[  195.130000] [<c027ff40>] (rtnetlink_rcv+0x20/0x2c) from [<c0286f54>] 
(netlink_unicast+0x274/0x320)
[  195.130000] [<c0286f54>] (netlink_unicast+0x274/0x320) from [<c0287898>] 
(netlink_sendmsg+0x25c/0x270)
[  195.130000] [<c0287898>] (netlink_sendmsg+0x25c/0x270) from [<c0263d40>] 
(sock_sendmsg+0x98/0xb4)
[  195.130000] [<c0263d40>] (sock_sendmsg+0x98/0xb4) from [<c02642fc>] 
(sys_sendmsg+0x1b8/0x214)
[  195.130000] [<c02642fc>] (sys_sendmsg+0x1b8/0x214) from [<c002e020>] 
(ret_fast_syscall+0x0/0x34)
[  195.140000] at91_can at91_can: RX buffer overflow
[  195.140000] at91_can at91_can: order of incoming frames cannot be guaranteed
[  195.140000] at91_can at91_can: RX buffer overflow
[  195.140000] at91_can at91_can: order of incoming frames cannot be guaranteed
[  195.150000] at91_can at91_can: RX buffer overflow
[  195.150000] at91_can at91_can: order of incoming frames cannot be guaranteed
[  195.150000] at91_can at91_can: RX buffer overflow
[  195.150000] at91_can at91_can: order of incoming frames cannot be guaranteed
[  195.150000] at91_can at91_can: RX buffer overflow
[  195.150000] at91_can at91_can: order of incoming frames cannot be guaranteed
[  195.150000] at91_can at91_can: RX buffer overflow
[  195.150000] at91_can at91_can: order of incoming frames cannot be guaranteed
[  228.490000] BUG: sleeping function called from invalid context at 
/opt/cross/sys-root/arm-linux-gnueabi/usr/src/linux-2.6.33-arm9-kernel-source/kernel/rtmutex.c:684
[  228.490000] pcnt: 0 0 in_atomic(): 0, irqs_disabled(): 128, pid: 502, name: 
ip
[  228.490000] 1 lock held by ip/502:
[  228.490000]  #0:  (rtnl_mutex){+.+.+.}, at: [<c027ff18>] rtnl_lock+0x14/0x1c
[  228.490000] irq event stamp: 7404
[  228.490000] hardirqs last  enabled at (7404): [<c0324a78>] 
_raw_spin_unlock_irqrestore+0x44/0x70
[  228.490000] hardirqs last disabled at (7403): [<c032495c>] 
_raw_spin_lock_irqsave+0x28/0x6c
[  228.490000] softirqs last  enabled at (0): [<c004844c>] 
copy_process+0x378/0xf68
[  228.490000] softirqs last disabled at (0): [<(null)>] (null)
[  228.490000] [<c0033ea4>] (unwind_backtrace+0x0/0xdc) from [<c032164c>] 
(dump_stack+0x18/0x1c)
[  228.490000] [<c032164c>] (dump_stack+0x18/0x1c) from [<c0041f18>] 
(__might_sleep+0x110/0x130)
[  228.490000] [<c0041f18>] (__might_sleep+0x110/0x130) from [<c0323f14>] 
(rt_spin_lock+0x44/0xa0)
[  228.490000] [<c0323f14>] (rt_spin_lock+0x44/0xa0) from [<c0033b44>] 
(unwind_frame+0x74/0x3d4)
[  228.490000] [<c0033b44>] (unwind_frame+0x74/0x3d4) from [<c0031970>] 
(walk_stackframe+0x34/0x40)
[  228.490000] [<c0031970>] (walk_stackframe+0x34/0x40) from [<c0031a10>] 
(save_stack_trace_tsk+0x94/0xc4)
[  228.490000] [<c0031a10>] (save_stack_trace_tsk+0x94/0xc4) from [<c0031a64>] 
(save_stack_trace+0x24/0x28)
[  228.490000] [<c0031a64>] (save_stack_trace+0x24/0x28) from [<c006e348>] 
(save_trace+0x44/0xd8)
[  228.490000] [<c006e348>] (save_trace+0x44/0xd8) from [<c006e458>] 
(add_lock_to_list+0x7c/0xc8)
[  228.490000] [<c006e458>] (add_lock_to_list+0x7c/0xc8) from [<c0071fd4>] 
(__lock_acquire+0x14e0/0x18a8)
[  228.490000] [<c0071fd4>] (__lock_acquire+0x14e0/0x18a8) from [<c0072408>] 
(lock_acquire+0x6c/0x80)
[  228.490000] [<c0072408>] (lock_acquire+0x6c/0x80) from [<c0323f60>] 
(rt_spin_lock+0x90/0xa0)
[  228.490000] [<c0323f60>] (rt_spin_lock+0x90/0xa0) from [<c00f10a0>] 
(remove_proc_entry+0xac/0x214)
[  228.490000] [<c00f10a0>] (remove_proc_entry+0xac/0x214) from [<c00807bc>] 
(unregister_handler_proc+0x30/0x34)
[  228.490000] [<c00807bc>] (unregister_handler_proc+0x30/0x34) from 
[<c007eec0>] (__free_irq+0x104/0x17c)
[  228.490000] [<c007eec0>] (__free_irq+0x104/0x17c) from [<c007ef7c>] 
(free_irq+0x44/0x64)
[  228.490000] [<c007ef7c>] (free_irq+0x44/0x64) from [<bf0003ec>] 
(at91_close+0xf0/0x108 [at91_can])
[  228.490000] [<bf0003ec>] (at91_close+0xf0/0x108 [at91_can]) from 
[<c0275b64>] (dev_close+0x94/0xc4)
[  228.490000] [<c0275b64>] (dev_close+0x94/0xc4) from [<c02754e0>] 
(dev_change_flags+0xac/0x184)
[  228.490000] [<c02754e0>] (dev_change_flags+0xac/0x184) from [<c027f624>] 
(do_setlink+0x23c/0x308)
[  228.490000] [<c027f624>] (do_setlink+0x23c/0x308) from [<c0280410>] 
(rtnl_newlink+0x2bc/0x484)
[  228.490000] [<c0280410>] (rtnl_newlink+0x2bc/0x484) from [<c0280128>] 
(rtnetlink_rcv_msg+0x1dc/0x208)
[  228.490000] [<c0280128>] (rtnetlink_rcv_msg+0x1dc/0x208) from [<c02872bc>] 
(netlink_rcv_skb+0x54/0xb8)
[  228.490000] [<c02872bc>] (netlink_rcv_skb+0x54/0xb8) from [<c027ff40>] 
(rtnetlink_rcv+0x20/0x2c)
[  228.490000] [<c027ff40>] (rtnetlink_rcv+0x20/0x2c) from [<c0286f54>] 
(netlink_unicast+0x274/0x320)
[  228.490000] [<c0286f54>] (netlink_unicast+0x274/0x320) from [<c0287898>] 
(netlink_sendmsg+0x25c/0x270)
[  228.490000] [<c0287898>] (netlink_sendmsg+0x25c/0x270) from [<c0263d40>] 
(sock_sendmsg+0x98/0xb4)
[  228.490000] [<c0263d40>] (sock_sendmsg+0x98/0xb4) from [<c02642fc>] 
(sys_sendmsg+0x1b8/0x214)
[  228.490000] [<c02642fc>] (sys_sendmsg+0x1b8/0x214) from [<c002e020>] 
(ret_fast_syscall+0x0/0x34)
[  230.030000] at91_can at91_can: bitrate error 0.0%
[  230.030000] at91_can at91_can: writing AT91_BR: 0x00090222
_______________________________________________
Socketcan-core mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-core

Reply via email to