diff mbox

[2/5] resources: Set type in __request_region()

Message ID 20140311174249.23084.66300.stgit@bhelgaas-glaptop.roam.corp.google.com
State Accepted
Headers show

Commit Message

Bjorn Helgaas March 11, 2014, 5:42 p.m. UTC
We don't set the type (I/O, memory, etc.) of resources added by
__request_region(), which leads to confusing messages like this:

    address space collision: [io  0x1000-0x107f] conflicts with ACPI CPU throttle [??? 0x00001010-0x00001015 flags 0x80000000]

Set the type of a new resource added by __request_region() (used by
request_region() and request_mem_region()) to the type of its parent.  This
makes the resource tree internally consistent and fixes messages like the
above, where the ACPI CPU throttle resource really is an I/O port region,
but request_region() didn't fill in the type, so %pR didn't know how to
print it.

Sample dmesg showing the issue at the link below.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=71611
Reported-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 kernel/resource.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


--
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

Comments

Yinghai Lu March 11, 2014, 9:44 p.m. UTC | #1
On Tue, Mar 11, 2014 at 10:42 AM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> We don't set the type (I/O, memory, etc.) of resources added by
> __request_region(), which leads to confusing messages like this:
>
>     address space collision: [io  0x1000-0x107f] conflicts with ACPI CPU throttle [??? 0x00001010-0x00001015 flags 0x80000000]
>
> Set the type of a new resource added by __request_region() (used by
> request_region() and request_mem_region()) to the type of its parent.  This
> makes the resource tree internally consistent and fixes messages like the
> above, where the ACPI CPU throttle resource really is an I/O port region,
> but request_region() didn't fill in the type, so %pR didn't know how to
> print it.
>
> Sample dmesg showing the issue at the link below.
>
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=71611
> Reported-by: Paul Bolle <pebolle@tiscali.nl>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
>  kernel/resource.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/resource.c b/kernel/resource.c
> index a8344dda7049..ae1f742c860c 100644
> --- a/kernel/resource.c
> +++ b/kernel/resource.c
> @@ -945,8 +945,8 @@ struct resource * __request_region(struct resource *parent,
>         res->name = name;
>         res->start = start;
>         res->end = start + n - 1;
> -       res->flags = IORESOURCE_BUSY;
> -       res->flags |= flags;
> +       res->flags = parent->flags;

can we use (parent->flags & IORESOURCE_TYPE_BITS) instead?

> +       res->flags |= IORESOURCE_BUSY | flags;
>
>         write_lock(&resource_lock);
>
>
--
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
Bjorn Helgaas March 11, 2014, 10:06 p.m. UTC | #2
On Tue, Mar 11, 2014 at 3:44 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> On Tue, Mar 11, 2014 at 10:42 AM, Bjorn Helgaas <bhelgaas@google.com> wrote:
>> We don't set the type (I/O, memory, etc.) of resources added by
>> __request_region(), which leads to confusing messages like this:
>>
>>     address space collision: [io  0x1000-0x107f] conflicts with ACPI CPU throttle [??? 0x00001010-0x00001015 flags 0x80000000]
>>
>> Set the type of a new resource added by __request_region() (used by
>> request_region() and request_mem_region()) to the type of its parent.  This
>> makes the resource tree internally consistent and fixes messages like the
>> above, where the ACPI CPU throttle resource really is an I/O port region,
>> but request_region() didn't fill in the type, so %pR didn't know how to
>> print it.
>>
>> Sample dmesg showing the issue at the link below.
>>
>> Link: https://bugzilla.kernel.org/show_bug.cgi?id=71611
>> Reported-by: Paul Bolle <pebolle@tiscali.nl>
>> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
>> ---
>>  kernel/resource.c |    4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/resource.c b/kernel/resource.c
>> index a8344dda7049..ae1f742c860c 100644
>> --- a/kernel/resource.c
>> +++ b/kernel/resource.c
>> @@ -945,8 +945,8 @@ struct resource * __request_region(struct resource *parent,
>>         res->name = name;
>>         res->start = start;
>>         res->end = start + n - 1;
>> -       res->flags = IORESOURCE_BUSY;
>> -       res->flags |= flags;
>> +       res->flags = parent->flags;
>
> can we use (parent->flags & IORESOURCE_TYPE_BITS) instead?

Yep, that seems like a good idea.  I changed it to:

+       res->flags = resource_type(parent);

Bjorn

>> +       res->flags |= IORESOURCE_BUSY | flags;
>>
>>         write_lock(&resource_lock);
>>
>>
--
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
diff mbox

Patch

diff --git a/kernel/resource.c b/kernel/resource.c
index a8344dda7049..ae1f742c860c 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -945,8 +945,8 @@  struct resource * __request_region(struct resource *parent,
 	res->name = name;
 	res->start = start;
 	res->end = start + n - 1;
-	res->flags = IORESOURCE_BUSY;
-	res->flags |= flags;
+	res->flags = parent->flags;
+	res->flags |= IORESOURCE_BUSY | flags;
 
 	write_lock(&resource_lock);