[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC 9/9] x86/misc: Post cleanup
* panic() now works on early boot. Replace EARLY_FAIL() * idt_table is 4096 bytes. Page align it. * Cleanup __set_intr_gate() & friends. The master IDT is fully constructed on early boot, and only subsequently altered on the crash path. Make them private to traps.c, move them into .init, and remove the loop over all idts, as __set_intr_gate() will never find an AP to patch. (For some reason, leaving out the noinline causes ~1.5k of code bloat from GCC inlining everything) Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CC: Keir Fraser <keir@xxxxxxx> CC: Jan Beulich <JBeulich@xxxxxxxx> CC: Tim Deegan <tim@xxxxxxx> --- xen/arch/x86/setup.c | 20 ++++++-------------- xen/arch/x86/traps.c | 13 ++++--------- xen/include/asm-x86/desc.h | 1 - 3 files changed, 10 insertions(+), 24 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index ef5863f..1c0d1c7 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -134,11 +134,6 @@ static void __init parse_acpi_param(char *s) } } -#define EARLY_FAIL(f, a...) do { \ - printk( f , ## a ); \ - for ( ; ; ) halt(); \ -} while (0) - static const module_t *__initdata initial_images; static unsigned int __initdata nr_initial_images; @@ -671,11 +666,10 @@ void __init noreturn __start_xen(unsigned long mbi_p) /* Check that we have at least one Multiboot module. */ if ( !(mbi->flags & MBI_MODULES) || (mbi->mods_count == 0) ) - EARLY_FAIL("dom0 kernel not specified. " - "Check bootloader configuration.\n"); + panic("dom0 kernel not specified. Check bootloader configuration."); if ( ((unsigned long)cpu0_stack & (STACK_SIZE-1)) != 0 ) - EARLY_FAIL("Misaligned CPU0 stack.\n"); + panic("Misaligned CPU0 stack."); if ( efi_enabled ) { @@ -756,9 +750,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) e820_raw_nr = 2; } else - { - EARLY_FAIL("Bootloader provided no memory information.\n"); - } + panic("Bootloader provided no memory information."); /* Sanitise the raw E820 map to produce a final clean version. */ max_page = raw_max_page = init_e820(memmap_type, e820_raw, &e820_raw_nr); @@ -793,7 +785,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) for ( i = 0; !efi_enabled && i < mbi->mods_count; i++ ) { if ( mod[i].mod_start & (PAGE_SIZE - 1) ) - EARLY_FAIL("Bootloader didn't honor module alignment request.\n"); + panic("Bootloader didn't honor module alignment request."); mod[i].mod_end -= mod[i].mod_start; mod[i].mod_start >>= PAGE_SHIFT; mod[i].reserved = 0; @@ -966,7 +958,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) } if ( modules_headroom && !mod->reserved ) - EARLY_FAIL("Not enough memory to relocate the dom0 kernel image.\n"); + panic("Not enough memory to relocate the dom0 kernel image."); for ( i = 0; i < mbi->mods_count; ++i ) { uint64_t s = (uint64_t)mod[i].mod_start << PAGE_SHIFT; @@ -975,7 +967,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) } if ( !xen_phys_start ) - EARLY_FAIL("Not enough memory to relocate Xen.\n"); + panic("Not enough memory to relocate Xen."); reserve_e820_ram(&boot_e820, efi_enabled ? mbi->mem_upper : __pa(&_start), __pa(&_end)); diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index 4dfcf4f..d16d3e7 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -97,7 +97,7 @@ DEFINE_PER_CPU_READ_MOSTLY(struct desc_struct *, gdt_table); DEFINE_PER_CPU_READ_MOSTLY(struct desc_struct *, compat_gdt_table); /* Master table, used by CPU0. */ -idt_entry_t idt_table[IDT_ENTRIES]; +idt_entry_t idt_table[IDT_ENTRIES] __attribute__ ((__section__(".bss.page_aligned"))); /* Pointer to the IDT of every CPU. */ idt_entry_t *idt_tables[NR_CPUS] __read_mostly; @@ -3422,22 +3422,17 @@ void do_debug(struct cpu_user_regs *regs) return; } -static void __set_intr_gate(unsigned int n, uint32_t dpl, void *addr) +static void __init noinline __set_intr_gate(unsigned int n, uint32_t dpl, void *addr) { - int i; - /* Keep secondary tables in sync with IRQ updates. */ - for ( i = 1; i < nr_cpu_ids; i++ ) - if ( idt_tables[i] != NULL ) - _set_gate(&idt_tables[i][n], DESC_TYPE_irq_gate, dpl, addr); _set_gate(&idt_table[n], DESC_TYPE_irq_gate, dpl, addr); } -static void set_swint_gate(unsigned int n, void *addr) +static void __init set_swint_gate(unsigned int n, void *addr) { __set_intr_gate(n, 3, addr); } -void set_intr_gate(unsigned int n, void *addr) +static void __init set_intr_gate(unsigned int n, void *addr) { __set_intr_gate(n, 0, addr); } diff --git a/xen/include/asm-x86/desc.h b/xen/include/asm-x86/desc.h index 6b2094f..f11f920 100644 --- a/xen/include/asm-x86/desc.h +++ b/xen/include/asm-x86/desc.h @@ -199,7 +199,6 @@ DECLARE_PER_CPU(struct desc_struct *, gdt_table); extern struct desc_struct boot_cpu_compat_gdt_table[]; DECLARE_PER_CPU(struct desc_struct *, compat_gdt_table); -extern void set_intr_gate(unsigned int irq, void * addr); extern void load_TR(void); #endif /* !__ASSEMBLY__ */ -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |