From: Ram Pai <linuxram@us.ibm.com>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>,
Ram Pai <linuxram@us.ibm.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>
Subject: Re: [PATCH] pci: Check bridge resources after resource allocation.
Date: Fri, 6 May 2011 01:12:43 -0700 [thread overview]
Message-ID: <20110506081243.GF16782@ram-laptop> (raw)
In-Reply-To: <4DC250A6.9040802@kernel.org>
On Thu, May 05, 2011 at 12:24:22AM -0700, Yinghai Lu wrote:
>
> During pci remove/rescan testing found:
>
> [ 541.141614] pci 0000:c0:03.0: PCI bridge to [bus c4-c9]
> [ 541.141965] pci 0000:c0:03.0: bridge window [io 0x1000-0x0fff]
> [ 541.159181] pci 0000:c0:03.0: bridge window [mem 0xf0000000-0xf00fffff]
> [ 541.159540] pci 0000:c0:03.0: bridge window [mem 0xfc180000000-0xfc197ffffff 64bit pref]
> [ 541.179374] pci 0000:c0:03.0: device not available (can't reserve [io 0x1000-0x0fff])
> [ 541.199198] pci 0000:c0:03.0: Error enabling bridge (-22), continuing
> [ 541.199202] pci 0000:c0:03.0: enabling bus mastering
> [ 541.199209] pci 0000:c0:03.0: setting latency timer to 64
> [ 541.199917] pcieport 0000:c0:03.0: device not available (can't reserve [io 0x1000-0x0fff])
> [ 541.199963] pcieport: probe of 0000:c0:03.0 failed with error -22
>
> This bug was uncovered by commit
> | commit c8adf9a3e873eddaaec11ac410a99ef6b9656938
> | Author: Ram Pai <linuxram@us.ibm.com>
> | Date: Mon Feb 14 17:43:20 2011 -0800
> |
> | PCI: pre-allocate additional resources to devices only after successful allo
> cation of essential resources.
>
> After that commit, pci_hotplug_io_size is changed to additional_io_size from minium size. So it will not get into failed list, and will not be reset there.
>
> The root cause is: pci_bridge_check_ranges will set RESOURCE_IO flag for pci
> bridge, and later if children does not need to IO resource. those bridge
> resources will not need to be allocated. but flags still there.
>
> Add pci_bridge_check_resources() to close the loop.
How about resetting the resource in adjust_resources_sorted() if call to
adjust_resource() fails, and the resource is left with zero size?
Something like this:
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 8e73abf..77e8454 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -157,8 +157,11 @@ static void adjust_resources_sorted(struct resource_list_x *add_head,
if(pci_assign_resource(list->dev, idx))
reset_resource(res);
} else if (add_size) {
- adjust_resource(res, res->start,
- resource_size(res) + add_size);
+ if (adjust_resource(res, res->start,
+ resource_size(res) + add_size) &&
+ !resource_size(res)) {
+ reset_resource(res);
+ }
}
out:
tmp = list;
RP
next prev parent reply other threads:[~2011-05-06 8:13 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-05 7:24 Yinghai Lu
2011-05-06 8:12 ` Ram Pai [this message]
2011-05-06 20:22 ` Yinghai Lu
2011-05-06 20:43 ` [PATCH 1/2] pci: Using add_list in pcie hotplug path Yinghai Lu
2011-05-06 20:44 ` [PATCH 2/2] pci: honor child buses add_size in hot plug configuration Yinghai Lu
2011-05-07 1:52 ` [PATCH] pci: Check bridge resources after resource allocation Ram Pai
2011-05-07 2:37 ` Yinghai Lu
2011-05-08 7:55 ` [PATCH -v2] " Yinghai Lu
2011-05-09 21:20 ` Jesse Barnes
2011-05-09 22:36 ` Linus Torvalds
2011-05-11 1:19 ` Yinghai Lu
2011-05-12 18:06 ` Ram Pai
2011-05-12 18:14 ` Linus Torvalds
2011-05-12 18:22 ` Ram Pai
2011-05-12 18:37 ` Jesse Barnes
2011-05-12 19:18 ` Linus Torvalds
2011-05-12 19:34 ` Jesse Barnes
2011-05-14 1:06 ` Yinghai Lu
2011-05-16 7:59 ` Ram Pai
2011-05-16 20:55 ` Yinghai Lu
2011-05-16 22:36 ` Ram Pai
2011-05-17 3:52 ` Jesse Barnes
2011-05-17 5:22 ` Linus Torvalds
2011-05-12 18:22 ` Yinghai Lu
2011-05-12 18:30 ` Yinghai Lu
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=20110506081243.GF16782@ram-laptop \
--to=linuxram@us.ibm.com \
--cc=jbarnes@virtuousgeek.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--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
Powered by JetHome