[PATCH] i386: paravirt unhandled fallthrough
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 13 Feb 2007 12:26:26 +0000 (13:26 +0100)
committerAndi Kleen <andi@basil.nowhere.org>
Tue, 13 Feb 2007 12:26:26 +0000 (13:26 +0100)
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>
Signed-off-by: Andi Kleen <ak@suse.de>
arch/i386/kernel/Makefile
arch/i386/kernel/head.S
arch/i386/kernel/paravirt.c

index 97f1e961d684b2b8329d46aa04115d9f920a268d..223969377de43e690e4f1bc35375f3881c801f1a 100644 (file)
@@ -41,8 +41,6 @@ obj-$(CONFIG_HPET_TIMER)      += hpet.o
 obj-$(CONFIG_K8_NB)            += k8.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
index 734be5572eb9c4db86641788acbf22763698da7b..b322f72ffaadd894db6469c9e063fb1345e8e2c5 100644 (file)
@@ -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 @@ startup_paravirt:
 
        addl    $4, (%esp)
        jmp     1b
+
+unhandled_paravirt:
+       /* Nothing wanted us: we're screwed. */
+       ud2
 #endif
 
 /*
index ebe82552ad302b41e1b0f46991e5b2c07c8a3f79..c156ecfa38727c2133ec4f3994ba8f4f9e82fc9f 100644 (file)
@@ -482,9 +482,6 @@ static int __init print_banner(void)
 }
 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",
        .paravirt_enabled = 0,