public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Alex Chiang <achiang@hp.com>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Bjorn Helgaas <bjorn.helgaas@hp.com>
Subject: Re: [PATCH] pci: pciehp update the slot bridge res to get big range for pcie devices
Date: Wed, 28 Oct 2009 14:39:41 -0700	[thread overview]
Message-ID: <4AE8BA1D.5030908@kernel.org> (raw)
In-Reply-To: <m1pr87cilf.fsf@fess.ebiederm.org>

Eric W. Biederman wrote:
> Yinghai Lu <yinghai@kernel.org> writes:
> 
>> Eric W. Biederman wrote:
>>> Yinghai Lu <yinghai@kernel.org> writes:
>>>
>>>> Eric W. Biederman wrote:
>>>>> Yinghai Lu <yinghai@kernel.org> writes:
>>>>>
>>>>>> Kenji Kaneshige wrote:
>>>>>>> Yinghai Lu wrote:
>>>>>>>> Yinghai Lu wrote:
>>>>>>>>> Kenji Kaneshige wrote:
>>>>>>>>>> I understand you need to touch I/O base/limit and Mem base/limit. But
>>>>>>>>>> I don't understand why you also need to update bridge's BARs. Could
>>>>>>>>>> you please explain a little more about it?
>>>>>>>>>>
>>>>>>>>>> Just in case, my terminology "bridge's BARs" is Base Address Register
>>>>>>>>>> 0 (offset 0x10) and Base Address Register 1 (offset 0x14) in the
>>>>>>>>>> (type 1) configuration space header of the bridge.
>>>>>>>>> i mean 0x1c, 0x20, 0x28
>>>>>>>>>
>>>>>>>>> did not notice that bridge device's 0x10, 0x14 are used...
>>>>>>>>> if port service need to use 0x10, 0x14, and the device is enabled, we
>>>>>>>>> should touch 0x10, and 0x14.
>>>>>>>> after check the code, if
>>>>>>>> pci_bridge_assign_resources ==> pdev_assign_resources_sorted ==> 
>>>>>>>> pdev_sort_resources
>>>>>>>>
>>>>>>>> will not touch 0x10 and 0x14, if those resource is claimed by port
>>>>>>>> service.
>>>>>>>>
>>>>>>>> /* Sort resources by alignment */
>>>>>>>> void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head)
>>>>>>>> {               int i;
>>>>>>>>                         for (i = 0; i < PCI_NUM_RESOURCES; i++) {
>>>>>>>>                 struct resource *r;
>>>>>>>>                 struct resource_list *list, *tmp;
>>>>>>>>                 resource_size_t r_align;
>>>>>>>>                                 r = &dev->resource[i];
>>>>>>>>                                         if (r->flags &
>>>>>>>> IORESOURCE_PCI_FIXED)
>>>>>>>>                         continue;
>>>>>>>>                         if (!(r->flags) || r->parent)
>>>>>>>>                         continue;
>>>>>>>>                
>>>>>>>> r->parent != NULL, will make it skip those two.
>>>>>>>>
>>>>>>>> So -v3 should be safe.
>>>>>>>>
>>>>>>> Thank you for the clarification.
>>>>>>>
>>>>>>> But I still don't understand the whole picture of your set of
>>>>>>> changes. Let me ask some questions.
>>>>>>>
>>>>>>> In my understanding of your set of changes, if there is a PCIe
>>>>>>> switch with some hot-plug slots and all of those slots are empty,
>>>>>>> I/O and Memory resources assigned by BIOS are all released at
>>>>>>> the boot time. For example, suppose the following case.
>>>>>>>
>>>>>>>                bridge(A)
>>>>>>>                   |
>>>>>>>        -----------------------
>>>>>>>        |                     |
>>>>>>>     bridge(B)             bridge(C)
>>>>>>>        |                     |
>>>>>>>      slot(1)               slot(2)
>>>>>>>      (empty)               (empty)
>>>>>>>
>>>>>>>   bridge(A): P2P bridge for switch upstream port
>>>>>>>   bridge(B): P2P bridge for switch downstream port
>>>>>>>   bridge(C): P2P bridge for switch downstream port
>>>>>>>
>>>>>>> In the above example, I/O and Mem resource assigned to bridge(A),
>>>>>>> bridge(B) and bridge(C) are all released at the boot time. Correct?
>>>>>>>
>>>>>>> Then, when a adapter card is hot-added to slot(1), I/O and Mem
>>>>>>> resources enough for enabling the hot-added adapter card is assigned
>>>>>>> to bridge(A), bridge(B) and the adapter card. Correct?
>>>>>>>
>>>>>>> Then, when an another adpater card is hot-added to slot(2), we
>>>>>>> need to assign enough resource to bridge(C) and the new card.
>>>>>>> But bridge(A) doesn't have enough resource for bridge(C) and
>>>>>>> the new card. In addition, all bridge(A) and bridge(B) and the
>>>>>>> adapter card on slot(1) are already working. How do you assign
>>>>>>> resource to bridge(C) and the card on slot(2)?
>>>>>>>
>>>>>> thanks, will update the patches to only handle leaf bridge, and don't touch min_size etc.
>>>>> Tell me what is your expected behavior if I plug a bridge with hotplug
>>>>> slots into a leaf hotplug slot?  Will you assign me enough resources so
>>>>> that I can plug in additional devices?
>>>> no.
>>>>
>>>> you need to plug device in those slots and then insert it into a leaf hotplug slot.
>>> Scenario.
>>>
>>> I insert a bridge with pci hotplug slots into a leaf hotplug slot.
>>> Which adds more leave hotplug slots.
>>>
>>> Since the bridge itself is no longer a leaf slot it's resources will not
>>> get reassigned.
>>>
>>> Then I will have no resources to assign to the leaves?
>> so we still have your min_size code there.
>>
>> in your case: you need plug all card in your slots on that daughter
>> card at first, and then insert the daughter card to leaf slot in the
>> MB.
> 
> Operationally that is an impossibility.  I would not have multiple
> layers of hotplug if I only needed a single layer.
> 
> Which means your patch would cause a regression in my setup.

ok, may need to compare new range size and old range size before clear it.

> 
>> my setup is :
>>
>> system got 4 io chains. and will get slot: 
>> 00:03.0  00:05.0 00:07.0 00:09.0
>> 40:03.0  40:05.0 40:07.0 40:09.0
>> 80:03.0  80:05.0 80:07.0 80:09.0
>> c0:03.0  c0:05.0 c0:07.0 c0:09.0
>>
>> those are hanged on peer root buses directly. but bios assign to
>> them every one get 8M, if user plug one card need 256M, then it will
>> not work.
>>
>> with those two patches, could clear the resource assigned by BIOS,
>> and get resource as needed. ( with mmio 64 bit )
> 
> Hmm.
> 
> Could you avoid reallocating resources until a pci device is plugged in
> that has problems?
> 
> A lot of root bridges have important configuration registers that are
> not in standard locations.  Which means in general we can not reprogram
> root bridges successfully from linux.  At least not without code that
> knows the root bridge magic.
no one change that 
> 
> You can almost solve your problem by simply saying: pci=hpmemsize=256M.
> Which works except that allocating 4G of pci memory isn't very likely
> to work.
> 
> One of the suggestions when I made my patch was to have a per port option
> instead of a global minimum.  That is an option for your case.  But it
> is not as elegant.
> 
> The truly elegant approach is to make certain the hibernate in the
> drivers can handle bars being changed under them, hibernate everything
> that needs renumbering and then bring them back.
> 
> Personally I think you should walk over to whomever did your firmware
> and tell them they goofed.

they said it IS Linux problem. because other os is ok.

YH

  reply	other threads:[~2009-10-28 21:40 UTC|newest]

Thread overview: 129+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-21  7:19 [PATCH] pci: pciehp update the slot bridge res to get big range for pcie devices Yinghai Lu
2009-10-21 18:57 ` Alex Chiang
2009-10-22  0:29   ` [PATCH] pci: pciehp update the slot bridge res to get big range for pcie devices - v2 Yinghai Lu
2009-10-26  4:54 ` [PATCH] pci: pciehp update the slot bridge res to get big range for pcie devices Kenji Kaneshige
2009-10-26  5:49   ` Yinghai Lu
2009-10-26  7:48     ` Kenji Kaneshige
2009-10-26  8:25       ` Yinghai Lu
2009-10-26 10:27         ` Kenji Kaneshige
2009-10-26 17:59           ` Yinghai Lu
2009-10-26 18:52             ` Yinghai Lu
2009-10-28  8:31               ` Kenji Kaneshige
2009-10-28 17:44                 ` Yinghai Lu
2009-10-28 17:52                   ` Bjorn Helgaas
2009-10-28 18:37                     ` Yinghai Lu
2009-10-28 19:00                   ` Eric W. Biederman
2009-10-28 19:12                     ` Yinghai Lu
2009-10-28 19:36                       ` Eric W. Biederman
2009-10-28 19:50                         ` Yinghai Lu
2009-10-28 21:30                           ` Eric W. Biederman
2009-10-28 21:39                             ` Yinghai Lu [this message]
2009-10-28 22:25                               ` Yinghai Lu
2009-10-28 22:26                                 ` Yinghai Lu
2009-10-29  8:16                                 ` Eric W. Biederman
2009-10-29  9:03                                   ` Yinghai Lu
2009-10-29 15:43                                     ` Eric W. Biederman
2009-10-29 17:00                                       ` Yinghai Lu
2009-10-29 19:48                                         ` Eric W. Biederman
2009-10-29 19:55                                           ` Yinghai Lu
2009-10-30  8:36                                           ` [PATCH 1/2] pci: release that leaf bridge' resource that is not big -v8 Yinghai Lu
2009-10-30  8:37                                             ` [PATCH 2/2] pci: pciehp update the slot bridge res to get big range for pcie devices - v8 Yinghai Lu
2009-11-10  8:00                                             ` [PATCH 1/2] pci: release that leaf bridge' resource that is not big -v8 Kenji Kaneshige
2009-10-29 13:21                                   ` [PATCH] pci: pciehp update the slot bridge res to get big range for pcie devices Bjorn Helgaas
2009-10-29 15:13                                     ` Eric W. Biederman
2009-10-29 15:43                                       ` Bjorn Helgaas
2009-10-29 19:28                                         ` Eric W. Biederman
2009-10-29 19:36                                           ` Bjorn Helgaas
     [not found]                     ` <4AE89933.8030809@kernel.org>
2009-10-28 19:20                       ` [PATCH 2/2] pci: only release that resource index is less than 3 -v5 Yinghai Lu
2009-10-29  6:34                         ` Kenji Kaneshige
2009-10-29  9:03                           ` Yinghai Lu
2009-10-28 19:21                     ` [PATCH 1/2] pci: pciehp update the slot bridge res to get big range for pcie devices - v4 Yinghai Lu
2009-10-29  8:28                       ` Kenji Kaneshige
2009-10-29  8:30                         ` Yinghai Lu
2009-10-29  8:55                           ` Kenji Kaneshige
2009-10-29  8:57                             ` Yinghai Lu
2009-10-29  9:52                             ` [PATCH 1/2] pci: release that leaf bridge' resource index is not used -v6 Yinghai Lu
2009-10-29 16:31                               ` Jesse Barnes
2009-10-29 17:10                                 ` Yinghai Lu
2009-10-29 17:51                                   ` Jesse Barnes
     [not found]                             ` <4AE9657F.7010302@kernel.org>
2009-10-29  9:52                               ` [PATCH 2/2] pci: pciehp update the slot bridge res to get big range for pcie devices - v5 Yinghai Lu
2009-11-04 17:30                                 ` Jesse Barnes
2009-11-04 18:52                                   ` Yinghai Lu
2009-11-05  1:40                                     ` [PATCH 1/2] pci: release that leaf bridge' resource that is not big -v9 Yinghai Lu
2009-11-05  1:40                                       ` [PATCH 2/2] pci: pciehp update the slot bridge res to get big range for pcie devices - v9 Yinghai Lu
2009-11-05 20:47                                         ` Alex Chiang
2009-11-05 21:06                                           ` Yinghai Lu
2009-11-07  5:41                                         ` [PATCH 2/2] pci: pciehp update the slot bridge res to get big range for pcie devices - v10 Yinghai Lu
2009-11-07  5:43                                         ` Yinghai Lu
2009-11-10  8:07                                           ` Kenji Kaneshige
2009-11-10  9:48                                             ` Yinghai Lu
2009-11-13  6:08                                               ` Kenji Kaneshige
2009-11-13  6:26                                                 ` Yinghai Lu
2009-11-13  8:33                                                   ` Kenji Kaneshige
2009-11-14  8:50                                                     ` [PATCH 1/2] pci: release that leaf bridge' resource that is not big -v11 Yinghai Lu
2009-11-24  1:08                                                       ` Kenji Kaneshige
2009-11-24  1:14                                                         ` Yinghai Lu
     [not found]                                                           ` <4B0B3C13.9030502@jp.fujit! su.com>
2009-11-24  1:51                                                           ` Kenji Kaneshige
2009-11-24  2:32                                                             ` Yinghai Lu
2009-11-24 23:18                                                             ` Yinghai Lu
2009-11-25 11:24                                                               ` Kenji Kaneshige
2009-11-25 11:25                                                                 ` [PATCH 1/2] pciehp: remove redundancy in bridge resource allocation Kenji Kaneshige
2009-11-25 17:37                                                                   ` Yinghai Lu
2009-11-25 11:27                                                                 ` [PATCH 2/2] pciehp: add support for bridge resource reallocation Kenji Kaneshige
2009-11-25 17:44                                                                 ` [PATCH 1/2] pci: release that leaf bridge' resource that is not big -v11 Yinghai Lu
2009-11-26  6:43                                                                   ` Kenji Kaneshige
2009-11-26  7:30                                                                     ` Yinghai
2009-11-27  7:12                                                                       ` Kenji Kaneshige
2009-11-27  7:52                                                                         ` Yinghai Lu
2009-11-27  8:26                                                                           ` Kenji Kaneshige
2009-11-27 23:13                                                                             ` Yinghai Lu
2009-11-25 19:58                                                                 ` [PATCH 0/9] pci: update pci bridge resource to get more big range for devices under it - v12 Yinghai Lu
     [not found]                                                                 ` <4B0D88A4.5050904@kerne! l.org>
     [not found]                                                                   ` <4B0D88A4.5050904@kernel.org>
2009-11-25 19:59                                                                     ` [PATCH 1/9] pci: separate pci_setup_bridge to small functions Yinghai Lu
2009-11-25 19:59                                                                     ` [PATCH 2/9] pci: add pci_bridge_release_unused_res and pci_bus_release_unused_bridge_res Yinghai Lu
2009-11-25 19:59                                                                     ` [PATCH 3/9] pci: don't dump it when bus resource flags is not set Yinghai Lu
2009-11-25 19:59                                                                     ` [PATCH 4/9] pci: add failed_list to record failed one for pci_bus_assign_resources Yinghai Lu
2009-11-25 19:59                                                                     ` [PATCH 5/9] pci: update leaf bridge res to get more big range in pci assign unssign Yinghai Lu
2009-11-25 19:59                                                                     ` [PATCH 6/9] pci: don't shrink bridge resources Yinghai Lu
2009-11-25 19:59                                                                     ` [PATCH 7/9] pci: introduce pci_assign_unassigned_bridge_resources Yinghai Lu
2009-11-25 19:59                                                                     ` [PATCH 8/9] pci: pciehp clean flow in pciehp_configure_device Yinghai Lu
2009-11-25 19:59                                                                     ` [PATCH 9/9] pci: pciehp second try to get big range for pcie devices Yinghai Lu
2009-11-28  7:34                                                                 ` [PATCH 0/9] pci: update pci bridge resource to get more big range for devices under it - v13 Yinghai Lu
2009-11-28  8:15                                                                   ` Yinghai Lu
2009-11-30  7:10                                                                   ` Kenji Kaneshige
2009-11-30  7:14                                                                     ` Yinghai Lu
2009-11-30  7:26                                                                       ` Kenji Kaneshige
2009-11-30  7:43                                                                         ` Yinghai Lu
2009-11-30  8:19                                                                         ` Yinghai Lu
2009-11-30  8:44                                                                           ` Kenji Kaneshige
2009-12-16 20:54                                                                   ` Jesse Barnes
2009-12-16 21:11                                                                     ` Alex Chiang
2009-12-16 22:21                                                                       ` Yinghai Lu
2009-12-16 22:27                                                                       ` Yinghai Lu
2009-12-16 22:44                                                                         ` Alex Chiang
     [not found]                                                                 ` <4B10D084.8070608@kerne! l.org>
     [not found]                                                                   ` <4B10D084.8070608@kernel.org>
2009-11-28  7:34                                                                     ` [PATCH 1/9] pci: separate pci_setup_bridge to small functions Yinghai Lu
2009-12-16 20:41                                                                       ` Jesse Barnes
2009-12-17 11:03                                                                         ` Rolf Eike Beer
2009-11-28  7:35                                                                     ` [PATCH 2/9] pci: add pci_bridge_release_unused_res and pci_bus_release_unused_bridge_res Yinghai Lu
2009-12-16 20:49                                                                       ` Jesse Barnes
2009-12-16 22:19                                                                         ` Yinghai Lu
2009-11-28  7:35                                                                     ` [PATCH 3/9] pci: don't dump it when bus resource flags is not used Yinghai Lu
2009-12-16 20:50                                                                       ` Jesse Barnes
2009-12-16 22:20                                                                         ` Yinghai Lu
2009-11-28  7:35                                                                     ` [PATCH 4/9] pci: add failed_list to record failed one for pci_bus_assign_resources -v2 Yinghai Lu
2009-11-28  7:35                                                                     ` [PATCH 5/9] pci: update leaf bridge res to get more big range in pci assign unssign -v2 Yinghai Lu
2009-11-30 21:55                                                                       ` [PATCH 5/9] pci: update leaf bridge res to get more big range in pci assign unssign -v3 Yinghai Lu
2009-11-28  7:36                                                                     ` [PATCH 6/9] pci: don't shrink bridge resources Yinghai Lu
2009-11-28  7:36                                                                     ` [PATCH 7/9] pci: introduce pci_assign_unassigned_bridge_resources -v2 Yinghai Lu
2009-11-28  7:36                                                                     ` [PATCH 8/9] pci: pciehp clean flow in pciehp_configure_device Yinghai Lu
2009-11-28  7:36                                                                     ` [PATCH 9/9] pci: pciehp second try to get big range for pcie devices -v2 Yinghai Lu
2009-12-01  1:19                                                                       ` [PATCH 1/2] pci: pci_bridge_release_res Yinghai Lu
2009-12-07 21:42                                                                         ` Patrick Keller
2009-12-07 21:57                                                                           ` Yinghai Lu
2009-12-01  1:21                                                                       ` [PATCH 2/2] pciehp: add support for bridge resource reallocation -v2 Yinghai Lu
2009-11-14  8:51                                                     ` [PATCH 2/2] pci: pciehp update the slot bridge res to get big range for pcie devices - v11 Yinghai Lu
2009-10-26  8:27       ` [PATCH] pci: pciehp update the slot bridge res to get big range for pcie devices - v3 Yinghai Lu
2009-10-27  8:09         ` [PATCH 1/4] pci: pciehp update the slot bridge res to get big range for pcie devices - v4 Yinghai Lu
     [not found]         ` <4AE6A9CA.4060106@kernel.org>
2009-10-27  8:09           ` [PATCH 2/4] pci: revert "get larger bridge ranges when space is available" Yinghai Lu
2009-10-27  8:10           ` [PATCH 3/4] pci: only release that resource index is less than 3 -v3 Yinghai Lu
2009-10-27  8:10           ` [PATCH 4/4] pci: remove min_size for hotplug bridge Yinghai Lu
2009-10-27  9:20             ` Eric W. Biederman

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=4AE8BA1D.5030908@kernel.org \
    --to=yinghai@kernel.org \
    --cc=achiang@hp.com \
    --cc=bjorn.helgaas@hp.com \
    --cc=ebiederm@xmission.com \
    --cc=ink@jurassic.park.msu.ru \
    --cc=jbarnes@virtuousgeek.org \
    --cc=kaneshige.kenji@jp.fujitsu.com \
    --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