[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 6/8] x86/setup: move vm_init() before end_boot_allocator()
On Mon, 2020-02-03 at 11:10 +0000, Xia, Hongyan wrote: > Is there any problem to move vm_init() even earlier than this, like > right after init_frametable()? ACPI and NUMA functions need a couple of > things permanently mapped. You want it sooner than that, don't you? The code calls acpi_boot_table_init() and srat_parse_regions() while looping over the e820 regions, before init_frametable(). But that's OK; you can call vm_init() the moment you have the pages in the boot allocator to support it. So you can do something like the hack below, for example. This boots in all three of the liveupdate=, <4GiB, >4GiB cases on x86_64 — but will probably break Arm unless you make vm_init() run soon enough there too, and will potentially run vm_init() more than once on x86_64 if acpi_boot_table_init() fails the first time(s). But as a proof-of-concept, sure. diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 2071e5acee..8aee55f31a 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1487,12 +1487,16 @@ void __init noreturn __start_xen(unsigned long mbi_p) continue; if ( !acpi_boot_table_init_done && - s >= (1ULL << 32) && - !acpi_boot_table_init() ) + s >= (1ULL << 32) ) { - acpi_boot_table_init_done = true; - srat_parse_regions(s); - setup_max_pdx(raw_max_page); + printk("acpi/vm init\n"); + vm_init(); // XX: not idempotent + if ( !acpi_boot_table_init() ) + { + acpi_boot_table_init_done = true; + srat_parse_regions(s); + setup_max_pdx(raw_max_page); + } } if ( pfn_to_pdx((e - 1) >> PAGE_SHIFT) >= max_pdx ) @@ -1677,14 +1681,16 @@ void __init noreturn __start_xen(unsigned long mbi_p) init_frametable(); if ( !acpi_boot_table_init_done ) + { + printk("Late vm/acpi init\n"); + vm_init(); acpi_boot_table_init(); + } acpi_numa_init(); numa_initmem_init(0, raw_max_page); - vm_init(); - if ( lu_breadcrumb_phys ) { lu_stream_map(&lu_stream, lu_mfnlist_phys, lu_nr_pages); diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index f1e7d81edc..e5d938f8ca 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -322,7 +322,7 @@ void __init init_boot_pages(paddr_t ps, paddr_t pe) MAX_ORDER + 1); #endif BUILD_BUG_ON(sizeof(frame_table->u) != sizeof(unsigned long)); - + printk("init boot pages %lx %lx\n", ps, pe); ps = round_pgup(ps); pe = round_pgdown(pe); if ( pe <= ps ) @@ -395,7 +395,7 @@ mfn_t __init alloc_boot_pages(unsigned long nr_pfns, unsigned long pfn_align) unsigned int i = nr_bootmem_regions; BUG_ON(!nr_bootmem_regions); - + printk("alloc_boot_pages %ld\n", nr_pfns); while ( i-- ) { struct bootmem_region *r = &bootmem_region_list[i]; diff --git a/xen/drivers/acpi/osl.c b/xen/drivers/acpi/osl.c index 4c8bb7839e..b7fcee408e 100644 --- a/xen/drivers/acpi/osl.c +++ b/xen/drivers/acpi/osl.c @@ -92,10 +92,11 @@ acpi_physical_address __init acpi_os_get_root_pointer(void) void __iomem * acpi_os_map_memory(acpi_physical_address phys, acpi_size size) { - if (system_state >= SYS_STATE_boot) { + if (1 || system_state >= SYS_STATE_boot) { mfn_t mfn = _mfn(PFN_DOWN(phys)); unsigned int offs = phys & (PAGE_SIZE - 1); + printk("ACPI vmap %08lx\n", phys); /* The low first Mb is always mapped on x86. */ if (IS_ENABLED(CONFIG_X86) && !((phys + size - 1) >> 20)) return __va(phys); @@ -114,7 +115,7 @@ void acpi_os_unmap_memory(void __iomem * virt, acpi_size size) return; } - if (system_state >= SYS_STATE_boot) + if (1 || system_state >= SYS_STATE_boot) vunmap((void *)((unsigned long)virt & PAGE_MASK)); } Attachment:
smime.p7s _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |