linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2] ARM: omap2+: omap_hwmod: Set unique lock_class_key per hwmod
@ 2015-02-10 12:23 Peter Ujfalusi
  2015-02-10 20:20 ` Paul Walmsley
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Ujfalusi @ 2015-02-10 12:23 UTC (permalink / raw)
  To: linux-arm-kernel

Add struct lock_class_key to omap_hwmod struct and use it to set unique
lockdep class per hwmod.
This will ensure that lockdep will know that each omap_hwmod->_lock should
be treated as separate class and will not give false warning about deadlock
or other issues due to nested use of hwmods.
DRA7x's ATL hwmod is one example for this since McASP can select ATL clock
as functional clock, which will trigger nested oh->_lock usage. This will
trigger false warning from lockdep validator as it is dealing with classes
and for it all hwmod clocks are the same class.

Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 arch/arm/mach-omap2/omap_hwmod.c | 1 +
 arch/arm/mach-omap2/omap_hwmod.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 92afb723dcfc..2db380420b6f 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -2698,6 +2698,7 @@ static int __init _register(struct omap_hwmod *oh)
 	INIT_LIST_HEAD(&oh->master_ports);
 	INIT_LIST_HEAD(&oh->slave_ports);
 	spin_lock_init(&oh->_lock);
+	lockdep_set_class(&oh->_lock, &oh->hwmod_key);
 
 	oh->_state = _HWMOD_STATE_REGISTERED;
 
diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
index 9d4bec6ee742..9611c91d9b82 100644
--- a/arch/arm/mach-omap2/omap_hwmod.h
+++ b/arch/arm/mach-omap2/omap_hwmod.h
@@ -674,6 +674,7 @@ struct omap_hwmod {
 	u32				_sysc_cache;
 	void __iomem			*_mpu_rt_va;
 	spinlock_t			_lock;
+	struct lock_class_key		hwmod_key; /* unique lock class */
 	struct list_head		node;
 	struct omap_hwmod_ocp_if	*_mpu_port;
 	unsigned int			(*xlate_irq)(unsigned int);
-- 
2.3.0

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

* [PATCHv2] ARM: omap2+: omap_hwmod: Set unique lock_class_key per hwmod
  2015-02-10 12:23 [PATCHv2] ARM: omap2+: omap_hwmod: Set unique lock_class_key per hwmod Peter Ujfalusi
@ 2015-02-10 20:20 ` Paul Walmsley
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Walmsley @ 2015-02-10 20:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 10 Feb 2015, Peter Ujfalusi wrote:

> Add struct lock_class_key to omap_hwmod struct and use it to set unique
> lockdep class per hwmod.
> This will ensure that lockdep will know that each omap_hwmod->_lock should
> be treated as separate class and will not give false warning about deadlock
> or other issues due to nested use of hwmods.
> DRA7x's ATL hwmod is one example for this since McASP can select ATL clock
> as functional clock, which will trigger nested oh->_lock usage. This will
> trigger false warning from lockdep validator as it is dealing with classes
> and for it all hwmod clocks are the same class.
> 
> Suggested-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

Thanks queued for v3.20-rc.


- Paul

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

end of thread, other threads:[~2015-02-10 20:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-10 12:23 [PATCHv2] ARM: omap2+: omap_hwmod: Set unique lock_class_key per hwmod Peter Ujfalusi
2015-02-10 20:20 ` Paul Walmsley

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).