public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [RFC] PCI device list locking
Date: Tue, 17 Jun 2003 15:23:59 -0700	[thread overview]
Message-ID: <20030617222359.GA1326@kroah.com> (raw)
In-Reply-To: <20030617151335.A17117@figure1.int.wirex.com>

On Tue, Jun 17, 2003 at 03:13:35PM -0700, Chris Wright wrote:
> * Greg KH (greg@kroah.com) wrote:
> > 
> > Comments?  Places I missed protecting?
> 
> Is it safe to ignore pcibios_init?  This happens after smp_init, but are
> could there be multiple events (that would effect pcibios_sort)?

Yes, I'm ignoring the PCI startup code for now.  That's a twisty maze of
horrible passages that I'm going to try to tackle after this step...

> > --- a/drivers/pci/proc.c	Tue Jun 17 12:47:27 2003
> > +++ b/drivers/pci/proc.c	Tue Jun 17 12:47:27 2003
> > @@ -12,6 +12,7 @@
> >  #include <linux/proc_fs.h>
> >  #include <linux/seq_file.h>
> >  #include <linux/smp_lock.h>
> > +#include "pci.h"
> >  
> >  #include <asm/uaccess.h>
> >  #include <asm/byteorder.h>
> > @@ -311,20 +312,32 @@
> >  	struct list_head *p = &pci_devices;
> >  	loff_t n = *pos;
> >  
> > -	/* XXX: surely we need some locking for traversing the list? */
> > +	spin_lock(&pci_bus_lock);
> 
> should you just grab this lock here (pci_seq_start), and release in
> pci_seq_stop, holding for duration of ->seq_start() ->seq_next()
> ->seq_stop().  IOW, what happens when you grab list element in
> ->seq_start(), it's removed from list, you reference a bogus ->next
> pointer in ->seq_next()?

Hm, good point.  Let me go check to see if we invalidate a ->next
pointer when we remove the device...

Ugh, we don't.  And what's even worse is that data could be gone...

I'll work on this one a bit...

thanks for taking a look at this.

greg k-h

  reply	other threads:[~2003-06-17 22:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-17 21:26 [RFC] PCI device list locking Greg KH
2003-06-17 22:13 ` Chris Wright
2003-06-17 22:23   ` Greg KH [this message]
2003-06-17 22:51 ` Andrew Morton

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=20030617222359.GA1326@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@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