early_init_devtree() order of memblock limit setting

Kumar Gala galak at kernel.crashing.org
Mon Sep 5 06:08:32 EST 2011


Ben,

I've got an issue on Book-E 64 with the bolted linear mapping and how big it might be.  We have to take into account things like mem= when determining how to set ppc64_rma_size.  So I'm wondering if there is a reason w/regards to the order in which we call setup_initial_memory_limit() vs parsing the cmdline and calling memblock_enforce_memory_limit(limit) in early_init_devtree().

Could we reorder the follow code such that we call setup_initial_memory_limit() to after memblock_enforce_memory_limit()?

- k

void __init early_init_devtree(void *params)
{
	…

        setup_initial_memory_limit(memstart_addr, first_memblock_size);

        /* Save command line for /proc/cmdline and then parse parameters */
        strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
        parse_early_param();

        /* Reserve MEMBLOCK regions used by kernel, initrd, dt, etc... */
        memblock_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
        /* If relocatable, reserve first 32k for interrupt vectors etc. */
        if (PHYSICAL_START > MEMORY_START)
                memblock_reserve(MEMORY_START, 0x8000);
        reserve_kdump_trampoline();
        reserve_crashkernel();
        early_reserve_mem();
        phyp_dump_reserve_mem();

        limit = memory_limit;
        if (! limit) {
                phys_addr_t memsize;

                /* Ensure that total memory size is page-aligned, because
                 * otherwise mark_bootmem() gets upset. */
                memblock_analyze();
                memsize = memblock_phys_mem_size();
                if ((memsize & PAGE_MASK) != memsize)
                        limit = memsize & PAGE_MASK;
        }
        memblock_enforce_memory_limit(limit);

	…
}


More information about the Linuxppc-dev mailing list