[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAE9FiQUXxCH0xjFPk1S7e_JRsBPosqQ=N5Kpcrjp3RNWDh9yZQ@mail.gmail.com>
Date: Mon, 29 Apr 2013 08:19:10 -0700
From: Yinghai Lu <yinghai@...nel.org>
To: Gu Zheng <guz.fnst@...fujitsu.com>
Cc: Bjorn Helgaas <bhelgaas@...gle.com>,
"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Sarah Sharp <sarah.a.sharp@...ux.intel.com>
Subject: Re: [PATCH] PCI: Fix racing for pci device removing via sysfs
On Mon, Apr 29, 2013 at 3:04 AM, Gu Zheng <guz.fnst@...fujitsu.com> wrote:
> Hi Yinghai,
>
> On 04/27/2013 05:01 AM, Yinghai Lu wrote:
>
>> On Fri, Apr 26, 2013 at 1:53 PM, Bjorn Helgaas <bhelgaas@...gle.com> 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.
looks like xhci is using that LIST_POISON1 ...
>>
>> Well, then need to hold the bus ref, and check bus->devices list instead.
>
> @@ -341,6 +352,7 @@ remove_store(struct device *dev, struct
> {
> int err;
> unsigned long val;
> + struct pci_dev *pdev;
>
> if (strict_strtoul(buf, 0, &val) < 0)
> return -EINVAL;
> @@ -351,9 +363,14 @@ remove_store(struct device *dev, struct
> /* An attribute cannot be unregistered by one of its own methods,
> * so we have to use this roundabout approach.
> */
> + pdev = pci_dev_get(to_pci_dev(dev));
>
> There is no need to increase pci_dev's ref here, because we'll increase it
> in sysfs_schedule_callback.
ok, i missed that. if we can use LIST_POISON, then could be more simple.
like -v4.
>
> + get_device(&pdev->bus->dev);
>
> So the pci_bus' ref management is still needed.
No, we don't need that as first pci_stop_and_remove_bus_device()
already drop that reference.
Yinghai
Download attachment "fix_racing_removing_4.patch" of type "application/octet-stream" (2923 bytes)
Powered by blists - more mailing lists