From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
To: Alex Chiang <achiang@hp.com>
Cc: jbarnes@virtuousgeek.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 05/11] PCI: beef up pci_do_scan_bus()
Date: Thu, 19 Mar 2009 11:15:31 +0900 [thread overview]
Message-ID: <49C1AAC3.80406@jp.fujitsu.com> (raw)
In-Reply-To: <20090318203934.GC20467@ldl.fc.hp.com>
Alex Chiang wrote:
> * Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>:
>> Alex Chiang wrote:
>>> The more I think about it though, the more I think that even
>>> without the below patch to clean up the callers of
>>> pci_do_scan_bus, we should be ok, because:
>>>
>>> - all the old code (which I removed below) existed
>>> because the old PCI core would refuse to scan PCI buses
>>> that had already been discovered
>>>
>>> - that meant that it would never descend past a known
>>> bridge to try and find new child bridges
>>>
>>> - that meant that hotplug drivers had to manually
>>> discover new bridges and add them, essentially
>>> duplicating functionality in pci_scan_bridge
>>>
>>> This patch series allows the PCI core to scan existing bridges
>>> and descend down into the children every time, looking for new
>>> bridges and devices, so all the code in shpchp, cpcihp, and other
>>> callers of pci_do_scan_bus shouldn't be necessary anymore.
>>>
>>> Also, if we do add new bridges once manually in shpchp, and then
>>> call the new pci_do_scan_bus again, we will _not_ add devices
>>> twice because the core should check each bridge and device for
>>> struct pci_dev.is_added.
>>>
>>> So anyway, I think that cleaning up the callers of
>>> pci_do_scan_bus is a good idea, but multiple calls to the
>>> interface definitely should not result in problems. If they do,
>>> then that's a bug in my patch series.
>>>
>> I'm sorry, but I didn't have enough time to try your patch on
>> my environment. So I'm still just looking at the code.
>
> Ok.
>
>> I looked at shpchp_configure_device() from the view point of
>> bridge hot-add. I think it is broken regardless of your change
>> because it calls pci_bus_add_devices() (through pci_do_scan_bus)
>> before assigning resources. So I think it must be changed
>> regardless of your change. But it's a little difficult for me
>> because I don't have any test environment as I mentioned before.
>
> Hm, what you say makes sense.
>
> I managed to find a very old machine supported by cpqphp, and
> also found a card with a bridge.
>
> cpqhp_configure_device() follows a similar algorithm to
> shpchp_configure_device(). I'm just starting my testing now, and
> there is good news and bad news.
>
> The bad news is that although cpqphp loads successfully, and we
> can successfully offline a card, we cannot online it again
> afterwards due to BAR collisions. This failure occurs even
> without my changes (2.6.27 kernel), and I haven't had time to
> track the regression down yet.
>
> We do discover the bridge on the device correctly and it is added
> back into the device tree correctly, but we can't use it because
> it's not programmed correctly.
>
> The good news is, after rewriting cpqphp_configure_device() to
> resemble the shpchp patch I gave you, we still discover the
> bridge correctly and add it back into the device tree in the
> proper place. We no longer get BAR collisions, but we fail in a
> slightly different way.
>
> At least I'm not introducing a new regression in cpqphp, and I
> suspect shpchp will be similar.
>
>> But I'm still worrying about your change against pci_do_scan_bus().
>> Without your change, pci_do_scan_bus() scans child buses and add
>> devices without assigning resources. I guess that it means existing
>> callers of pci_do_scan_bus() have some mechanism to assign resource
>> by theirselves and they don't expect pci_do_scan_bus() assigns
>> resources.
>
> I looked through shpchp and couldn't find this assumption. Is it
> stored in the struct controller, under mmio_base and mmio_size?
>
Yes, shpchp doesn't have this assumption. As I mentioned in
the previous e-mail, I think shpchp's bridge hot-add code is
broken even without your change. I'm worrying about the other
hotplug drivers such as cpqphp, cpcihp, rpaphp and ibmphp, though
I don't have any knowledge about those hotplug drivers.
> I am motivated to get this patch series into 2.6.30 for several
> reasons, so I think for now, I will not change pci_do_scan_bus().
> Instead, I'll create a new interface that only the PCI core will
> use, and leave the drivers alone.
>
> Over time, we can migrate the drivers to the PCI core interface.
>
I think it's much safer way.
>> By the way, I have one question about rescan. Please suppose that
>> we enable the bridge(B) and its children using rescan interface
>> in the picture below.
>>
>> |
>> -------------------------------------- parent bus
>> | |
>> bridge(A) bridge(B)
>> (working) (Not working)
>> | |
>> ------------- -------------
>> | | | |
>> dev dev dev dev
>> (working) (working) (Not working)
>>
>> In this case, your rescan mechanism calls pci_do_scan_bus() for
>> parent bus, and pci_do_scan_bus() calls pci_bus_assign_resources()
>> for parent bus. My question is, does pci_bus_assign_resources() do
>> nothing against bridge(A) that is currently working? I guess
>> pci_bus_assign_resources() would update some registers of bridge(A)
>> and it would breaks currently working devices.
>
> This is a very good catch, thank you.
>
> I added another patch to prevent this situation. We now check to
> see if the bridge is already added inside of pci_setup_bridge().
>
Sounds good to me.
Thanks,
Kenji Kaneshige
> Thanks.
>
> /ac
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
next prev parent reply other threads:[~2009-03-19 2:15 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-09 5:48 [PATCH v3 00/11] PCI core learns hotplug Alex Chiang
2009-03-09 5:48 ` [PATCH v3 01/11] PCI: pci_is_root_bus helper Alex Chiang
2009-03-09 5:48 ` [PATCH v3 02/11] PCI: don't scan existing devices Alex Chiang
2009-03-09 5:48 ` [PATCH v3 03/11] PCI: pci_scan_slot() returns newly found devices Alex Chiang
2009-03-09 5:48 ` [PATCH v3 04/11] PCI: always scan child buses Alex Chiang
2009-03-09 5:49 ` [PATCH v3 05/11] PCI: beef up pci_do_scan_bus() Alex Chiang
2009-03-12 9:16 ` Kenji Kaneshige
2009-03-12 23:22 ` Alex Chiang
2009-03-13 9:11 ` Kenji Kaneshige
2009-03-15 16:48 ` Alex Chiang
2009-03-18 8:29 ` Kenji Kaneshige
2009-03-18 20:39 ` Alex Chiang
2009-03-19 2:15 ` Kenji Kaneshige [this message]
2009-03-09 5:49 ` [PATCH v3 06/11] PCI: Introduce /sys/bus/pci/rescan Alex Chiang
2009-03-09 5:49 ` [PATCH v3 07/11] PCI: Introduce /sys/bus/pci/devices/.../remove Alex Chiang
2009-03-09 18:52 ` Alex Chiang
2009-03-10 22:37 ` Alex Chiang
2009-03-11 4:08 ` Alex Chiang
2009-03-09 5:49 ` [PATCH v3 08/11] PCI: Introduce /sys/bus/pci/devices/.../rescan Alex Chiang
2009-03-09 5:49 ` [PATCH v3 09/11] PCI Hotplug: restore fakephp interface with complete reimplementation Alex Chiang
2009-03-09 5:49 ` [PATCH v3 10/11] PCI Hotplug: rename legacy_fakephp to fakephp Alex Chiang
2009-03-09 5:49 ` [PATCH v3 11/11] PCI Hotplug: schedule fakephp for feature removal Alex Chiang
2009-03-09 18:51 ` [PATCH v3 00/11] PCI core learns hotplug Alex Chiang
2009-03-09 19:30 ` Vegard Nossum
2009-03-09 19:52 ` Alex Chiang
2009-03-09 20:28 ` Vegard Nossum
2009-03-09 20:37 ` Alex Chiang
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=49C1AAC3.80406@jp.fujitsu.com \
--to=kaneshige.kenji@jp.fujitsu.com \
--cc=achiang@hp.com \
--cc=jbarnes@virtuousgeek.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@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
Powered by JetHome