Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1220402 > unrolled thread
| Started by | "Rafael J. Wysocki" <rjw@rjwysocki.net> |
|---|---|
| First post | 2015-09-07 23:10 +0200 |
| Last post | 2015-09-09 00:10 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Possible deadlock related to CPU hotplug and kernfs "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-09-07 23:10 +0200
Re: Possible deadlock related to CPU hotplug and kernfs Peter Zijlstra <peterz@infradead.org> - 2015-09-08 12:50 +0200
Re: Possible deadlock related to CPU hotplug and kernfs "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-09-09 00:10 +0200
| From | "Rafael J. Wysocki" <rjw@rjwysocki.net> |
|---|---|
| Date | 2015-09-07 23:10 +0200 |
| Subject | Re: Possible deadlock related to CPU hotplug and kernfs |
| Message-ID | <q6bPQ-gZ-25@gated-at.bofh.it> |
On Monday, September 07, 2015 11:11:19 AM Jiang Liu wrote: > On 2015/9/4 22:16, Rafael J. Wysocki wrote: > > Hi, > > > > On Fri, Sep 4, 2015 at 9:20 AM, Jiang Liu <jiang.liu@linux.intel.com> wrote: > >> On 2015/9/4 4:08, Rafael J. Wysocki wrote: > >>> Hi Tejun, > >>> > >>> On Thu, Sep 3, 2015 at 6:19 PM, Tejun Heo <tj@kernel.org> wrote: > >>>> Hello, Rafael. > >>>> > >>>> On Thu, Sep 03, 2015 at 02:58:16AM +0200, Rafael J. Wysocki wrote: > >>>>> So acpi_device_hotplug() calls lock_device_hotplug() which simply > >>>>> acquires device_hotplug_lock. It is held throughout the entire > >>>>> hot-add/hot-remove code path. > >>>>> > >>>>> Witing anything to /sys/devices/system/cpu/cpux/online goes through > >>>>> online_store() in drivers/base/core.c and that does > >>>>> lock_device_hotplug_sysfs() which then attempts to acquire > >>>>> device_hotplug_lock using mutex_trylock(). And it only calls > >>>>> either device_online() or device_offline() if it ends up with the > >>>>> lock held. > >>>>> > >>>>> Quite frankly, I don't see how these particular two code paths can > >>>>> deadlock in any way. > >>>>> > >>>>> So either a third code path is involved which is not executed > >>>>> under device_hotplug_lock, or lockdep needs to be told to actually > >>>>> take device_hotplug_lock into account in this case IMO. > >>>> > >>>> Hmm... all sysfs rw functions are protected from removal. ie. by > >>>> default, removal of a sysfs file drains in-flight rw operations, so > >>>> the hot plug path grabs a lock and then tries to remove a file and > >>>> writing to the online file makes the file's write method to try to > >>>> grab the same lock. It deadlocks if the hotunplug path already has > >>>> the lock and trying to drain the online file for removal. > >>> > >>> My point is that you cannot get into that situation. If hotplug > >>> already holds device_hotplug_lock, the write to "online" will end up > >>> doing restart_syscall(). > >>> > >>> If the "online" code path is holding the lock, hotplug cannot acquire > >>> it and cannot proceed. > >>> > >>> Am I missing anything? > >> Hi Rafael, > >> I think your are right. The lock_device_hotplug_sysfs() has > >> already provided a solution for such a deadlock scenario. And there's > >> another related code path at boot as: > >> smp_init() > >> ->cpu_up() > >> ->cpu_hotplug_begin() > >> So it seems to be a false alarm. Any way to teach lockdep > >> about this to get rid of the false alarm? > > > > Well, maybe we could call lock_device_hotplug() from that code path too? > Hi Rafael, > Adding lock_device_hotplug() to smp_init() doesn't solve the > issue. So it seems to be an false alarm of lockdep, and I don't know > how to get rid of such an lockdep false alarm:( Peter, Ingo, some help from lockdep expert is needed. We have a splat that almost certainly is a false positive (the original report is here http://marc.info/?l=linux-kernel&m=144109156901959&w=4) and no ideas how to make it go away. Can you please have a look and advise? Rafael -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2015-09-08 12:50 +0200 |
| Message-ID | <q6oDn-1OS-5@gated-at.bofh.it> |
| In reply to | #1220402 |
On Mon, Sep 07, 2015 at 11:33:21PM +0200, Rafael J. Wysocki wrote: > On Monday, September 07, 2015 11:11:19 AM Jiang Liu wrote: > Peter, Ingo, some help from lockdep expert is needed. > > We have a splat that almost certainly is a false positive (the original report > is here http://marc.info/?l=linux-kernel&m=144109156901959&w=4) and no ideas > how to make it go away. Can you please have a look and advise? I can't even find the relevant code :/ From that email I get kernfs_fop_write() which calls kernfs_get_active(), but that does _NOT_ call cpu_up(), so that callchain is shite. The actual lockdep splat is also not really helpful, and is spraying names over: acpi, device, sysfs and kernfs (do we really need that many layeres of obfuscation for a simple file?) So, please, start by explaining the thing proper such that simple people like me know what to look for. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "Rafael J. Wysocki" <rjw@rjwysocki.net> |
|---|---|
| Date | 2015-09-09 00:10 +0200 |
| Message-ID | <q6zfs-rN-7@gated-at.bofh.it> |
| In reply to | #1220689 |
On Tuesday, September 08, 2015 12:40:08 PM Peter Zijlstra wrote: > On Mon, Sep 07, 2015 at 11:33:21PM +0200, Rafael J. Wysocki wrote: > > On Monday, September 07, 2015 11:11:19 AM Jiang Liu wrote: > > Peter, Ingo, some help from lockdep expert is needed. > > > > We have a splat that almost certainly is a false positive (the original report > > is here http://marc.info/?l=linux-kernel&m=144109156901959&w=4) and no ideas > > how to make it go away. Can you please have a look and advise? > > I can't even find the relevant code :/ > > From that email I get kernfs_fop_write() which calls > kernfs_get_active(), but that does _NOT_ call cpu_up(), so that > callchain is shite. > > The actual lockdep splat is also not really helpful, and is spraying > names over: acpi, device, sysfs and kernfs (do we really need that many > layeres of obfuscation for a simple file?) > > So, please, start by explaining the thing proper such that simple people > like me know what to look for. OK, I'll try to get that later this week. Or maybe Jiang Liu can beat me to doing that. :-) Thanks, Rafael -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web