al: lockdep error test init
hack_lockdep:A->B
hack_lockdep:B->A
=============================================
[ INFO: possible recursive locking detected ]---------------------------------------------------------------检测到的死锁描述:递归死锁类型
4.0.0+ #87 Tainted: G O
---------------------------------------------
insmod/658 is trying to acquire lock:---------------------------------------------------------------------------死锁细节描述:欲持锁点和已持锁点
(hack_spinB){+.+...}, at: [] lockdep_test_init+0x30/0x3c [lock]--------------------------lockdep_test_init中调用hack_spinBA再次持有hack_spinB锁
but task is already holding lock:
(hack_spinB){+.+...}, at: [] hack_spinAB+0x38/0x3c [lock]--------------------------------hack_spinB已经在hack_spinAB函数中被持有
other info that might help us debug this:-----------------------------------------------------------------------锁的其它补充信息
Possible unsafe locking scenario:
CPU0
----
lock(hack_spinB);
lock(hack_spinB);
*** DEADLOCK ***
May be due to missing lock nesting notation
2 locks held by insmod/658:----------------------------------------------------------------------------------------进程共持有两个锁
#0: (hack_spinA){+.+...}, at: [] hack_spinAB+0x30/0x3c [lock]
#1: (hack_spinB){+.+...}, at: [] hack_spinAB+0x38/0x3c [lock]
stack backtrace:--------------------------------------------------------------------------------------------------------栈回溯信息:可以看出从lockdep_test_init->_raw_spin_lock->lock_acquire的调用路径。
CPU: 0 PID: 658 Comm: insmod Tainted: G O 4.0.0+ #87
Hardware name: ARM-Versatile Express
[] (unwind_backtrace) from [] (show_stack+0x20/0x24)
[] (show_stack) from [] (dump_stack+0x8c/0xb4)
[] (dump_stack) from [] (__lock_acquire+0x1aa4/0x1f64)
[] (__lock_acquire) from [] (lock_acquire+0xf4/0x190)
[] (lock_acquire) from [] (_raw_spin_lock+0x60/0x98)
[] (_raw_spin_lock) from [] (lockdep_test_init+0x30/0x3c [lock])
[] (lockdep_test_init [lock]) from [] (do_one_initcall+0x9c/0x1e8)
[] (do_one_initcall) from [] (do_init_module+0x70/0x1c0)
[] (do_init_module) from [] (load_module+0x18b0/0x1f90)
[] (load_module) from [] (SyS_init_module+0x140/0x150)
[] (SyS_init_module) from [] (ret_fast_syscall+0x0/0x4c)
INFO: rcu_sched self-detected stall on CPU
0: (2099 ticks this GP) idle=5ed/140000000000001/0 softirq=13024/13024 fqs=1783
(t=2100 jiffies g=-51 c=-52 q=22)
Task dump for CPU 0:
insmod R running 0 658 657 0x00000002
[] (unwind_backtrace) from [] (show_stack+0x20/0x24)
[] (show_stack) from [] (sched_show_task+0x128/0x184)
[] (sched_show_task) from [] (dump_cpu_task+0x48/0x4c)
[] (dump_cpu_task) from [] (rcu_dump_cpu_stacks+0x9c/0xd4)
[] (rcu_dump_cpu_stacks) from [] (rcu_check_callbacks+0x640/0x968)
[] (rcu_check_callbacks) from [] (update_process_times+0x4c/0x74)
[] (update_process_times) from [] (tick_periodic+0x54/0xf8)
[] (tick_periodic) from [] (tick_handle_periodic+0x38/0x98)
[] (tick_handle_periodic) from [] (twd_handler+0x40/0x50)
[] (twd_handler) from [] (handle_percpu_devid_irq+0xd8/0x1dc)
[] (handle_percpu_devid_irq) from [] (generic_handle_irq+0x3c/0x4c)
[] (generic_handle_irq) from [] (__handle_domain_irq+0x6c/0xc4)
[] (__handle_domain_irq) from [] (gic_handle_irq+0x34/0x6c)
[] (gic_handle_irq) from [] (__irq_svc+0x44/0x5c)
Exception stack(0xed5c9d18 to 0xed5c9d60)
9d00: 00000000 00010000
9d20: 0000ffff c02f3898 bf0001b0 c0b1d248 123cc000 00000000 0c99b2c5 00000000
9d40: 00000000 ed5c9d84 ed5c9d60 ed5c9d60 c0070cb4 c0070cb4 60000013 ffffffff
[] (__irq_svc) from [] (do_raw_spin_lock+0xf0/0x1e0)
[] (do_raw_spin_lock) from [] (_raw_spin_lock+0x84/0x98)
[] (_raw_spin_lock) from [] (lockdep_test_init+0x30/0x3c [lock])
[] (lockdep_test_init [lock]) from [] (do_one_initcall+0x9c/0x1e8)
[] (do_one_initcall) from [] (do_init_module+0x70/0x1c0)
[] (do_init_module) from [] (load_module+0x18b0/0x1f90)
[] (load_module) from [] (SyS_init_module+0x140/0x150)
[] (SyS_init_module) from [] (ret_fast_syscall+0x0/0x4c)
BUG: spinlock lockup suspected on CPU#0, insmod/658------------------------------------------------------------错误类型是spinlock,下面的backtrace和上面基本一致。
lock: hack_spinB+0x0/0xfffffedc [lock], .magic: dead4ead, .owner: insmod/658, .owner_cpu: 0-----------发生死锁的是hack_spinB
CPU: 0 PID: 658 Comm: insmod Tainted: G O 4.0.0+ #87
Hardware name: ARM-Versatile Express
[] (unwind_backtrace) from [] (show_stack+0x20/0x24)
[] (show_stack) from [] (dump_stack+0x8c/0xb4)
[] (dump_stack) from [] (spin_dump+0x8c/0xd0)
[] (spin_dump) from [] (do_raw_spin_lock+0x10c/0x1e0)
[] (do_raw_spin_lock) from [] (_raw_spin_lock+0x84/0x98)
[] (_raw_spin_lock) from [] (lockdep_test_init+0x30/0x3c [lock])
[] (lockdep_test_init [lock]) from [] (do_one_initcall+0x9c/0x1e8)
[] (do_one_initcall) from [] (do_init_module+0x70/0x1c0)
[] (do_init_module) from [] (load_module+0x18b0/0x1f90)
[] (load_module) from [] (SyS_init_module+0x140/0x150)
[] (SyS_init_module) from [] (ret_fast_syscall+0x0/0x4c)