public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Greg KH <greg@kroah.com>
Cc: Paul Mackerras <paulus@samba.org>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	linas@austin.ibm.com, Patrick Mochel <mochel@digitalimplant.org>
Subject: Re: [PATCH]  Add pci_walk_bus function to PCI core (nonrecursive)
Date: Thu, 18 Aug 2005 18:02:33 +1000	[thread overview]
Message-ID: <1124352154.5182.2.camel@gaston> (raw)
In-Reply-To: <20050818051301.GB29301@kroah.com>

On Wed, 2005-08-17 at 22:13 -0700, Greg KH wrote:
> On Thu, Aug 18, 2005 at 02:58:28PM +1000, Benjamin Herrenschmidt wrote:
> > I wonder if it's finally time to implement proper race free list
> > iterators in the kernel. Not that difficult... A small struct iterator
> > with a list head and the current elem pointer, and the "interated" list
> > containing the list itself, a list of iterators and a lock. Iterators
> > can then be "fixed" up on element removal with a fine grained lock on
> > list structure access.
> 
> Pat tried to do that with klist, but people seem to think it's still
> racy in some corner cases.  Have you looked at them?

Not specifically... I used that type of construct in a distant past and
I'm pretty sure my stuff back them was quite solid but it's all old
memories. You have to be careful about a few things, like properly
getting() the current pointed object under the lock, and that sort of
thing, but it's not that complicated. I don't know of any other mecanism
to iterate lists in a safe way without taking global locks, which we
want to avoid as that would open us to all sorts of deadlocks...

The case of trees like PCI is fine provided parents aren't removed
before all childs are removed, and thus all iterators properly
invalidated.

Now, maybe I missed something ... but in any case, it seems a lot of our
current iterating constucts are racy.

Ben.



  reply	other threads:[~2005-08-18  8:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-18  4:33 [PATCH] Add pci_walk_bus function to PCI core (nonrecursive) Paul Mackerras
2005-08-18  4:58 ` Benjamin Herrenschmidt
2005-08-18  5:13   ` Greg KH
2005-08-18  8:02     ` Benjamin Herrenschmidt [this message]
2005-08-19 16:30   ` Linas Vepstas
2005-08-20  0:10     ` Benjamin Herrenschmidt

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=1124352154.5182.2.camel@gaston \
    --to=benh@kernel.crashing.org \
    --cc=greg@kroah.com \
    --cc=linas@austin.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mochel@digitalimplant.org \
    --cc=paulus@samba.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