diff mbox

[3/5,v2] PCI: make SRIOV resources optional

Message ID 1309477662-18680-4-git-send-email-linuxram@us.ibm.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Ram Pai June 30, 2011, 11:47 p.m. UTC
From: Yinghai Lu <yinghai@kernel.org>

From: Yinghai Lu <yinghai@kernel.org>

Allocate resources to SRIOV BARs only after all other required
resource-requests are satisfied. Dont retry if resource allocation for SRIOV
BARs fail.

Signed-off-by: Ram Pai <linuxram@us.ibm.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 drivers/pci/setup-bus.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

Comments

Oliver Hartkopp July 1, 2011, 6:01 a.m. UTC | #1
On 01.07.2011 01:47, Ram Pai wrote:
> From: Yinghai Lu <yinghai@kernel.org>
> 
> From: Yinghai Lu <yinghai@kernel.org>
> 
> Allocate resources to SRIOV BARs only after all other required
> resource-requests are satisfied. Dont retry if resource allocation for SRIOV
> BARs fail.
> 
> Signed-off-by: Ram Pai <linuxram@us.ibm.com>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>

Tested-by: Oliver Hartkopp <socketcan@hartkopp.net>

I applied the whole patchset and it looks very similar to the dmsg output
before the problematic commit that caused the regression.

Tnx!

Oliver


> ---
>  drivers/pci/setup-bus.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
> index 9f2f15f..a0555cb 100644
> --- a/drivers/pci/setup-bus.c
> +++ b/drivers/pci/setup-bus.c
> @@ -669,6 +669,16 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
>  			if (r->parent || (r->flags & mask) != type)
>  				continue;
>  			r_size = resource_size(r);
> +#ifdef CONFIG_PCI_IOV
> +			/* put SRIOV requested res to the optional list */
> +			if (add_head && i >= PCI_IOV_RESOURCES &&
> +					i <= PCI_IOV_RESOURCE_END) {
> +				r->end = r->start - 1;
> +				add_to_list(add_head, dev, r, r_size, 1);
> +				children_add_size += r_size;
> +				continue;
> +			}
> +#endif
>  			/* For bridges size != alignment */
>  			align = pci_resource_alignment(dev, r);
>  			order = __ffs(align) - 20;

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jesse Barnes July 6, 2011, 5:48 p.m. UTC | #2
On Fri, 01 Jul 2011 08:01:33 +0200
Oliver Hartkopp <socketcan@hartkopp.net> wrote:

> On 01.07.2011 01:47, Ram Pai wrote:
> > From: Yinghai Lu <yinghai@kernel.org>
> > 
> > From: Yinghai Lu <yinghai@kernel.org>
> > 
> > Allocate resources to SRIOV BARs only after all other required
> > resource-requests are satisfied. Dont retry if resource allocation for SRIOV
> > BARs fail.
> > 
> > Signed-off-by: Ram Pai <linuxram@us.ibm.com>
> > Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> 
> Tested-by: Oliver Hartkopp <socketcan@hartkopp.net>
> 
> I applied the whole patchset and it looks very similar to the dmsg output
> before the problematic commit that caused the regression.

Ok Oliver, can I ask you to test one more tree?  We'll shoot for
including Ram's patches in -next, but I've just included his other
patch to disable the new realloc code by default for the current
kernel.  Can you give my for-linus tree a try and make sure it gives
you back the old behavior?  Thanks a lot for your diligent testing so
far.

git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6 is the
tree, then check out the "for-linus" branch.

Thanks,
diff mbox

Patch

diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 9f2f15f..a0555cb 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -669,6 +669,16 @@  static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
 			if (r->parent || (r->flags & mask) != type)
 				continue;
 			r_size = resource_size(r);
+#ifdef CONFIG_PCI_IOV
+			/* put SRIOV requested res to the optional list */
+			if (add_head && i >= PCI_IOV_RESOURCES &&
+					i <= PCI_IOV_RESOURCE_END) {
+				r->end = r->start - 1;
+				add_to_list(add_head, dev, r, r_size, 1);
+				children_add_size += r_size;
+				continue;
+			}
+#endif
 			/* For bridges size != alignment */
 			align = pci_resource_alignment(dev, r);
 			order = __ffs(align) - 20;