From 658dc56c1098e1d516beb9899bb5d04a1ba7ba73 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost <ehabkost@redhat.com> Date: Wed, 15 Dec 2010 10:44:48 -0200 Subject: [PATCH 2/2] Revert "KVM: Don't spin on virt instruction faults during reboot" RH-Reverts: 5222476aa2e8eeafdd6d9bc11b213c093b82e84a RH-Reverts-patchwork-id: 14220 Bugzilla-related: 608709 Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- arch/x86/include/asm/kvm_host.h | 8 ++------ virt/kvm/kvm_main.c | 13 +++++++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index e60478d..b9dff51 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -737,18 +737,14 @@ enum { * reboot turns off virtualization while processes are running. * Trap the fault and ignore the instruction if that happens. */ -asmlinkage void kvm_spurious_fault(void); -extern bool kvm_rebooting; +asmlinkage void kvm_handle_fault_on_reboot(void); #define __kvm_handle_fault_on_reboot(insn) \ "666: " insn "\n\t" \ - "668: \n\t" \ ".pushsection .fixup, \"ax\" \n" \ "667: \n\t" \ - "cmpb $0, kvm_rebooting \n\t" \ - "jne 668b \n\t" \ __ASM_SIZE(push) " $666b \n\t" \ - "call kvm_spurious_fault \n\t" \ + "jmp kvm_handle_fault_on_reboot \n\t" \ ".popsection \n\t" \ ".pushsection __ex_table, \"a\" \n\t" \ _ASM_PTR " 666b, 667b \n\t" \ diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 6766b91..02b858a 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -77,8 +77,7 @@ struct dentry *kvm_debugfs_dir; static long kvm_vcpu_ioctl(struct file *file, unsigned int ioctl, unsigned long arg); -bool kvm_rebooting; -EXPORT_SYMBOL_GPL(kvm_rebooting); +static bool kvm_rebooting; #ifdef KVM_CAP_DEVICE_ASSIGNMENT static struct kvm_assigned_dev_kernel *kvm_find_assigned_dev(struct list_head *head, @@ -2404,12 +2403,18 @@ static int kvm_cpu_hotplug(struct notifier_block *notifier, unsigned long val, } -asmlinkage void kvm_spurious_fault(void) +asmlinkage void kvm_handle_fault_on_reboot(void) { + if (kvm_rebooting) { + /* spin while reset goes on */ + local_irq_enable(); + while (true) + ; + } /* Fault while not rebooting. We want the trace. */ BUG(); } -EXPORT_SYMBOL_GPL(kvm_spurious_fault); +EXPORT_SYMBOL_GPL(kvm_handle_fault_on_reboot); static int kvm_reboot(struct notifier_block *notifier, unsigned long val, void *v) -- 1.7.3.2