aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2008-05-13 06:23:38 -0400
committerAvi Kivity <avi@qumranet.com>2008-07-20 05:41:43 -0400
commit4ecac3fd6dc2629ad76a658a486f081c44aef10e (patch)
treea078acb4c626432ac8cf887b911d912f4a316d06 /include
parent1b7fcd3263e5f12dba43d27b64e1578bec070c28 (diff)
KVM: Handle virtualization instruction #UD faults during reboot
KVM turns off hardware virtualization extensions during reboot, in order to disassociate the memory used by the virtualization extensions from the processor, and in order to have the system in a consistent state. Unfortunately virtual machines may still be running while this goes on, and once virtualization extensions are turned off, any virtulization instruction will #UD on execution. Fix by adding an exception handler to virtualization instructions; if we get an exception during reboot, we simply spin waiting for the reset to complete. If it's a true exception, BUG() so we can have our stack trace. Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'include')
-rw-r--r--include/asm-x86/kvm_host.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/asm-x86/kvm_host.h b/include/asm-x86/kvm_host.h
index c2d066e185f4..0df9d5fa281a 100644
--- a/include/asm-x86/kvm_host.h
+++ b/include/asm-x86/kvm_host.h
@@ -692,4 +692,28 @@ enum {
692 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \ 692 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
693 vcpu, 0, 0, 0, 0, 0, 0) 693 vcpu, 0, 0, 0, 0, 0, 0)
694 694
695#ifdef CONFIG_64BIT
696#define KVM_EX_ENTRY ".quad"
697#else
698#define KVM_EX_ENTRY ".long"
699#endif
700
701/*
702 * Hardware virtualization extension instructions may fault if a
703 * reboot turns off virtualization while processes are running.
704 * Trap the fault and ignore the instruction if that happens.
705 */
706asmlinkage void kvm_handle_fault_on_reboot(void);
707
708#define __kvm_handle_fault_on_reboot(insn) \
709 "666: " insn "\n\t" \
710 ".pushsection .text.fixup, \"ax\" \n" \
711 "667: \n\t" \
712 "push $666b \n\t" \
713 "jmp kvm_handle_fault_on_reboot \n\t" \
714 ".popsection \n\t" \
715 ".pushsection __ex_table, \"a\" \n\t" \
716 KVM_EX_ENTRY " 666b, 667b \n\t" \
717 ".popsection"
718
695#endif 719#endif