From: Yinghai Lu <yinghai@kernel.org>
To: Guo Chao <yan@linux.vnet.ibm.com>
Cc: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>
Subject: Re: [PATCH] PCI: Reset failed bridge resources in PCI realloc
Date: Wed, 30 Jul 2014 12:59:35 -0700 [thread overview]
Message-ID: <CAE9FiQVkGcqFQ7e22Ekg7t-gWrQ9FdtadbVCASTGqU20FPE50g@mail.gmail.com> (raw)
In-Reply-To: <1406707207-13152-1-git-send-email-yan@linux.vnet.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 2178 bytes --]
On Wed, Jul 30, 2014 at 1:00 AM, Guo Chao <yan@linux.vnet.ibm.com> wrote:
> * However, in pbus_size_mem() we call calculate_memsize() to
> calculate the final size. calculate_memsize() never shrinks
> window, i.e. if old size is larger than newly sized result,
> old size will be honored. Unfortunately, the old size at this
> time is the sum of both normal BARs and SR-IOV BARs when doing
> realloc.
>
that checking about old_size is added by:
| commit d65245c3297ac63abc51a976d92f45f2195d2854
| Author: Yinghai Lu <yinghai@kernel.org>
| Date: Fri Jan 22 01:02:23 2010 -0800
|
| PCI: don't shrink bridge resources
|
| When clearing leaf bridge resources, trying to get a big enough one, we
| could shrink the bridge if there is no resource under it. Confirm
| against the old resource side to make sure we're increasing the
| allocation.
so to make both cases ok, may need to check if there is any children devices
on the dev->subordinate. Please check attached.
Thanks
Yinghai
---
drivers/pci/setup-bus.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
Index: linux-2.6/drivers/pci/setup-bus.c
===================================================================
--- linux-2.6.orig/drivers/pci/setup-bus.c
+++ linux-2.6/drivers/pci/setup-bus.c
@@ -1622,8 +1622,11 @@ again:
res->start = fail_res->start;
res->end = fail_res->end;
res->flags = fail_res->flags;
- if (fail_res->dev->subordinate)
+ if (fail_res->dev->subordinate) {
res->flags = 0;
+ if (!list_empty(&fail_res->dev->subordinate->devices))
+ res->start = res->end = 0;
+ }
}
free_list(&fail_head);
@@ -1688,8 +1691,11 @@ again:
res->start = fail_res->start;
res->end = fail_res->end;
res->flags = fail_res->flags;
- if (fail_res->dev->subordinate)
+ if (fail_res->dev->subordinate) {
res->flags = 0;
+ if (!list_empty(&fail_res->dev->subordinate->devices))
+ res->start = res->end = 0;
+ }
}
free_list(&fail_head);
[-- Attachment #2: shrink_realloc_bridge_resource.patch --]
[-- Type: text/x-patch, Size: 975 bytes --]
---
drivers/pci/setup-bus.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
Index: linux-2.6/drivers/pci/setup-bus.c
===================================================================
--- linux-2.6.orig/drivers/pci/setup-bus.c
+++ linux-2.6/drivers/pci/setup-bus.c
@@ -1622,8 +1622,11 @@ again:
res->start = fail_res->start;
res->end = fail_res->end;
res->flags = fail_res->flags;
- if (fail_res->dev->subordinate)
+ if (fail_res->dev->subordinate) {
res->flags = 0;
+ if (!list_empty(&fail_res->dev->subordinate->devices))
+ res->start = res->end = 0;
+ }
}
free_list(&fail_head);
@@ -1688,8 +1691,11 @@ again:
res->start = fail_res->start;
res->end = fail_res->end;
res->flags = fail_res->flags;
- if (fail_res->dev->subordinate)
+ if (fail_res->dev->subordinate) {
res->flags = 0;
+ if (!list_empty(&fail_res->dev->subordinate->devices))
+ res->start = res->end = 0;
+ }
}
free_list(&fail_head);
next prev parent reply other threads:[~2014-07-30 19:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-30 8:00 [PATCH] PCI: Reset failed bridge resources in PCI realloc Guo Chao
2014-07-30 19:59 ` Yinghai Lu [this message]
2014-07-31 8:48 ` Guo Chao
2014-09-04 4:23 ` Bjorn Helgaas
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=CAE9FiQVkGcqFQ7e22Ekg7t-gWrQ9FdtadbVCASTGqU20FPE50g@mail.gmail.com \
--to=yinghai@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=yan@linux.vnet.ibm.com \
/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).