Dave, is this the same? http://marc.info/?l=linux-kernel&m=127207512031810&w=2 I produced this one by running "find /sys | xargs cat" [ 2982.773548] [ INFO: possible circular locking dependency detected ] [ 2982.773551] 2.6.34-rc5-git7 #33 [ 2982.773554] ------------------------------------------------------- [ 2982.773557] head/6335 is trying to acquire lock: [ 2982.773560] (&per_cpu(cpu_policy_rwsem, cpu)){+++++.}, at: [<ffffffff8139f077>] lock_policy_rwsem_read+0x4a/0x7a [ 2982.773571] [ 2982.773572] but task is already holding lock: [ 2982.773575] (s_active#102){++++.+}, at: [<ffffffff81153a23>] sysfs_read_file+0x8d/0x139 [ 2982.773586] [ 2982.773586] which lock already depends on the new lock. [ 2982.773587] [ 2982.773590] [ 2982.773591] the existing dependency chain (in reverse order) is: [ 2982.773593] [ 2982.773594] -> #2 (s_active#102){++++.+}: [ 2982.773601] [<ffffffff8107654d>] __lock_acquire+0xb59/0xd11 [ 2982.773608] [<ffffffff8107681a>] lock_acquire+0x115/0x150 [ 2982.773613] [<ffffffff81154556>] sysfs_deactivate+0x9b/0xec [ 2982.773619] [<ffffffff81154d0a>] sysfs_addrm_finish+0x31/0x50 [ 2982.773624] [<ffffffff81152e05>] sysfs_hash_and_remove+0x4e/0x65 [ 2982.773629] [<ffffffff81155fc0>] sysfs_remove_group+0x8c/0xc5 [ 2982.773634] [<ffffffffa00a3d26>] cpufreq_governor_dbs+0x2a6/0x33c [cpufreq_ondemand] [ 2982.773642] [<ffffffff8139da32>] __cpufreq_governor+0x5d/0xa3 [ 2982.773648] [<ffffffff8139e4e2>] __cpufreq_remove_dev+0x231/0x2e2 [ 2982.773653] [<ffffffff81454e40>] cpufreq_cpu_callback+0x62/0x7a [ 2982.773660] [<ffffffff8145d636>] notifier_call_chain+0x63/0x97 [ 2982.773666] [<ffffffff810680dc>] __raw_notifier_call_chain+0x9/0xb [ 2982.773672] [<ffffffff8144337b>] _cpu_down+0x90/0x29e [ 2982.773679] [<ffffffff81048cd7>] disable_nonboot_cpus+0x6f/0x105 [ 2982.773685] [<ffffffff81083b94>] suspend_devices_and_enter+0xe8/0x1ec [ 2982.773691] ...
On Mon, Apr 26, 2010 at 09:30:41PM -0400, Miles Lane wrote: > Dave, is this the same? http://marc.info/?l=linux-kernel&m=127207512031810&w=2 looks like it to me. 499bca9b6d3243f9278a1f5a22d00e67acdd844d should have fixed it, but it looks like that's present in -git7, so something is still missing.. Dave > I produced this one by running "find /sys | xargs cat" > > [ 2982.773548] [ INFO: possible circular locking dependency detected ] > [ 2982.773551] 2.6.34-rc5-git7 #33 > [ 2982.773554] ------------------------------------------------------- > [ 2982.773557] head/6335 is trying to acquire lock: > [ 2982.773560] (&per_cpu(cpu_policy_rwsem, cpu)){+++++.}, at: > [<ffffffff8139f077>] lock_policy_rwsem_read+0x4a/0x7a > [ 2982.773571] > [ 2982.773572] but task is already holding lock: > [ 2982.773575] (s_active#102){++++.+}, at: [<ffffffff81153a23>] > sysfs_read_file+0x8d/0x139 > [ 2982.773586] > [ 2982.773586] which lock already depends on the new lock. > [ 2982.773587] > [ 2982.773590] > [ 2982.773591] the existing dependency chain (in reverse order) is: > [ 2982.773593] > [ 2982.773594] -> #2 (s_active#102){++++.+}: > [ 2982.773601] [<ffffffff8107654d>] __lock_acquire+0xb59/0xd11 > [ 2982.773608] [<ffffffff8107681a>] lock_acquire+0x115/0x150 > [ 2982.773613] [<ffffffff81154556>] sysfs_deactivate+0x9b/0xec > [ 2982.773619] [<ffffffff81154d0a>] sysfs_addrm_finish+0x31/0x50 > [ 2982.773624] [<ffffffff81152e05>] sysfs_hash_and_remove+0x4e/0x65 > [ 2982.773629] [<ffffffff81155fc0>] sysfs_remove_group+0x8c/0xc5 > [ 2982.773634] [<ffffffffa00a3d26>] > cpufreq_governor_dbs+0x2a6/0x33c [cpufreq_ondemand] > [ 2982.773642] [<ffffffff8139da32>] __cpufreq_governor+0x5d/0xa3 > [ 2982.773648] [<ffffffff8139e4e2>] __cpufreq_remove_dev+0x231/0x2e2 > [ 2982.773653] [<ffffffff81454e40>] cpufreq_cpu_callback+0x62/0x7a > [ 2982.773660] [<ffffffff8145d636>] ...
Ah, this is almost a totally different bug. I will check it tomorrow. Thanks! --
(Adding Eric B. into Cc.) With Eric B.'s patch, lockdep will treat s_active as a rwsem too, thus causes this warning... Thanks. --
Something seems to be missing from the trace I was copied on, but this appears to be a classic case of holding a lock over removing a sysfs attribute that the sysfs attribute grabs in it's show or store method. The kernel blocks when a sysfs attribute is removed waiting for all in process readers and writers to finish. The removes the need for nasty module refcounting, and concerns about data being accessed after it has been freed. Eric --
Hmm, I see the problem now. Lockdep chose a wrong target to blame. There is a circular locking between writing to cpufreq sysfs files and suspend, the cpu offline notifier of cpufreq, i.e. cpufreq_cpu_callback() also tries to remove an sysfs file while the cpufreq daemon is writing an sysfs file. Dave, any ideas about how to fix this? Thanks. --
