lkml.org 
[lkml]   [2012]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [ 02/38] PCI/PM: Fix deadlock when unbinding device if parent in D3cold
From
Date
On Mon, 2012-11-26 at 11:30 -0800, Greg Kroah-Hartman wrote:
> On Mon, Nov 26, 2012 at 11:08:18AM -0800, Greg Kroah-Hartman wrote:
> > On Mon, Nov 26, 2012 at 10:55:05AM -0800, Greg Kroah-Hartman wrote:
> > > On Fri, Nov 23, 2012 at 11:09:37AM +0800, Huang Ying wrote:
> > > > On Fri, 2012-11-23 at 02:35 +0000, Ben Hutchings wrote:
> > > > > On Wed, 2012-11-21 at 16:39 -0800, Greg Kroah-Hartman wrote:
> > > > > > 3.0-stable review patch. If anyone has any objections, please let me know.
> > > > > >
> > > > > > ------------------
> > > > > >
> > > > > > From: Huang Ying <ying.huang@intel.com>
> > > > > >
> > > > > > commit 90b5c1d7c45eeb622302680ff96ed30c1a2b6f0e upstream.
> > > > > >
> > > > > > If a PCI device and its parents are put into D3cold, unbinding the
> > > > > > device will trigger deadlock as follow:
> > > > > >
> > > > > > - driver_unbind
> > > > > > - device_release_driver
> > > > > > - device_lock(dev) <--- previous lock here
> > > > > > - __device_release_driver
> > > > > > - pm_runtime_get_sync
> > > > > > ...
> > > > > > - rpm_resume(dev)
> > > > > > - rpm_resume(dev->parent)
> > > > > > ...
> > > > > > - pci_pm_runtime_resume
> > > > > > ...
> > > > > > - pci_set_power_state
> > > > > > - __pci_start_power_transition
> > > > > > - pci_wakeup_bus(dev->parent->subordinate)
> > > > > > - pci_walk_bus
> > > > > > - device_lock(dev) <--- deadlock here
> > > > > >
> > > > > >
> > > > > > If we do not do device_lock in pci_walk_bus, we can avoid deadlock.
> > > > > > Device_lock in pci_walk_bus is introduced in commit:
> > > > > > d71374dafbba7ec3f67371d3b7e9f6310a588808, corresponding email thread
> > > > > > is: https://lkml.org/lkml/2006/5/26/38. The patch author Zhang Yanmin
> > > > > > said device_lock is added to pci_walk_bus because:
> > > > > >
> > > > > > Some error handling functions call pci_walk_bus. For example, PCIe
> > > > > > aer. Here we lock the device, so the driver wouldn't detach from the
> > > > > > device, as the cb might call driver's callback function.
> > > > > >
> > > > > > So I fixed the deadlock as follows:
> > > > > >
> > > > > > - remove device_lock from pci_walk_bus
> > > > > > - add device_lock into callback if callback will call driver's callback
> > > > > >
> > > > > > I checked pci_walk_bus users one by one, and found only PCIe aer needs
> > > > > > device lock.
> > > > > [...]
> > > > >
> > > > > What about eeh_report_error() in
> > > > > arch/powerpc/platforms/pseries/eeh_driver.c?
> > > >
> > > > En... Because pci_walk_bus() invocation is removed in 3.7, so this
> > > > patch is only valid for 3.7. We need another version for 3.6.
> > > >
> > > > > Also, is the deadlock even possible before this change in Linux 3.6?
> > > > >
> > > > > commit 448bd857d48e69b33ef323739dc6d8ca20d4cda7
> > > > > Author: Huang Ying <ying.huang@intel.com>
> > > > > Date: Sat Jun 23 10:23:51 2012 +0800
> > > > >
> > > > > PCI/PM: add PCIe runtime D3cold support
> > > >
> > > > Before this, there will be no deadlock. So we do not need fixes before
> > > > Linux 3.6.
> > >
> > > So the first patch mentioned here should not be included in the 3.0 and
> > > 3.4 stable kernel releases?
> >
> > Ok, I've dropped the patch from 3.0 and 3.4-stable trees now.
> >
> > For 3.6, what should I do?
>
> Ok, for now, I've dropped this patch from 3.6-stable as well. If you
> think it still needs to go there, can you provide something that works?
> I see you posted one patch in this thread, but I don't understand if
> that is what needs to go upstream in Linus's tree, or if it is for the
> 3.6-stable tree. Please clarify.

Sorry for late. The patch I posted in this thread is for 3.6-stable
tree. But I have no powerpc machine to test it, just build test it.

Best Regards,
Huang Ying




\
 
 \ /
  Last update: 2012-11-27 01:41    [W:0.086 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site