Re: [RFC PATCH v3] Use kernfs_break_active_protection() for device online store callbacks

2014-04-17 Thread Tejun Heo
Hello, On Thu, Apr 17, 2014 at 11:05:53AM +0800, Li Zhong wrote: > It seems to me cpu_add_remove_lock is always taken after > device_hotplug_lock. > > So if cpu_add_remove_lock has been acquired by device removing process, > then it means the other online/offline process couldn't successfully try

Re: [RFC PATCH v3] Use kernfs_break_active_protection() for device online store callbacks

2014-04-16 Thread Li Zhong
On Wed, 2014-04-16 at 11:17 -0400, Tejun Heo wrote: > Hello, > > On Wed, Apr 16, 2014 at 09:41:40AM +0800, Li Zhong wrote: > > > If so, that is > > > an actually possible deadlock, no? > > > > Yes, but it seems to me that it is solved in commit 5e33bc41, which uses > > lock_device_hotplug_sysfs()

Re: [RFC PATCH v3] Use kernfs_break_active_protection() for device online store callbacks

2014-04-16 Thread Tejun Heo
Hello, On Wed, Apr 16, 2014 at 09:41:40AM +0800, Li Zhong wrote: > > If so, that is > > an actually possible deadlock, no? > > Yes, but it seems to me that it is solved in commit 5e33bc41, which uses > lock_device_hotplug_sysfs() to return a restart syscall error if not > able to try lock the dev

Re: [RFC PATCH v3] Use kernfs_break_active_protection() for device online store callbacks

2014-04-15 Thread Li Zhong
On Tue, 2014-04-15 at 10:50 -0400, Tejun Heo wrote: > Hello, > > On Tue, Apr 15, 2014 at 10:44:37AM +0800, Li Zhong wrote: > > / * > > * This process might deadlock with another process trying to > > * remove this device: > > * This process holding the s_active of "online" attribute, and tr

Re: [RFC PATCH v3] Use kernfs_break_active_protection() for device online store callbacks

2014-04-15 Thread Tejun Heo
Hello, On Tue, Apr 15, 2014 at 10:44:37AM +0800, Li Zhong wrote: > / * > * This process might deadlock with another process trying to > * remove this device: > * This process holding the s_active of "online" attribute, and tries > * to online/offline the device with some locks protecting

Re: [RFC PATCH v3] Use kernfs_break_active_protection() for device online store callbacks

2014-04-14 Thread Li Zhong
On Mon, 2014-04-14 at 16:13 -0400, Tejun Heo wrote: > Hello, > > On Mon, Apr 14, 2014 at 03:47:29PM +0800, Li Zhong wrote: > > @@ -439,6 +439,7 @@ static ssize_t online_store(struct device *dev, struct > > device_attribute *attr, > > { > > bool val; > > int ret; > > + struct kernfs_nod

Re: [RFC PATCH v3] Use kernfs_break_active_protection() for device online store callbacks

2014-04-14 Thread Tejun Heo
Hello, On Mon, Apr 14, 2014 at 03:47:29PM +0800, Li Zhong wrote: > @@ -439,6 +439,7 @@ static ssize_t online_store(struct device *dev, struct > device_attribute *attr, > { > bool val; > int ret; > + struct kernfs_node *kn; > > ret = strtobool(buf, &val); > if (ret <

[RFC PATCH v3] Use kernfs_break_active_protection() for device online store callbacks

2014-04-14 Thread Li Zhong
I noticed following lockdep warning when trying acpi hot-remove cpus: [84154.204080] == [84154.204080] [ INFO: possible circular locking dependency detected ] [84154.204080] 3.14.0-next-20140408+ #24 Tainted: GW [84154.204080] ---