public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Dobson <colpatch@us.ibm.com>
To: Russell King <rmk@arm.linux.org.uk>
Cc: linux-kernel@vger.kernel.org, Greg KH <gregkh@us.ibm.com>
Subject: Re: [BUG/MEMLEAK?] struct pci_bus, child busses & bridges
Date: Thu, 25 Sep 2003 11:14:51 -0700	[thread overview]
Message-ID: <3F73309B.4070908@us.ibm.com> (raw)
In-Reply-To: 20030925095426.B30419@flint.arm.linux.org.uk

Russell King wrote:
> On Wed, Sep 24, 2003 at 05:34:03PM -0700, Matthew Dobson wrote:
> 
>>In pci_alloc_child_bus (drivers/pci/probe.c), the child bus is allocated 
>>and it's struct dev * is set to point to the struct dev belonging to the 
>>bridge that this bus is 'on', or 'behind'.  pci_alloc_child_bus is 
>>called in 3 places: pci_add_new_bus and twice in pci_scan_bridge.  The 
>>calls in pci_scan_bridge allocate a new struct pci_bus, but then seem to 
>>throw the references away, *without* freeing them.
> 
> 
> That is correct - they persist after they have been allocated until the
> bridge device is destroyed (if ever) - it's lifetime is directly equivalent
> to the lifetime of the bridge.
> 
> If you look carefully at pci_alloc_child_bus(), you will notice that
> bridge->subordinate is setup to point at the pci_bus, which provides
> a method to access the data held in the pci_bus later (eg, while we're
> freeing the structures.)

Ok, I see that now.  I guess my only remaining question is why do child 
busses not get their own struct device, but rather only a pointer to the 
bridge's struct device?  There's no refcounting done on this, ie: no 
pci_dev_get/put calls, but I guess that's kinda ok, since we're pretty 
sure that the child bus won't exist for longer than the bridge that owns 
it, right?  So using the bridge's struct dev allows the pci topology to 
look cleaner?  As in, there's no actual bus exposed in sysfs/procfs/etc, 
just devices that seem to be hanging off the bridge?

Cheers!

-Matt


  reply	other threads:[~2003-09-25 18:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-25  0:34 [BUG/MEMLEAK?] struct pci_bus, child busses & bridges Matthew Dobson
2003-09-25  8:54 ` Russell King
2003-09-25 18:14   ` Matthew Dobson [this message]
2003-09-25 18:53     ` Patrick Mochel

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=3F73309B.4070908@us.ibm.com \
    --to=colpatch@us.ibm.com \
    --cc=gregkh@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk@arm.linux.org.uk \
    /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