From: Yinghai Lu <yinghai@kernel.org>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Ingo Molnar <mingo@elte.hu>,
Linus Torvalds <torvalds@linux-foundation.org>,
Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>,
Alex Chiang <achiang@hp.com>,
Bjorn Helgaas <bjorn.helgaas@hp.com>,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH 07/14] pci: don't shrink bridge resources
Date: Fri, 15 Jan 2010 16:32:02 -0800 [thread overview]
Message-ID: <4B510902.70301@kernel.org> (raw)
In-Reply-To: <20100115133155.3bc1960c@jbarnes-piketon>
On 01/15/2010 01:31 PM, Jesse Barnes wrote:
> On Fri, 15 Jan 2010 13:09:31 -0800
> Yinghai Lu <yinghai@kernel.org> wrote:
>
>> On 01/15/2010 11:04 AM, Jesse Barnes wrote:
>>> On Tue, 22 Dec 2009 15:02:27 -0800
>>> Yinghai Lu <yinghai@kernel.org> wrote:
>>>
>>>> when we are clearing leaf bridge resource and try to get big one,
>>>> we could shrink the bridge if there is no resource under it.
>>>>
>>>> let check with old resource size and make sure we are trying to get
>>>> big one.
>>>>
>>>> -v2: keep disable window print out, still could happen on non pci
>>>> hotplug system
>>>>
>>>> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>>>> ---
>>>> drivers/pci/setup-bus.c | 14 ++++++++++++--
>>>> 1 files changed, 12 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
>>>> index 9bb4435..d53b42e 100644
>>>> --- a/drivers/pci/setup-bus.c
>>>> +++ b/drivers/pci/setup-bus.c
>>>> @@ -387,7 +387,7 @@ static void pbus_size_io(struct pci_bus *bus,
>>>> resource_size_t min_size) {
>>>> struct pci_dev *dev;
>>>> struct resource *b_res = find_free_bus_resource(bus,
>>>> IORESOURCE_IO);
>>>> - unsigned long size = 0, size1 = 0;
>>>> + unsigned long size = 0, size1 = 0, old_size;
>>>>
>>>> if (!b_res)
>>>> return;
>>>> @@ -412,12 +412,17 @@ static void pbus_size_io(struct pci_bus *bus,
>>>> resource_size_t min_size) }
>>>> if (size < min_size)
>>>> size = min_size;
>>>> + old_size = resource_size(b_res);
>>>> + if (old_size == 1)
>>>> + old_size = 0;
>>>
>>> Do we even need these == 1 checks? If old_size really was 1, it
>>> means we had a very small decode range. Might make more sense to
>>> do...
>>
>> when start=0 and end =0, will get old_size = 1
>
> ...
> if (old_size == 1)
> old_size = 0
> ...
> if (size < old_size)
> size = old_size
> ...
>
>
> If old_size > 1 we'll make sure size doesn't decrease.
>
> If old_size == 1, we'll never touch the changed size because size < 0
> will never be true for size (unsigned).
>
> However, if old_size == 1 and we left it at 1, we'd only set size =
> old_size if size was 0, which is why I suggested the size check.
>
but:
for
if (size && size < old_size)
if the new one will 0 ( no device under it and it is not hotplug supported <so min_size = 0> )
then we will overwrite the real old size...during second try.
YH
next prev parent reply other threads:[~2010-01-16 0:33 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-22 23:02 [PATCH 00/14] pci: update pci bridge resources Yinghai Lu
2009-12-22 23:02 ` [PATCH 01/14] pci: separate pci_setup_bridge to small functions Yinghai Lu
2010-01-15 18:54 ` Jesse Barnes
2009-12-22 23:02 ` [PATCH 02/14] resource: add release_child_resources Yinghai Lu
2010-01-15 18:54 ` Jesse Barnes
2009-12-22 23:02 ` [PATCH 03/14] pci: add pci_bridge_release_unused_res and pci_bus_release_unused_bridge_res Yinghai Lu
2010-01-15 18:53 ` Jesse Barnes
2010-01-16 0:20 ` Yinghai Lu
2009-12-22 23:02 ` [PATCH 04/14] pci: don't dump it when bus resource flags is not used Yinghai Lu
2010-01-15 18:54 ` Jesse Barnes
2009-12-22 23:02 ` [PATCH 05/14] pci: add failed_list to record failed one for pci_bus_assign_resources Yinghai Lu
2010-01-15 18:56 ` Jesse Barnes
2010-01-15 21:13 ` Yinghai Lu
2010-01-15 21:41 ` Bjorn Helgaas
2009-12-22 23:02 ` [PATCH 06/14] pci: reject mmio range start from 0 on pci_bridge read Yinghai Lu
2010-01-15 19:19 ` Jesse Barnes
2010-01-15 21:15 ` Yinghai Lu
2009-12-22 23:02 ` [PATCH 07/14] pci: don't shrink bridge resources Yinghai Lu
2010-01-15 19:04 ` Jesse Barnes
2010-01-15 21:09 ` Yinghai Lu
2010-01-15 21:31 ` Jesse Barnes
2010-01-16 0:32 ` Yinghai Lu [this message]
2009-12-22 23:02 ` [PATCH 08/14] pci: update bridge res to get more big range in pci assign unssign Yinghai Lu
2010-01-15 19:12 ` Jesse Barnes
2010-01-15 21:12 ` Yinghai Lu
2010-01-15 21:34 ` Bjorn Helgaas
2010-01-15 21:34 ` Jesse Barnes
2009-12-22 23:02 ` [PATCH 09/14] pci: introduce pci_assign_unassigned_bridge_resources Yinghai Lu
2010-01-13 0:50 ` Kenji Kaneshige
2010-01-13 1:58 ` Yinghai Lu
2010-01-13 7:31 ` Kenji Kaneshige
2010-01-13 7:52 ` Yinghai Lu
2009-12-22 23:02 ` [PATCH 10/14] pci: pciehp clean flow in pciehp_configure_device Yinghai Lu
2010-01-15 19:14 ` Jesse Barnes
2010-01-15 21:14 ` Yinghai Lu
2009-12-22 23:02 ` [PATCH 11/14] pci: pciehp second try to get big range for pcie devices Yinghai Lu
2009-12-22 23:02 ` [PATCH 12/14] pci: pci_bridge_release_res Yinghai Lu
2009-12-22 23:02 ` [PATCH 13/14] pciehp: add support for bridge resource reallocation Yinghai Lu
2009-12-22 23:02 ` [PATCH 14/14] pci: set PCI_PREF_RANGE_TYPE_64 in pci_bridge_check_ranges Yinghai Lu
2010-01-08 21:33 ` [PATCH 00/14] pci: update pci bridge resources Patrick Keller
2010-01-11 21:57 ` Patrick Keller
2010-01-12 18:18 ` Jesse Barnes
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=4B510902.70301@kernel.org \
--to=yinghai@kernel.org \
--cc=achiang@hp.com \
--cc=bjorn.helgaas@hp.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 \
--cc=mingo@elte.hu \
--cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.