From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Linux PCI <linux-pci@vger.kernel.org>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>,
Tejun Heo <tj@kernel.org>
Subject: Re: [PATCH][tentative] PCI / ACPI: Rework PCI host bridge removal to avoid sysfs warnings
Date: Thu, 09 Jan 2014 01:10:26 +0100 [thread overview]
Message-ID: <1473769.SaDXEol2iJ@vostro.rjw.lan> (raw)
In-Reply-To: <CAE9FiQXYskZcfccVO6OacYchfA=cd0Ns9EF1CbwERS7MR05bUA@mail.gmail.com>
On Wednesday, January 08, 2014 03:41:52 PM Yinghai Lu wrote:
> On Mon, Jan 6, 2014 at 12:41 PM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>
> >> Not sure how that could happen.
> >>
> >> If it would really happen, we could set dev->match_driver to 0 in pci_stop_dev.
> >
> > Simply, run "modprobe -r driver && modprobe driver" in a loop and
> > remove the PCI host bridge the given device is on in parallel to that. Chances
> > are, you'll see some nice breakage.
>
> I would suggest using match_driver prevent driver from attaching again.
Yes, we can do that. Some locking is needed for it to be non-racy, however.
Anyway, we still have the problem with race conditions between different PCI
removal/rescan code paths. And I'm still going to prepare a patch to use
the remove-rescan mutex to address those race conditions and that patch should
help here too.
>
> ---
> drivers/pci/remove.c | 1 +
> 1 file changed, 1 insertion(+)
>
> Index: linux-2.6/drivers/pci/remove.c
> ===================================================================
> --- linux-2.6.orig/drivers/pci/remove.c
> +++ linux-2.6/drivers/pci/remove.c
> @@ -11,6 +11,7 @@ static void pci_stop_dev(struct pci_dev
> pci_proc_detach_device(dev);
> pci_remove_sysfs_dev_files(dev);
> device_release_driver(&dev->dev);
> + dev->match_driver = false;
> dev->is_added = 0;
> }
>
>
> >
> > Also what happens if somebody uses the "remove" sysfs attribute on a device
> > needed by ioapic/dmar?
>
> Good question, we will have problem in that case.
> To make it simple, we may hide the "remove" in sysfs for ioapic pci device ?
Yeah, we need to do that if using that attribute may lead to problems.
Thanks,
Rafael
prev parent reply other threads:[~2014-01-09 0:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-28 23:20 [PATCH][tentative] PCI / ACPI: Rework PCI host bridge removal to avoid sysfs warnings Rafael J. Wysocki
2013-12-29 3:59 ` Greg Kroah-Hartman
2013-12-30 3:30 ` Yinghai Lu
2013-12-30 12:51 ` Rafael J. Wysocki
2013-12-30 13:15 ` Rafael J. Wysocki
2013-12-31 18:45 ` Yinghai Lu
2013-12-31 21:03 ` Rafael J. Wysocki
2014-01-02 22:47 ` Yinghai Lu
2014-01-03 0:45 ` Rafael J. Wysocki
2014-01-06 19:28 ` Yinghai Lu
2014-01-06 20:41 ` Rafael J. Wysocki
2014-01-08 23:41 ` Yinghai Lu
2014-01-09 0:10 ` Rafael J. Wysocki [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1473769.SaDXEol2iJ@vostro.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=bhelgaas@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=tj@kernel.org \
--cc=yinghai@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox