From: Ram Pai <linuxram@us.ibm.com>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Ram Pai <linuxram@us.ibm.com>,
Jesse Barnes <jbarnes@virtuousgeek.org>,
Bjorn Helgaas <bjorn.helgaas@hp.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
clemens@ladisch.de,
Linus Torvalds <torvalds@linux-foundation.org>,
peter.henriksson@gmail.com, ebiederm@aristanetworks.com
Subject: Re: [PATCH 1/1 v4] PCI: allocate essential resources before reserving hotplug resources
Date: Thu, 20 Jan 2011 23:17:05 -0800 [thread overview]
Message-ID: <20110121071705.GC5009@ram-laptop> (raw)
In-Reply-To: <AANLkTikaSs6eN9hC=S+qrg26LrrMSpKcbsYz9HNOHWJi@mail.gmail.com>
On Thu, Jan 20, 2011 at 05:22:02PM -0800, Yinghai Lu wrote:
> On Wed, Jan 19, 2011 at 5:00 PM, Ram Pai <linuxram@us.ibm.com> wrote:
> > PCI: pre-allocate additional resources to devices only after successful
> > allocation of essential resources.
> >
> > Linux tries to pre-allocate minimal resources to hotplug bridges. This
> > works fine as long as there are enough resources to satisfy all other
> > genuine resource requirements. However if enough resources are not
> > available to satisfy any of these nice-to-have pre-allocations, the
> > resource-allocator reports errors and returns failure.
> >
> > This patch distinguishes between must-have resource from nice-to-have
> > resource. Any failure to allocate nice-to-have resources are ignored.
> >
> > This behavior can be particularly useful to trigger automatic
> > reallocation when the OS discovers genuine allocation-conflicts
> > or genuine unallocated-requests caused by buggy allocation behavior
> > of the native BIOS/uEFI.
> >
> > https://bugzilla.kernel.org/show_bug.cgi?id=15960 captures the movitation
> > behind the patch.
> >
> > changelog v2: o fixed a bug where pci_assign_resource() was called on a
> > resource of zero resource size.
> >
> > changelog v3: addressed Bjorn's comment
> > o "Please don't indent and right-justify the changelog".
> > o removed add_size from struct resource. The additional
> > size is now tracked using a linked list.
> >
> > changelog v4: o moved freeing up of elements of head list from
> > assign_requested_resources_sorted() to
> > __assign_resources_sorted(). This fixes a corruption bug.
> > o removed a wrong reference to 'add_size' in
> > pbus_size_mem(). Erroneously got introduced while
> > generating the patch.
> > o some code optimizations in adjust_resources_sorted()
> > and assign_requested_resources_sorted()
> >
> > Signed-off-by: Ram Pai <linuxram@us.ibm.com>
> >
> > diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
> > index 66cb8f4..efbdff2 100644
> > --- a/drivers/pci/setup-bus.c
> > +++ b/drivers/pci/setup-bus.c
> > @@ -33,11 +33,23 @@ struct resource_list_x {
> > struct pci_dev *dev;
> > resource_size_t start;
> > resource_size_t end;
> > + resource_size_t add_size;
> > unsigned long flags;
> > };
> >
> > -static void add_to_failed_list(struct resource_list_x *head,
> > - struct pci_dev *dev, struct resource *res)
> > +#define free_list(type, head) do { \
> > + struct type *list, *tmp; \
> > + for (list = (head)->next; list;) { \
> > + tmp = list; \
> > + list = list->next; \
> > + kfree(tmp); \
> > + } \
> > + (head)->next = NULL; \
> > +} while (0)
>
> inline function should be better?
I thought about it and decided to use the macro since the 'head' can
be either a resouce_list_x pointer or a resouce_list pointer.
A datastructure agonistic inline function would not be clean
enough.
RP
>
> Yinghai
next prev parent reply other threads:[~2011-01-21 7:17 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-06 22:58 [RFC v2 PATCH 1/1] PCI: override BIOS/firmware resource allocation Ram Pai
2010-10-06 23:39 ` Bjorn Helgaas
2010-10-07 0:30 ` Ram Pai
2010-10-07 4:13 ` Bjorn Helgaas
2010-10-07 20:42 ` Ram Pai
2010-10-07 21:41 ` Bjorn Helgaas
2010-10-08 17:32 ` Ram Pai
2010-10-08 20:16 ` Bjorn Helgaas
2010-10-12 7:05 ` Ram Pai
2010-10-12 19:01 ` Bjorn Helgaas
2010-10-18 20:10 ` Jesse Barnes
2010-10-19 17:17 ` Ram Pai
2010-10-19 18:24 ` Jesse Barnes
2010-10-22 0:28 ` Ram Pai
2010-10-22 17:55 ` Bjorn Helgaas
2010-10-22 18:59 ` Ram Pai
2010-10-22 21:49 ` Bjorn Helgaas
2010-10-22 17:16 ` [PATCH 1/1] PCI: ignore failure to preallocate minimal resources to hotplug bridges Ram Pai
2010-10-22 22:16 ` Bjorn Helgaas
2011-01-07 22:32 ` Jesse Barnes
2011-01-11 21:10 ` Ram Pai
2011-01-14 18:19 ` [PATCH 1/1] PCI: allocate essential resources before reserving hotplug resources Ram Pai
2011-01-18 20:52 ` Bjorn Helgaas
2011-01-18 21:42 ` Ram Pai
2011-01-18 22:11 ` Bjorn Helgaas
2011-01-19 19:58 ` [PATCH 1/1 v3] " Ram Pai
2011-01-20 1:00 ` [PATCH 1/1 v4] " Ram Pai
2011-01-21 1:22 ` Yinghai Lu
2011-01-21 7:17 ` Ram Pai [this message]
2011-01-18 21:30 ` [PATCH 1/1 Version 2.0] " Ram Pai
2011-01-18 21:46 ` Bjorn Helgaas
2011-01-18 22:03 ` Ram Pai
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=20110121071705.GC5009@ram-laptop \
--to=linuxram@us.ibm.com \
--cc=bjorn.helgaas@hp.com \
--cc=clemens@ladisch.de \
--cc=ebiederm@aristanetworks.com \
--cc=jbarnes@virtuousgeek.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=peter.henriksson@gmail.com \
--cc=torvalds@linux-foundation.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