Re: [PATCH] x86-64: improve e820_search_gap()

From: Jan Beulich
Date: Thu Mar 12 2009 - 07:31:27 EST


>>> Ingo Molnar <mingo@xxxxxxx> 12.03.09 12:02 >>>
>
> +#ifdef CONFIG_X86_64
> + if (start_addr >= MAX_GAP_END)
> + last = end_addr ?: (1UL << boot_cpu_data.x86_phys_bits);
> + else
> +#endif
> last = (end_addr && end_addr < MAX_GAP_END) ? end_addr : MAX_GAP_END;

>hm, this #ifdef block looks quite ugly and should be cleaned up.
>x86_phys_bits could be filled in on 32-bit too - and on 32-bit

I'm about to submit a patch to that effect. But I'm trying to keep patches
independent as much as possible.

>start_addr cannot be larger than 4GB anyway.

Correct, but I think the code would be less self-documenting if it relied
on that fact rather than making clear from the first glance that the
conditional is only being evaluated (and hence can only be true) on 64-bits.

>> @@ -585,11 +591,12 @@ __init void e820_setup_gap(void)
>>
>> #ifdef CONFIG_X86_64
>> if (!found) {
>> - gapstart = (max_pfn << PAGE_SHIFT) + 1024*1024;
>> printk(KERN_ERR "PCI: Warning: Cannot find a gap in the 32bit "
>> "address range\n"
>> KERN_ERR "PCI: Unassigned devices with 32bit resource "
>> "registers may break!\n");
>> + found = e820_search_gap(&gapstart, &gapsize, MAX_GAP_END, 0);
>> + BUG_ON(!found);
>
>that BUG_ON() will be hard to debug - please use a WARN_ON
>instead.

Will do, but please clarify the above point before I re-submit.

Jan

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