From: Craig Christophel <merlin@transgeek.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: [PATCH] PCI device list locking
Date: Tue, 05 Mar 2002 01:12:42 +0000 [thread overview]
Message-ID: <marc-linux-hotplug-101529087208425@msgid-missing> (raw)
In-Reply-To: <marc-linux-hotplug-101528672932410@msgid-missing>
Also if there is only infrequent useage of the list to change the list,
perhaps you should use a rwlock_t instead. It's just as light as a spinlock
but has the advantage of allowing multiple readers.
Craig.
On Monday 04 March 2002 19:17, Greg KH wrote:
> On Mon, Mar 04, 2002 at 03:54:11PM -0800, john stultz wrote:
> > @@ -605,10 +620,12 @@
> > int count = 0;
> >
> > list_add_tail(&drv->node, &pci_drivers);
> > + spin_lock(&pcidevlist_lock);
> > pci_for_each_dev(dev) {
> > if (!pci_dev_driver(dev))
> > count += pci_announce_device(drv, dev);
> > }
> > + spin_unlock(&pcidevlist_lock);
> > return count;
> > }
>
> pci_announce_device() calls the pci driver's probe() function, which can
> easily sleep. Not a good thing :(
>
> > @@ -1935,9 +1959,11 @@
> >
> > pcibios_init();
> >
> > + spin_lock(&pcidevlist_lock);
> > pci_for_each_dev(dev) {
> > pci_fixup_device(PCI_FIXUP_FINAL, dev);
> > }
> > + spin_unlock(&pcidevlist_lock);
> >
> > #ifdef CONFIG_PM
> > pm_register(PM_PCI_DEV, 0, pci_pm_callback);
>
> pci_fixup_device() might also be able to sleep, but I didn't go through
> all of the different fixup calls to make sure. Did you look at these?
>
> > diff -u linux24/drivers/pci/setup-bus.c:1.1.1.1
> > linux24/drivers/pci/setup-bus.c:1.1.1.1.28.3 ---
> > linux24/drivers/pci/setup-bus.c:1.1.1.1 Tue Dec 18 15:49:16 2001 +++
> > linux24/drivers/pci/setup-bus.c Mon Mar 4 15:33:30 2002
> > @@ -222,9 +222,11 @@
> > ranges.found_vga = 0;
> > pbus_assign_resources(b, &ranges);
> > }
> > + spin_lock(&pcidevlist_lock);
> > pci_for_each_dev(dev) {
> > pdev_enable_device(dev);
> > }
> > + spin_unlock(&pcidevlist_lock);
> > }
> >
> > /* Check whether the bridge supports I/O forwarding.
>
> Can all implementations of pci_write_config_* be safely called with a
> spinlock held?
>
> In short, I don't think you can use a spinlock, but rather a semaphore
> is probably necessary.
>
> thanks,
>
> greg k-h
>
> _______________________________________________
> Kernel-janitor-discuss mailing list
> Kernel-janitor-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/kernel-janitor-discuss
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
next prev parent reply other threads:[~2002-03-05 1:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-04 23:54 [PATCH] PCI device list locking john stultz
2002-03-05 0:17 ` Greg KH
2002-03-05 1:05 ` john stultz
2002-03-05 1:12 ` Craig Christophel [this message]
2002-03-05 1:47 ` john stultz
2002-03-06 1:31 ` Martin Diehl
2002-03-10 12:07 ` Martin Mares
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=marc-linux-hotplug-101529087208425@msgid-missing \
--to=merlin@transgeek.com \
--cc=linux-hotplug@vger.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;
as well as URLs for NNTP newsgroup(s).