On Wed, May 23, 2012 at 10:30 AM, Yinghai Lu <yinghai@xxxxxxxxxx> wrote: > On Wed, May 23, 2012 at 8:57 AM, Linus Torvalds > <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: >> On Tue, May 22, 2012 at 11:34 PM, Yinghai Lu <yinghai@xxxxxxxxxx> wrote: >>> and will fall back to below 4g if it can not find any above 4g. >> >> Has this been tested on 32-bit machines without PAE? There might be >> things that just happen to work because their allocations were always >> done bottom-up. > > Good point. that problem should be addressed at first before this patch. Just checked code for 32bit machines without PAE. when X86_PAE is not set, phys_addr_t aka resource_size_t will be 32bit. so in drivers/pci/bus.c::pci_bus_alloc_resource_fit() will have bottom to 0. resource_size_t bottom = PCIBIOS_MAX_MEM_32 + 1ULL; also in arch/x86/kernel/setup.c::setup_arch() iomem_resource.end = (1ULL << boot_cpu_data.x86_phys_bits) - 1; will have iomem_resource.end to 0xffffffff when X86_PAE is set, but CPU does not support PAE. phys_addr_t aka resource_size_t will be 32bit. so in drivers/pci/bus.c::pci_bus_alloc_resource_fit() will have bottom to 4g. resource_size_t bottom = PCIBIOS_MAX_MEM_32 + 1ULL; but in arch/x86/kernel/setup.c::setup_arch() iomem_resource.end = (1ULL << boot_cpu_data.x86_phys_bits) - 1; will have iomem_resource.end to 0xffffffff, because x86_phys_bits is 32 when PAE is not detected in arch/x86/kernel/cpu/common.c::get_cpu_cap. that mean first try will fail, so it will go to second try with bottom to 0. so both case are safe with this patch. Thanks Yinghai -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html