Re: [PATCH] x86: fix IO APIC resource allocation error message

From: Bartlomiej Zolnierkiewicz
Date: Fri Mar 20 2009 - 16:25:37 EST


On Friday 20 March 2009, Cyrill Gorcunov wrote:
> [Bartlomiej Zolnierkiewicz - Fri, Mar 20, 2009 at 09:02:28PM +0100]
> | On Friday 20 March 2009, Cyrill Gorcunov wrote:
> | > [Bartlomiej Zolnierkiewicz - Fri, Mar 20, 2009 at 08:12:41PM +0100]
> | > | From: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>
> | > | Subject: [PATCH] x86: fix IO APIC resource allocation error message
> | > |
> | > | Impact: fix incorrect error message
> | > |
> | > | - IO APIC resource allocation error message contains one too many "be".
> | > |
> | > | - Print the error message iff there are IO APICs in the system.
> | > |
> | > | Cc: Alan Bartlett <ajb.stxsl@xxxxxxxxxxxxxx>
> | > | Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>
> | > | ---
> | > | I've seen this error message for some time on my x86-32 laptop...
> | > |
> | > | arch/x86/kernel/io_apic.c | 4 ++--
> | > | 1 file changed, 2 insertions(+), 2 deletions(-)
> | > |
> | > | Index: b/arch/x86/kernel/io_apic.c
> | > | ===================================================================
> | > | --- a/arch/x86/kernel/io_apic.c
> | > | +++ b/arch/x86/kernel/io_apic.c
> | > | @@ -4150,9 +4150,9 @@ static int __init ioapic_insert_resource
> | > | int i;
> | > | struct resource *r = ioapic_resources;
> | > |
> | > | - if (!r) {
> | > | + if (!r && nr_ioapics > 0) {
> | > | printk(KERN_ERR
> | > | - "IO APIC resources could be not be allocated.\n");
> | > | + "IO APIC resources couldn't be allocated.\n");
> | > | return -1;
> | > | }
> | > |
> | > |
> | >
> | > Hi Bartlomiej,
> | >
> | > until I miss something I guess you could even make it simplier :)
> | > Something like
> | >
> | > ---
> | > static int __init ioapic_insert_resources(void)
> | > {
> | > struct resource *r = ioapic_resources;
> | > int err;
> | > int i;
> | >
> | > for (i = 0; i < nr_ioapics; i++) {
> | > err = insert_resource(&iomem_resource, r);
> | > if (err) {
> | > pr_err("IO APIC resources could not be allocated.\n");
> | > return err;
> | > }
> | > r++;
> | > }
> | >
> | > return 0;
> | > }
> | > ---
> | >
> | > Now we would have 'err' here and get out only on conflicting resource.
> | > Did I miss something?
> |
> | nr_ioapics > 0 && r == NULL ?
> |
>
> This case happens when alloc_bootmem fails but we already panic'ed!
>
> Here is what I mean
>
> From ioapic_setup_resources()
>
> if (nr_ioapics <= 0)
> return NULL;
>
> mem = alloc_bootmem(n); <- we panic here anyway

Seems like the following check is superfluous then:

if (mem != NULL) {

> ...
> ioapic_resources = res;

In either case I don't think we that failing all resource insertions
(for all IO APICs) if only one has failed is a desirable behavior...

Thanks,
Bart
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/