linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yang <weiyang@linux.vnet.ibm.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Wei Yang <weiyang@linux.vnet.ibm.com>,
	Yinghai Lu <yinghai@kernel.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Nishank Trivedi <nistrive@cisco.com>
Subject: Re: [PATCH] PCI: Use pci_is_root_bus() to check for root bus
Date: Fri, 8 Nov 2013 09:35:37 +0800	[thread overview]
Message-ID: <20131108013537.GA15600@weiyang.vnet.ibm.com> (raw)
In-Reply-To: <20131107215918.GC2955@google.com>

On Thu, Nov 07, 2013 at 02:59:18PM -0700, Bjorn Helgaas wrote:
>On Thu, Nov 07, 2013 at 11:00:54AM +0800, Wei Yang wrote:
>> Thanks Bjorn, this is really a potential problme. And your patches fix this
>> problem.
>> 
>> While I did a small change on the seconde one like this. Hope you like it :-)
>> 
>> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
>> index bdd64b1..8d0ce48 100644
>> --- a/drivers/pci/pci.c
>> +++ b/drivers/pci/pci.c
>> @@ -1153,7 +1153,7 @@ static void pci_enable_bridge(struct pci_dev *dev)
>>         if (!dev)
>>                 return;
>>  
>> -       pci_enable_bridge(dev->bus->self);
>> +       pci_enable_bridge(pci_upstream_bridge(dev));
>>  
>>         if (pci_is_enabled(dev)) {
>>                 if (!dev->is_busmaster) {
>> @@ -1190,7 +1190,7 @@ static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags)
>>         if (atomic_inc_return(&dev->enable_cnt) > 1)
>>                 return 0;               /* already enabled */
>>  
>> -       pci_enable_bridge(dev->bus->self);
>> +       pci_enable_bridge(pci_upstream_bridge(dev));
>>  
>>         /* only skip sriov related */
>>         for (i = 0; i <= PCI_ROM_RESOURCE; i++)
>
>Thanks for looking at these.  I think the latest version (the ones
>acked by Yinghai) do basically what you're suggesting.

Agree :-)

>
>> BTW, pci_enable_bridge() is only called in pci_enable_device_flags(). After
>> change in these two patches, we pass a 'upstream bridge' to
>> pci_enable_bridge(). I am not sure whether this 'upstream bridge' could be a
>> VF? I took a look at the SPEC again, but not find clear clause.
>> 
>> In case the 'upstream bridge' is always a PF, maybe we could simplize the
>> logic in pci_enable_bridge(). While current logic is reasonable and clear.
>
>I doubt it's possible for a VF to be a bridge, but I don't think
>there's really any reason to build that assumption into the code
>here.

Yep, the latest version is more general.

>
>Bjorn

-- 
Richard Yang
Help you, Help me


      reply	other threads:[~2013-11-08  1:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-05 23:29 [PATCH] PCI: Use pci_is_root_bus() to check for root bus Bjorn Helgaas
2013-11-06  3:39 ` Yinghai Lu
2013-11-06 18:15   ` Bjorn Helgaas
2013-11-06 19:56     ` Yinghai Lu
2013-11-06 20:12       ` Bjorn Helgaas
2013-11-06 20:33         ` Yinghai Lu
2013-11-06 20:46           ` Bjorn Helgaas
2013-11-07  0:28             ` Yinghai Lu
2013-11-07 22:03               ` Bjorn Helgaas
2013-11-07  3:00     ` Wei Yang
2013-11-07 21:59       ` Bjorn Helgaas
2013-11-08  1:35         ` 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=20131108013537.GA15600@weiyang.vnet.ibm.com \
    --to=weiyang@linux.vnet.ibm.com \
    --cc=bhelgaas@google.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=nistrive@cisco.com \
    --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).