[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4B510902.70301@kernel.org>
Date: Fri, 15 Jan 2010 16:32:02 -0800
From: Yinghai Lu <yinghai@...nel.org>
To: Jesse Barnes <jbarnes@...tuousgeek.org>
CC: Ingo Molnar <mingo@...e.hu>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Ivan Kokshaysky <ink@...assic.park.msu.ru>,
Kenji Kaneshige <kaneshige.kenji@...fujitsu.com>,
Alex Chiang <achiang@...com>,
Bjorn Helgaas <bjorn.helgaas@...com>,
linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org
Subject: Re: [PATCH 07/14] pci: don't shrink bridge resources
On 01/15/2010 01:31 PM, Jesse Barnes wrote:
> On Fri, 15 Jan 2010 13:09:31 -0800
> Yinghai Lu <yinghai@...nel.org> wrote:
>
>> On 01/15/2010 11:04 AM, Jesse Barnes wrote:
>>> On Tue, 22 Dec 2009 15:02:27 -0800
>>> Yinghai Lu <yinghai@...nel.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@...nel.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists