]> git.karo-electronics.de Git - linux-beck.git/commit
kobject: delayed kobject release: help find buggy drivers
authorRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 27 Jun 2013 14:06:14 +0000 (15:06 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jul 2013 22:39:04 +0000 (15:39 -0700)
commitc817a67ecba7c3c2aaa104796d78f160af60920d
tree6c23ee30ef86aeebe0ff75d60881aa6561951c9a
parent7c42721fe0c58a848849b43ff558cf2fb86aa35a
kobject: delayed kobject release: help find buggy drivers

Implement debugging for kobject release functions.  kobjects are
reference counted, so the drop of the last reference to them is not
predictable. However, the common case is for the last reference to be
the kobject's removal from a subsystem, which results in the release
function being immediately called.

This can hide subtle bugs, which can occur when another thread holds a
reference to the kobject at the same time that a kobject is removed.
This results in the release method being delayed.

In order to make these kinds of problems more visible, the following
patch implements a delayed release; this has the effect that the
release function will be out of order with respect to the removal of
the kobject in the same manner that it would be if a reference was
being held.

This provides us with an easy way to allow driver writers to debug
their drivers and fix otherwise hidden problems.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/kobject.h
lib/Kconfig.debug
lib/kobject.c