linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] cpufreq: Fix a circular lock dependency problem
@ 2018-07-24 18:26 Waiman Long
  2018-07-24 18:26 ` [PATCH v2 1/2] cpu/hotplug: Add a cpus_read_trylock() function Waiman Long
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Waiman Long @ 2018-07-24 18:26 UTC (permalink / raw)
  To: Rafael J. Wysocki, Viresh Kumar, Thomas Gleixner, Peter Zijlstra,
	Ingo Molnar
  Cc: linux-kernel, linux-pm, Paul E. McKenney, Greg Kroah-Hartman,
	Konrad Rzeszutek Wilk, Waiman Long

 v2:
  - Remove the retry loop in the store method.

This patchset works around a circular lock dependency issue in the
cpufreq driver reported by lockdep. The two locks involved are the
cpu_hotplup_lock and the reference count of a sysfs file.

The cpufreq_register_driver() function uses the lock sequence:

  cpus_read_lock --> kn->count

Whereas the cpufreq sysfs store method uses the sequence:

  kn->count --> cpus_read_lock

This is not really an issue as a shared lock is used on the
cpu_hotplup_lock. However, the lockdep code isn't able to handle
shared locking. So one way to work around this is to define a
cpus_read_trylock() function and uses it in the store method instead.

Waiman Long (2):
  cpu/hotplug: Add a cpus_read_trylock() function
  cpufreq: Fix a circular lock dependency problem

 drivers/cpufreq/cpufreq.c | 7 ++++++-
 include/linux/cpu.h       | 2 ++
 kernel/cpu.c              | 6 ++++++
 3 files changed, 14 insertions(+), 1 deletion(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-26  9:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-24 18:26 [PATCH v2 0/2] cpufreq: Fix a circular lock dependency problem Waiman Long
2018-07-24 18:26 ` [PATCH v2 1/2] cpu/hotplug: Add a cpus_read_trylock() function Waiman Long
2018-07-24 18:26 ` [PATCH v2 2/2] cpufreq: Fix a circular lock dependency problem Waiman Long
2018-07-26  9:06 ` [PATCH v2 0/2] " Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).