From 89746f71b5c2738de822f19a8a0906cd1a3db910 Mon Sep 17 00:00:00 2001 From: Joerg Roedel Date: Tue, 26 Feb 2008 16:49:16 +0100 Subject: [PATCH] --- yaml --- r: 93816 b: refs/heads/master c: 71c4dfafc0932d92cc99c7e839d25174b0ce10a1 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/x86/kvm/x86.c | 20 +++++++++++++++----- trunk/include/linux/kvm_host.h | 1 + 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 312640a39025..67bfb2b02e76 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 3e4bb3ac9e0ada5df5f6729648d403ea9f071d10 +refs/heads/master: 71c4dfafc0932d92cc99c7e839d25174b0ce10a1 diff --git a/trunk/arch/x86/kvm/x86.c b/trunk/arch/x86/kvm/x86.c index dbcff38dfcc3..491eda308289 100644 --- a/trunk/arch/x86/kvm/x86.c +++ b/trunk/arch/x86/kvm/x86.c @@ -155,11 +155,16 @@ void kvm_inject_page_fault(struct kvm_vcpu *vcpu, unsigned long addr, u32 error_code) { ++vcpu->stat.pf_guest; - if (vcpu->arch.exception.pending && vcpu->arch.exception.nr == PF_VECTOR) { - printk(KERN_DEBUG "kvm: inject_page_fault:" - " double fault 0x%lx\n", addr); - vcpu->arch.exception.nr = DF_VECTOR; - vcpu->arch.exception.error_code = 0; + if (vcpu->arch.exception.pending) { + if (vcpu->arch.exception.nr == PF_VECTOR) { + printk(KERN_DEBUG "kvm: inject_page_fault:" + " double fault 0x%lx\n", addr); + vcpu->arch.exception.nr = DF_VECTOR; + vcpu->arch.exception.error_code = 0; + } else if (vcpu->arch.exception.nr == DF_VECTOR) { + /* triple fault -> shutdown */ + set_bit(KVM_REQ_TRIPLE_FAULT, &vcpu->requests); + } return; } vcpu->arch.cr2 = addr; @@ -2676,6 +2681,11 @@ static int __vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) r = 0; goto out; } + if (test_and_clear_bit(KVM_REQ_TRIPLE_FAULT, &vcpu->requests)) { + kvm_run->exit_reason = KVM_EXIT_SHUTDOWN; + r = 0; + goto out; + } } kvm_inject_pending_timer_irqs(vcpu); diff --git a/trunk/include/linux/kvm_host.h b/trunk/include/linux/kvm_host.h index 9750bb3c5a75..958e00371516 100644 --- a/trunk/include/linux/kvm_host.h +++ b/trunk/include/linux/kvm_host.h @@ -38,6 +38,7 @@ #define KVM_REQ_MIGRATE_TIMER 1 #define KVM_REQ_REPORT_TPR_ACCESS 2 #define KVM_REQ_MMU_RELOAD 3 +#define KVM_REQ_TRIPLE_FAULT 4 struct kvm_vcpu; extern struct kmem_cache *kvm_vcpu_cache;