From mboxrd@z Thu Jan 1 00:00:00 1970 From: maciej.rutecki@gmail.com (Maciej Rutecki) Date: Sun, 12 Feb 2012 14:31:54 +0100 Subject: Possible circular locking dependency (3.3-rc2) In-Reply-To: <20120208124147.GF16334@legolas.emea.dhcp.ti.com> References: <20120208124147.GF16334@legolas.emea.dhcp.ti.com> Message-ID: <201202121431.54917.maciej.rutecki@gmail.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On ?roda, 8 lutego 2012 o 13:41:48 Felipe Balbi wrote: > Hi guys, > > I have just triggered the folllowing: > > [ 84.860321] ====================================================== > [ 84.860321] [ INFO: possible circular locking dependency detected ] > [ 84.860321] 3.3.0-rc2-00026-ge4e8a39 #474 Not tainted > [ 84.860321] ------------------------------------------------------- > [ 84.860321] bash/949 is trying to acquire lock: > [ 84.860321] (sysfs_lock){+.+.+.}, at: [] > gpio_value_store+0x24/0xcc [ 84.860321] > [ 84.860321] but task is already holding lock: > [ 84.860321] (s_active#22){++++.+}, at: [] > sysfs_write_file+0xdc/0x184 [ 84.911468] > [ 84.911468] which lock already depends on the new lock. > [ 84.911468] > [ 84.920043] > [ 84.920043] the existing dependency chain (in reverse order) is: > [ 84.920043] > [ 84.927886] -> #1 (s_active#22){++++.+}: > [ 84.927886] [] check_prevs_add+0xdc/0x150 > [ 84.927886] [] validate_chain.clone.24+0x564/0x694 > [ 84.927886] [] __lock_acquire+0x49c/0x980 > [ 84.951660] [] lock_acquire+0x98/0x100 > [ 84.951660] [] sysfs_deactivate+0xb0/0x100 > [ 84.962982] [] sysfs_addrm_finish+0x2c/0x6c > [ 84.962982] [] sysfs_remove_dir+0x84/0x98 > [ 84.962982] [] kobject_del+0x10/0x78 > [ 84.974670] [] device_del+0x140/0x170 > [ 84.974670] [] device_unregister+0xc/0x18 > [ 84.985382] [] gpio_unexport+0xbc/0xdc > [ 84.985382] [] gpio_free+0x14/0xfc > [ 85.001708] [] unexport_store+0x78/0x8c > [ 85.001708] [] class_attr_store+0x18/0x24 > [ 85.007293] [] sysfs_write_file+0x100/0x184 > [ 85.018981] [] vfs_write+0xb4/0x148 > [ 85.018981] [] sys_write+0x40/0x70 > [ 85.018981] [] ret_fast_syscall+0x0/0x3c > [ 85.035003] > [ 85.035003] -> #0 (sysfs_lock){+.+.+.}: > [ 85.035003] [] check_prev_add+0x680/0x698 > [ 85.035003] [] check_prevs_add+0xdc/0x150 > [ 85.052093] [] validate_chain.clone.24+0x564/0x694 > [ 85.052093] [] __lock_acquire+0x49c/0x980 > [ 85.052093] [] lock_acquire+0x98/0x100 > [ 85.069885] [] mutex_lock_nested+0x3c/0x2f4 > [ 85.069885] [] gpio_value_store+0x24/0xcc > [ 85.069885] [] dev_attr_store+0x18/0x24 > [ 85.087158] [] sysfs_write_file+0x100/0x184 > [ 85.087158] [] vfs_write+0xb4/0x148 > [ 85.098297] [] sys_write+0x40/0x70 > [ 85.098297] [] ret_fast_syscall+0x0/0x3c > [ 85.109069] > [ 85.109069] other info that might help us debug this: > [ 85.109069] > [ 85.117462] Possible unsafe locking scenario: > [ 85.117462] > [ 85.117462] CPU0 CPU1 > [ 85.128417] ---- ---- > [ 85.128417] lock(s_active#22); > [ 85.128417] lock(sysfs_lock); > [ 85.128417] lock(s_active#22); > [ 85.142486] lock(sysfs_lock); > [ 85.151794] > [ 85.151794] *** DEADLOCK *** > [ 85.151794] > [ 85.151794] 2 locks held by bash/949: > [ 85.158020] #0: (&buffer->mutex){+.+.+.}, at: [] > sysfs_write_file+0x28/0x184 [ 85.170349] #1: (s_active#22){++++.+}, > at: [] sysfs_write_file+0xdc/0x184 [ 85.170349] > [ 85.178588] stack backtrace: > [ 85.178588] [] (unwind_backtrace+0x0/0xf0) from [] > (print_circular_bug+0x100/0x114) [ 85.193023] [] > (print_circular_bug+0x100/0x114) from [] > (check_prev_add+0x680/0x698) [ 85.193023] [] > (check_prev_add+0x680/0x698) from [] > (check_prevs_add+0xdc/0x150) [ 85.212524] [] > (check_prevs_add+0xdc/0x150) from [] > (validate_chain.clone.24+0x564/0x694) [ 85.212524] [] > (validate_chain.clone.24+0x564/0x694) from [] > (__lock_acquire+0x49c/0x980) [ 85.233306] [] > (__lock_acquire+0x49c/0x980) from [] (lock_acquire+0x98/0x100) [ > 85.233306] [] (lock_acquire+0x98/0x100) from [] > (mutex_lock_nested+0x3c/0x2f4) [ 85.242614] [] > (mutex_lock_nested+0x3c/0x2f4) from [] > (gpio_value_store+0x24/0xcc) [ 85.261840] [] > (gpio_value_store+0x24/0xcc) from [] (dev_attr_store+0x18/0x24) > [ 85.261840] [] (dev_attr_store+0x18/0x24) from [] > (sysfs_write_file+0x100/0x184) [ 85.271240] [] > (sysfs_write_file+0x100/0x184) from [] (vfs_write+0xb4/0x148) [ > 85.290008] [] (vfs_write+0xb4/0x148) from [] > (sys_write+0x40/0x70) [ 85.298400] [] (sys_write+0x40/0x70) > from [] (ret_fast_syscall+0x0/0x3c) -bash: echo: write error: > Operation not permitted > > the way to trigger is: > > > root at legolas:~# cd /sys/class/gpio/ > root at legolas:/sys/class/gpio# echo 2 > export > root at legolas:/sys/class/gpio# echo 2 > unexport > root at legolas:/sys/class/gpio# echo 2 > export > root at legolas:/sys/class/gpio# cd gpio2/ > root at legolas:/sys/class/gpio/gpio2# echo 1 > value I created a Bugzilla entry at https://bugzilla.kernel.org/show_bug.cgi?id=42761 for your bug/regression report, please add your address to the CC list in there, thanks! -- Maciej Rutecki http://www.mrutecki.pl