linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yang <weiyang@linux.vnet.ibm.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	aik@au1.ibm.com, Wei Yang <weiyang@linux.vnet.ibm.com>,
	linuxppc-dev@lists.ozlabs.org, gwshan@linux.vnet.ibm.com
Subject: Re: [PATCH] powerpc: reduce multi-hit of pcibios_setup_device() in hotplug
Date: Wed, 11 Jun 2014 17:00:23 +0800	[thread overview]
Message-ID: <20140611090023.GA13419@richard> (raw)
In-Reply-To: <1402471784.14780.45.camel@pasglop>

On Wed, Jun 11, 2014 at 05:29:44PM +1000, Benjamin Herrenschmidt wrote:
>On Wed, 2014-06-11 at 15:12 +0800, Wei Yang wrote:
>
>> Sorry for the long delay. It took me some time to investigate and test the code.
>> Currently, the hotplug by qemu monitor command line has been verified. Two pci
>> device on the same bus have been hotpluged one by one successfully.
>> 
>> Another case in my mind is the EEH hotplug, which requires code in
>> Qemu/Sapphire/Kernel. I will did further test later.
>> 
>> Below is the patch which is verified in guest with monitor command line. If my
>> understanding is not correct, please let me know :-)
>
>Please verify under pHyp, the code path are a bit different.

Yep, I will test it.

>
>Cheers,
>Ben.
>
>> >From 69c5f014836b24897356731c39cbaf18f4563573 Mon Sep 17 00:00:00 2001
>> From: Wei Yang <weiyang@linux.vnet.ibm.com>
>> Date: Tue, 10 Jun 2014 15:28:53 +0800
>> Subject: [PATCH] powerpc/pci: Use bus->is_added in of_scan_bus() as in
>>  general platform
>> 
>> When scan the pci bus on general platform, it use bus->is_added to mark the
>> bus has been added successfully. While this flag is not used when the bus scan
>> relies on device node. Instead, it uses a particular parameter
>> "rescan_existing" to play the same role.
>> 
>> This patch enables the bus->is_added when device node is used, drops the
>> "rescan_existing" parameter. Also it skip the pcibios_setup_bus_devices()
>> procedure when bus has already been added, since the pcibios_setup_device()
>> step is done in pci_device_add() when the bus is already added.
>> 
>> Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
>> ---
>>  arch/powerpc/kernel/pci_of_scan.c |   14 +++++++-------
>>  1 file changed, 7 insertions(+), 7 deletions(-)
>> 
>> diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
>> index 83c26d8..3e943ab 100644
>> --- a/arch/powerpc/kernel/pci_of_scan.c
>> +++ b/arch/powerpc/kernel/pci_of_scan.c
>> @@ -334,10 +334,8 @@ static struct pci_dev *of_scan_pci_dev(struct pci_bus *bus,
>>   * __of_scan_bus - given a PCI bus node, setup bus and scan for child devices
>>   * @node: device tree node for the PCI bus
>>   * @bus: pci_bus structure for the PCI bus
>> - * @rescan_existing: Flag indicating bus has already been set up
>>   */
>> -static void __of_scan_bus(struct device_node *node, struct pci_bus *bus,
>> -			  int rescan_existing)
>> +static void __of_scan_bus(struct device_node *node, struct pci_bus *bus)
>>  {
>>  	struct device_node *child;
>>  	struct pci_dev *dev;
>> @@ -356,9 +354,11 @@ static void __of_scan_bus(struct device_node *node, struct pci_bus *bus,
>>  	/* Apply all fixups necessary. We don't fixup the bus "self"
>>  	 * for an existing bridge that is being rescanned
>>  	 */
>> -	if (!rescan_existing)
>> +	if (!bus->is_added) {
>>  		pcibios_setup_bus_self(bus);
>> -	pcibios_setup_bus_devices(bus);
>> +		pcibios_setup_bus_devices(bus);
>> +		bus->is_added = 1;
>> +	}
>>  
>>  	/* Now scan child busses */
>>  	list_for_each_entry(dev, &bus->devices, bus_list) {
>> @@ -376,7 +376,7 @@ static void __of_scan_bus(struct device_node *node, struct pci_bus *bus,
>>   */
>>  void of_scan_bus(struct device_node *node, struct pci_bus *bus)
>>  {
>> -	__of_scan_bus(node, bus, 0);
>> +	__of_scan_bus(node, bus);
>>  }
>>  EXPORT_SYMBOL_GPL(of_scan_bus);
>>  
>> @@ -390,7 +390,7 @@ EXPORT_SYMBOL_GPL(of_scan_bus);
>>   */
>>  void of_rescan_bus(struct device_node *node, struct pci_bus *bus)
>>  {
>> -	__of_scan_bus(node, bus, 1);
>> +	__of_scan_bus(node, bus);
>>  }
>>  EXPORT_SYMBOL_GPL(of_rescan_bus);
>>  
>> -- 
>> 1.7.9.5
>> 
>> >
>> >
>> >_______________________________________________
>> >Linuxppc-dev mailing list
>> >Linuxppc-dev@lists.ozlabs.org
>> >https://lists.ozlabs.org/listinfo/linuxppc-dev
>> 
>

-- 
Richard Yang
Help you, Help me

      reply	other threads:[~2014-06-11  9:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-08  6:30 [PATCH] powerpc: reduce multi-hit of pcibios_setup_device() in hotplug Wei Yang
2014-05-12  2:59 ` Benjamin Herrenschmidt
2014-06-11  7:12   ` Wei Yang
2014-06-11  7:29     ` Benjamin Herrenschmidt
2014-06-11  9:00       ` Wei Yang [this message]

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=20140611090023.GA13419@richard \
    --to=weiyang@linux.vnet.ibm.com \
    --cc=aik@au1.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=bhelgaas@google.com \
    --cc=gwshan@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.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).