Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1208964 > unrolled thread
| Started by | Bjorn Helgaas <bhelgaas@google.com> |
|---|---|
| First post | 2015-08-18 02:00 +0200 |
| Last post | 2015-08-19 00:40 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v3 20/51] PCI: Skip must+optional if there is no optional addon Bjorn Helgaas <bhelgaas@google.com> - 2015-08-18 02:00 +0200
Re: [PATCH v3 20/51] PCI: Skip must+optional if there is no optional addon Yinghai Lu <yinghai@kernel.org> - 2015-08-19 00:40 +0200
| From | Bjorn Helgaas <bhelgaas@google.com> |
|---|---|
| Date | 2015-08-18 02:00 +0200 |
| Subject | Re: [PATCH v3 20/51] PCI: Skip must+optional if there is no optional addon |
| Message-ID | <pYCtP-5KG-3@gated-at.bofh.it> |
On Mon, Jul 27, 2015 at 04:29:38PM -0700, Yinghai Lu wrote:
> If the bridge does not support hotplug or no child with sriov support
> we could get out early and don't try must+optional allocation.
You mention non-hotplug bridges and non-SR-IOV devices, but I can't figure
out how the patch itself relates to those. How can I connect them?
> Also in the loop that update res with optional add info, skip resource
> that add_size is 0.
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> ---
> drivers/pci/setup-bus.c | 32 +++++++++++++++++++++++++++++---
> 1 file changed, 29 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
> index d1f9e19..64ef516 100644
> --- a/drivers/pci/setup-bus.c
> +++ b/drivers/pci/setup-bus.c
> @@ -450,6 +450,24 @@ static bool pci_need_to_release(unsigned long mask, struct resource *res)
> return false; /* should not get here */
> }
>
> +static bool __has_addon(struct list_head *head,
> + struct list_head *realloc_head)
Why does this have a "__" prefix?
> +{
> + int add_count = 0;
> + struct pci_dev_resource *dev_res, *tmp_res;
> +
> + /* check if we have add really */
> + list_for_each_entry(dev_res, head, list) {
> + tmp_res = res_to_dev_res(realloc_head, dev_res->res);
> + if (!tmp_res || !tmp_res->add_size)
> + continue;
> +
> + add_count++;
> + }
> +
> + return add_count != 0;
> +}
> +
> static bool save_resources(struct list_head *head,
> struct list_head *save_head)
> {
> @@ -481,16 +499,24 @@ static bool __assign_resources_must_add_sorted(struct list_head *head,
> struct pci_dev_resource *save_res;
> struct pci_dev_resource *dev_res, *tmp_res;
> unsigned long fail_type;
> - resource_size_t add_align;
> + resource_size_t add_align, add_size;
> struct resource *res;
>
> + if (!__has_addon(head, realloc_head))
> + return false;
> +
> if (!save_resources(head, &save_head))
> return false;
>
> /* Update res in head list with add_size in realloc_head list */
> list_for_each_entry(dev_res, head, list) {
> res = dev_res->res;
> - res->end += get_res_add_size(realloc_head, res);
> + add_size = get_res_add_size(realloc_head, res);
> +
> + if (!add_size)
> + continue;
> +
> + res->end += add_size;
>
> /*
> * There are two kinds of additional resources in the list:
> @@ -578,7 +604,7 @@ static void __assign_resources_sorted(struct list_head *head,
> */
>
> /* Check must+optional add */
> - if (realloc_head && !list_empty(realloc_head) &&
> + if (realloc_head &&
Why are you dropping the !list_empty() test?
> __assign_resources_must_add_sorted(head, realloc_head))
> return;
>
> --
> 1.8.4.5
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Yinghai Lu <yinghai@kernel.org> |
|---|---|
| Date | 2015-08-19 00:40 +0200 |
| Subject | Re: [PATCH v3 20/51] PCI: Skip must+optional if there is no optional addon |
| Message-ID | <pYXHY-3Pc-5@gated-at.bofh.it> |
| In reply to | #1208964 |
On Mon, Aug 17, 2015 at 4:56 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> On Mon, Jul 27, 2015 at 04:29:38PM -0700, Yinghai Lu wrote:
>> If the bridge does not support hotplug or no child with sriov support
>> we could get out early and don't try must+optional allocation.
>
> You mention non-hotplug bridges and non-SR-IOV devices, but I can't figure
> out how the patch itself relates to those. How can I connect them?
in setup that does not support hotplug and sriov, then we will not
have optional resources.
>
>> Also in the loop that update res with optional add info, skip resource
>> that add_size is 0.
>>
>> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>> ---
>> drivers/pci/setup-bus.c | 32 +++++++++++++++++++++++++++++---
>> 1 file changed, 29 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
>> index d1f9e19..64ef516 100644
>> --- a/drivers/pci/setup-bus.c
>> +++ b/drivers/pci/setup-bus.c
>> @@ -450,6 +450,24 @@ static bool pci_need_to_release(unsigned long mask, struct resource *res)
>> return false; /* should not get here */
>> }
>>
>> +static bool __has_addon(struct list_head *head,
>> + struct list_head *realloc_head)
>
> Why does this have a "__" prefix?
Sorry, will remove that.
>
>> +{
>> + int add_count = 0;
>> + struct pci_dev_resource *dev_res, *tmp_res;
>> +
>> + /* check if we have add really */
>> + list_for_each_entry(dev_res, head, list) {
>> + tmp_res = res_to_dev_res(realloc_head, dev_res->res);
>> + if (!tmp_res || !tmp_res->add_size)
>> + continue;
>> +
>> + add_count++;
>> + }
>> +
>> + return add_count != 0;
>> +}
>> +
>> static bool save_resources(struct list_head *head,
>> struct list_head *save_head)
>> {
>> @@ -481,16 +499,24 @@ static bool __assign_resources_must_add_sorted(struct list_head *head,
>> struct pci_dev_resource *save_res;
>> struct pci_dev_resource *dev_res, *tmp_res;
>> unsigned long fail_type;
>> - resource_size_t add_align;
>> + resource_size_t add_align, add_size;
>> struct resource *res;
>>
>> + if (!__has_addon(head, realloc_head))
>> + return false;
>> +
>> if (!save_resources(head, &save_head))
>> return false;
>>
>> /* Update res in head list with add_size in realloc_head list */
>> list_for_each_entry(dev_res, head, list) {
>> res = dev_res->res;
>> - res->end += get_res_add_size(realloc_head, res);
>> + add_size = get_res_add_size(realloc_head, res);
>> +
>> + if (!add_size)
>> + continue;
>> +
>> + res->end += add_size;
>>
>> /*
>> * There are two kinds of additional resources in the list:
>> @@ -578,7 +604,7 @@ static void __assign_resources_sorted(struct list_head *head,
>> */
>>
>> /* Check must+optional add */
>> - if (realloc_head && !list_empty(realloc_head) &&
>> + if (realloc_head &&
>
> Why are you dropping the !list_empty() test?
count in __has_addon() will be 0, so we can skip checking here.
>
>> __assign_resources_must_add_sorted(head, realloc_head))
>> return;
>>
>> --
>> 1.8.4.5
>>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web