From: Bjorn Helgaas <bhelgaas@google.com>
To: Yinghai Lu <yinghai@kernel.org>
Cc: linux-pci@vger.kernel.org, linux-pcmcia@lists.infradead.org,
Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Subject: Re: [PATCH v2 08/16] PCI: Stop and remove devices in one pass
Date: Mon, 20 Aug 2012 09:27:44 -0600 [thread overview]
Message-ID: <CAErSpo7-QhB742WebOb2x9LsagraXMdW2kUt-phj87KXWeF3fQ@mail.gmail.com> (raw)
In-Reply-To: <CAE9FiQX+OCFeDFfpoMNRR+QS9=hNoMS94WJ0+s4dTv6E70WRAw@mail.gmail.com>
On Fri, Aug 17, 2012 at 7:21 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> On Fri, Aug 17, 2012 at 4:36 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
>> Previously, when we removed a PCI device, we made two passes over the
>> hierarchy rooted at the device. In the first pass, we stopped all
>> the devices, and in the second, we removed them.
>>
>> This patch combines the two passes into one so that we remove a device as
>> soon as it and all its children have been stopped.
>>
>> Note that we previously stopped devices in reverse order and removed them
>> in forward order. Now we stop and remove them in reverse order.
>>
>> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
>> ---
>> drivers/pci/remove.c | 42 +++++++-----------------------------------
>> 1 files changed, 7 insertions(+), 35 deletions(-)
>
> looks like your cleanup will have some conflict with my pci root bus
> hot plug branch.
Yes, indeed, they have serious conflicts.
> http://git.kernel.org/?p=linux/kernel/git/yinghai/linux-yinghai.git;a=blob;f=drivers/pci/remove.c;h=f672731922f8db619fb36db05dbd9c27f3253c19;hb=refs/heads/for-pci-root-bus-hotplug
>
> it add pci_stop_and_remove_bus and it depends on some functions that
> you kill in this patch set.
Do you have any suggestions on how to proceed? In my opinion,
remove.c is a bit of a rat's nest right now. It took me quite a long
time to sort out what's going on, but when you finally get down to the
bottom, it's actually very simple. So I'd really like to clean it up
and expose that simple structure before we throw more stuff into it.
After my cleanup, pci_stop_and_remove_bus_device() and
pci_remove_bus() are the only exported interfaces left. How hard
would it be to implement host bridge remove on top of that?
I think it's OK (and even preferable) if the host bridge-related code
can be segregated by itself rather than being sprinkled around through
lots of PCI code. So maybe the pci_is_root_bus() and
pci_stop_host_bridge() stuff below could be in some sort of host
bridge interface that just calls the code in remove.c.
> 180 void pci_stop_and_remove_bus(struct pci_bus *bus)
> 181 {
> 182 struct pci_host_bridge *host_bridge = NULL;
> 183 struct pci_dev *pci_bridge = NULL;
> 184
> 185 pci_stop_bus_devices(bus);
> 186
> 187 if (pci_is_root_bus(bus)) {
> 188 host_bridge = to_pci_host_bridge(bus->bridge);
> 189 get_device(&host_bridge->dev);
> 190 pci_stop_host_bridge(host_bridge);
> 191 } else
> 192 pci_bridge = bus->self;
> 193
> 194 __pci_remove_bus_devices(bus);
> 195
> 196 pci_remove_bus(bus);
> 197
> 198 if (host_bridge) {
> 199 host_bridge->bus = NULL;
> 200 put_device(&host_bridge->dev);
> 201 }
> 202
> 203 if (pci_bridge)
> 204 pci_bridge->subordinate = NULL;
> 205 }
>
> Yinghai
next prev parent reply other threads:[~2012-08-20 15:28 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-17 23:35 [PATCH v2 00/16] Clean up drivers/pci/remove.c Bjorn Helgaas
2012-08-17 23:35 ` [PATCH v2 01/16] PCI: acpiphp: Stop disabling bridges on remove Bjorn Helgaas
2012-08-17 23:35 ` [PATCH v2 02/16] PCI: acpiphp: Use common pci_stop_and_remove_bus_device() Bjorn Helgaas
2012-08-17 23:36 ` [PATCH v2 03/16] pcmcia: " Bjorn Helgaas
2012-08-18 0:58 ` Yinghai Lu
2012-08-20 14:46 ` Bjorn Helgaas
2012-08-17 23:36 ` [PATCH v2 04/16] PCI: Don't export stop_bus_device and remove_bus_device interfaces Bjorn Helgaas
2012-08-17 23:36 ` [PATCH v2 05/16] PCI: Remove pci_stop_and_remove_behind_bridge() Bjorn Helgaas
2012-08-17 23:36 ` [PATCH v2 06/16] PCI: Use list_for_each_entry() for bus->devices traversal Bjorn Helgaas
2012-08-17 23:36 ` [PATCH v2 07/16] PCI: Fold stop and remove helpers into their callers Bjorn Helgaas
2012-08-17 23:36 ` [PATCH v2 08/16] PCI: Stop and remove devices in one pass Bjorn Helgaas
2012-08-18 1:21 ` Yinghai Lu
2012-08-20 15:27 ` Bjorn Helgaas [this message]
2012-08-21 5:39 ` Yinghai Lu
2012-08-22 17:40 ` Bjorn Helgaas
2012-08-17 23:36 ` [PATCH v2 09/16] PCI: Remove unused, commented-out, code Bjorn Helgaas
2012-08-17 23:36 ` [PATCH v2 10/16] PCI: Rename local variables to conventional names Bjorn Helgaas
2012-08-17 23:36 ` [PATCH v2 11/16] PCI: Leave normal LIST_POISON in deleted list entries Bjorn Helgaas
2012-08-17 23:36 ` [PATCH v2 12/16] frv/PCI: Use list_for_each_entry() for bus->devices traversal Bjorn Helgaas
2012-08-17 23:36 ` [PATCH v2 13/16] parisc/PCI: Enable PERR/SERR on all devices Bjorn Helgaas
2012-08-17 23:36 ` [PATCH v2 14/16] parisc/PCI: Use list_for_each_entry() for bus->devices traversal Bjorn Helgaas
2012-08-17 23:37 ` [PATCH v2 15/16] sgi-agp: " Bjorn Helgaas
2012-08-17 23:37 ` [PATCH v2 16/16] PCI: Remove unused pci_dev_b() Bjorn Helgaas
2012-08-20 4:58 ` [PATCH v2 00/16] Clean up drivers/pci/remove.c Yijing Wang
2012-08-20 15:40 ` Bjorn Helgaas
2012-08-21 3:45 ` Yijing Wang
2012-08-22 17:26 ` Bjorn Helgaas
2012-08-24 21:25 ` Bjorn Helgaas
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=CAErSpo7-QhB742WebOb2x9LsagraXMdW2kUt-phj87KXWeF3fQ@mail.gmail.com \
--to=bhelgaas@google.com \
--cc=kaneshige.kenji@jp.fujitsu.com \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pcmcia@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).