The current code simply calls "start_kernel" directly if we're under a hypervisor and no paravirt_ops backend wants us, because paravirt.c registers that as a backend. This was always a vain hope; start_kernel won't get far without setup. It's also impossible for paravirt_ops backends which don't sit in the arch/i386/kernel directory: they can't link before paravirt.o anyway. Keep it simple: if we pass all the registered paravirt probes, BUG(). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> diff -r 4fb7fc327801 arch/i386/kernel/Makefile --- a/arch/i386/kernel/Makefile Mon Feb 12 12:37:01 2007 +1100 +++ b/arch/i386/kernel/Makefile Mon Feb 12 12:55:00 2007 +1100 @@ -41,8 +41,6 @@ obj-$(CONFIG_KWATCH) += debugreg.o kwat obj-$(CONFIG_KWATCH) += debugreg.o kwatch.o obj-$(CONFIG_VMI) += vmi.o vmitime.o - -# Make sure this is linked after any other paravirt_ops structs: see head.S obj-$(CONFIG_PARAVIRT) += paravirt.o EXTRA_AFLAGS := -traditional diff -r 4fb7fc327801 arch/i386/kernel/head.S --- a/arch/i386/kernel/head.S Mon Feb 12 12:37:01 2007 +1100 +++ b/arch/i386/kernel/head.S Mon Feb 12 12:54:19 2007 +1100 @@ -513,10 +513,11 @@ startup_paravirt: pushl %ecx pushl %eax - /* paravirt.o is last in link, and that probe fn never returns */ pushl $__start_paravirtprobe 1: movl 0(%esp), %eax + cmpl $__stop_paravirtprobe, %eax + je unhandled_paravirt pushl (%eax) movl 8(%esp), %eax call *(%esp) @@ -528,6 +529,10 @@ 1: addl $4, (%esp) jmp 1b + +unhandled_paravirt: + /* Nothing wanted us: we're screwed. */ + ud2 #endif /* diff -r 4fb7fc327801 arch/i386/kernel/paravirt.c --- a/arch/i386/kernel/paravirt.c Mon Feb 12 12:37:01 2007 +1100 +++ b/arch/i386/kernel/paravirt.c Mon Feb 12 12:54:19 2007 +1100 @@ -481,9 +481,6 @@ static int __init print_banner(void) return 0; } core_initcall(print_banner); - -/* We simply declare start_kernel to be the paravirt probe of last resort. */ -paravirt_probe(start_kernel); struct paravirt_ops paravirt_ops = { .name = "bare hardware",
Rusty Russell
2007-Apr-18 17:49 UTC
[PATCH 2/7] cleanup: Initialize esp0 properly all the time
Whenever we schedule, __switch_to calls load_esp0 which does: tss->esp0 = thread->esp0; This is never initialized for the initial thread (ie "swapper"), so when we're scheduling that, we end up setting esp0 to 0. This is fine: the swapper never leaves ring 0, so this field is never used. lguest, however, gets upset that we're trying to used an unmapped page as our kernel stack. Rather than work around it there, let's initialize it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> ==================================================================--- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h @@ -421,6 +421,7 @@ struct thread_struct { }; #define INIT_THREAD { \ + .esp0 = sizeof(init_stack) + (long)&init_stack, \ .vm86_info = NULL, \ .sysenter_cs = __KERNEL_CS, \ .io_bitmap_ptr = NULL, \
Apparently Analagous Threads
- [PATCH 1/7] cleanup: paravirt unhandled fallthrough
- [PATCH 0/25 -v2] paravirt_ops for x86_64, second round
- [PATCH 0/25 -v2] paravirt_ops for x86_64, second round
- [PATCH 1/2] remove __init modifier from header declaration
- [PATCH 1/2] remove __init modifier from header declaration