Re: Deadlock scenario in regulator core

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/22/2011 04:19 PM, Steven Rostedt wrote:
> 
> Looks to me that the mutex_lock() in _notifier_call_chain needs to be a
> mutex_lock_nested().
> 
> The "_nested()" versions are when you have the same type of mutex taken
> but belonging to two different instances. Like you have here:
> 
> 	blocking_notifier_call_chain(&rdev->notifier, event, NULL);
> 
> 	/* now notify regulator we supply */
> 	list_for_each_entry(_rdev, &rdev->supply_list, slist) {
> 		mutex_lock(&_rdev->mutex);
> 		_notifier_call_chain(_rdev, event, data);
> 		mutex_unlock(&_rdev->mutex);
> 	}
> 
> The rdev->mutex is already held, so we don't need to take it to call the
> blocking_notifier_call_chain() with the rdev->notifier. But then the
> list of rdev's in the rdev->supply_list are different instances but we
> are still taking the same type of lock. lockdep treats all instances of
> the same lock the same, so to lockdep this looks like a deadlock. To
> teach lockdep that this is a different instance, simply use
> mutex_lock_nested() instead.
> 
> -- Steve
> 
> 

There seem to be very few uses of mutex_lock_nested() in the kernel.  Most
of them use subclass = SINGLE_DEPTH_NESTING.  Would this be sufficient for
usage in the regulator core in _notifier_call_chain (and perhaps other
places) or should some other subclass be used?

Thanks,
David

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux