Re: [PATCH] PCI: Fix racing for pci device removing via sysfs

2013-05-08 Thread Bjorn Helgaas
On Tue, Apr 30, 2013 at 02:29:35PM -0700, Yinghai Lu wrote: > On Mon, Apr 29, 2013 at 3:17 PM, Yinghai Lu wrote: > > On Mon, Apr 29, 2013 at 11:15 AM, Bjorn Helgaas wrote: > >> > >> I think the 1a:01.0 pci_dev should retain its reference to the pci_bus > >> for as long as the pci_dev exists, so t

Re: [PATCH] PCI: Fix racing for pci device removing via sysfs

2013-04-30 Thread Yinghai Lu
On Mon, Apr 29, 2013 at 3:17 PM, Yinghai Lu wrote: > On Mon, Apr 29, 2013 at 11:15 AM, Bjorn Helgaas wrote: >> >> I think the 1a:01.0 pci_dev should retain its reference to the pci_bus >> for as long as the pci_dev exists, so the pci_bus_put() should go in >> pci_release_dev() instead. > > Good p

Re: [PATCH] PCI: Fix racing for pci device removing via sysfs

2013-04-30 Thread Gu Zheng
On 04/30/2013 02:15 AM, Bjorn Helgaas wrote: > On Mon, Apr 29, 2013 at 08:19:10AM -0700, Yinghai Lu wrote: >> On Mon, Apr 29, 2013 at 3:04 AM, Gu Zheng wrote: >>> On 04/27/2013 05:01 AM, Yinghai Lu wrote: On Fri, Apr 26, 2013 at 1:53 PM, Bjorn Helgaas wrote: > > You can't be serious

Re: [PATCH] PCI: Fix racing for pci device removing via sysfs

2013-04-29 Thread Yinghai Lu
On Mon, Apr 29, 2013 at 11:15 AM, Bjorn Helgaas wrote: > On Mon, Apr 29, 2013 at 08:19:10AM -0700, Yinghai Lu wrote: >> ok, i missed that. if we can use LIST_POISON, then could be more simple. >> like -v4. > > I inlined your v4 patch below for convenience. > > Maybe my allergic reaction to your us

Re: [PATCH] PCI: Fix racing for pci device removing via sysfs

2013-04-29 Thread Greg Kroah-Hartman
On Mon, Apr 29, 2013 at 02:23:50PM -0700, Sarah Sharp wrote: > On Mon, Apr 29, 2013 at 11:21:42AM -0700, Greg Kroah-Hartman wrote: > > On Mon, Apr 29, 2013 at 11:15:50AM -0700, Bjorn Helgaas wrote: > > > On Mon, Apr 29, 2013 at 08:19:10AM -0700, Yinghai Lu wrote: > > > > On Mon, Apr 29, 2013 at 3:0

Re: [PATCH] PCI: Fix racing for pci device removing via sysfs

2013-04-29 Thread Sarah Sharp
On Mon, Apr 29, 2013 at 11:21:42AM -0700, Greg Kroah-Hartman wrote: > On Mon, Apr 29, 2013 at 11:15:50AM -0700, Bjorn Helgaas wrote: > > On Mon, Apr 29, 2013 at 08:19:10AM -0700, Yinghai Lu wrote: > > > On Mon, Apr 29, 2013 at 3:04 AM, Gu Zheng wrote: > > > > On 04/27/2013 05:01 AM, Yinghai Lu wro

Re: [PATCH] PCI: Fix racing for pci device removing via sysfs

2013-04-29 Thread Greg Kroah-Hartman
On Mon, Apr 29, 2013 at 11:15:50AM -0700, Bjorn Helgaas wrote: > On Mon, Apr 29, 2013 at 08:19:10AM -0700, Yinghai Lu wrote: > > On Mon, Apr 29, 2013 at 3:04 AM, Gu Zheng wrote: > > > On 04/27/2013 05:01 AM, Yinghai Lu wrote: > > >> On Fri, Apr 26, 2013 at 1:53 PM, Bjorn Helgaas > > >> wrote: >

Re: [PATCH] PCI: Fix racing for pci device removing via sysfs

2013-04-29 Thread Bjorn Helgaas
On Mon, Apr 29, 2013 at 08:19:10AM -0700, Yinghai Lu wrote: > On Mon, Apr 29, 2013 at 3:04 AM, Gu Zheng wrote: > > On 04/27/2013 05:01 AM, Yinghai Lu wrote: > >> On Fri, Apr 26, 2013 at 1:53 PM, Bjorn Helgaas wrote: > >>> > >>> You can't be serious. This is a disgusting mess. Checking a list >

Re: [PATCH] PCI: Fix racing for pci device removing via sysfs

2013-04-29 Thread Yinghai Lu
On Mon, Apr 29, 2013 at 3:04 AM, Gu Zheng wrote: > Hi Yinghai, > > On 04/27/2013 05:01 AM, Yinghai Lu wrote: > >> On Fri, Apr 26, 2013 at 1:53 PM, Bjorn Helgaas wrote: >> >>> >>> You can't be serious. This is a disgusting mess. Checking a list >>> pointer for LIST_POISON1? As far as I'm concer

Re: [PATCH] PCI: Fix racing for pci device removing via sysfs

2013-04-29 Thread Gu Zheng
Hi Yinghai, On 04/27/2013 05:01 AM, Yinghai Lu wrote: > On Fri, Apr 26, 2013 at 1:53 PM, Bjorn Helgaas wrote: > >> >> You can't be serious. This is a disgusting mess. Checking a list >> pointer for LIST_POISON1? As far as I'm concerned, this is a waste of >> my time. > > Well, then need to

Re: [PATCH] PCI: Fix racing for pci device removing via sysfs

2013-04-26 Thread Yinghai Lu
On Fri, Apr 26, 2013 at 1:53 PM, Bjorn Helgaas wrote: > > You can't be serious. This is a disgusting mess. Checking a list > pointer for LIST_POISON1? As far as I'm concerned, this is a waste of > my time. Well, then need to hold the bus ref, and check bus->devices list instead. fix_racing_

Re: [PATCH] PCI: Fix racing for pci device removing via sysfs

2013-04-26 Thread Bjorn Helgaas
On Fri, Apr 26, 2013 at 2:20 PM, Yinghai Lu wrote: > On Fri, Apr 26, 2013 at 9:28 AM, Bjorn Helgaas wrote: >> This is a gross hack. Iterating through all known pci_devs to see if >> this one still exists? >> >> I reproduced the original problem, applied this patch, and verified >> that it avoids

Re: [PATCH] PCI: Fix racing for pci device removing via sysfs

2013-04-26 Thread Yinghai Lu
On Fri, Apr 26, 2013 at 9:28 AM, Bjorn Helgaas wrote: > This is a gross hack. Iterating through all known pci_devs to see if > this one still exists? > > I reproduced the original problem, applied this patch, and verified > that it avoids the original crash. > > However, it's still incorrect beca

Re: [PATCH] PCI: Fix racing for pci device removing via sysfs

2013-04-26 Thread Bjorn Helgaas
On Thu, Apr 25, 2013 at 7:47 PM, Yinghai Lu wrote: > Gu found nested removing through > echo -n 1 > /sys/bus/pci/devices/\:10\:00.0/remove ; echo -n 1 > > /sys/bus/pci/devices/\:1a\:01.0/remove > > will cause kernel crash as bus get freed. > > [ 418.946462] CPU 4 > [ 418.968377]

[PATCH] PCI: Fix racing for pci device removing via sysfs

2013-04-25 Thread Yinghai Lu
Gu found nested removing through echo -n 1 > /sys/bus/pci/devices/\:10\:00.0/remove ; echo -n 1 > /sys/bus/pci/devices/\:1a\:01.0/remove will cause kernel crash as bus get freed. [ 418.946462] CPU 4 [ 418.968377] Pid: 512, comm: kworker/u:2 Tainted: GW3.8.0 #2 FUJITS