diff options
author | Xiantao Zhang <xiantao.zhang@intel.com> | 2008-11-21 04:16:07 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2008-12-31 09:54:59 -0500 |
commit | 9f7d5bb5e2abf5316bb17eb3e7751dbafa09e5cf (patch) | |
tree | 1d26023244a8882cda214019b59a6a237f707e55 /arch/ia64/kvm | |
parent | 5e2be19832ccf93bf731a1758ec9fabf48414584 (diff) |
KVM: ia64: Add handler for crashed vmm
Since vmm runs in an isolated address space and it is just a copy
of host's kvm-intel module, so once vmm crashes, we just crash all guests
running on it instead of crashing whole kernel.
Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/ia64/kvm')
-rw-r--r-- | arch/ia64/kvm/process.c | 20 | ||||
-rw-r--r-- | arch/ia64/kvm/vcpu.h | 3 | ||||
-rw-r--r-- | arch/ia64/kvm/vmm.c | 2 | ||||
-rw-r--r-- | arch/ia64/kvm/vmm_ivt.S | 31 |
4 files changed, 44 insertions, 12 deletions
diff --git a/arch/ia64/kvm/process.c b/arch/ia64/kvm/process.c index cefc349ce354..552d07724207 100644 --- a/arch/ia64/kvm/process.c +++ b/arch/ia64/kvm/process.c | |||
@@ -942,8 +942,20 @@ static void vcpu_do_resume(struct kvm_vcpu *vcpu) | |||
942 | ia64_set_pta(vcpu->arch.vhpt.pta.val); | 942 | ia64_set_pta(vcpu->arch.vhpt.pta.val); |
943 | } | 943 | } |
944 | 944 | ||
945 | static void vmm_sanity_check(struct kvm_vcpu *vcpu) | ||
946 | { | ||
947 | struct exit_ctl_data *p = &vcpu->arch.exit_data; | ||
948 | |||
949 | if (!vmm_sanity && p->exit_reason != EXIT_REASON_DEBUG) { | ||
950 | panic_vm(vcpu, "Failed to do vmm sanity check," | ||
951 | "it maybe caused by crashed vmm!!\n\n"); | ||
952 | } | ||
953 | } | ||
954 | |||
945 | static void kvm_do_resume_op(struct kvm_vcpu *vcpu) | 955 | static void kvm_do_resume_op(struct kvm_vcpu *vcpu) |
946 | { | 956 | { |
957 | vmm_sanity_check(vcpu); /*Guarantee vcpu runing on healthy vmm!*/ | ||
958 | |||
947 | if (test_and_clear_bit(KVM_REQ_RESUME, &vcpu->requests)) { | 959 | if (test_and_clear_bit(KVM_REQ_RESUME, &vcpu->requests)) { |
948 | vcpu_do_resume(vcpu); | 960 | vcpu_do_resume(vcpu); |
949 | return; | 961 | return; |
@@ -969,3 +981,11 @@ void vmm_transition(struct kvm_vcpu *vcpu) | |||
969 | 1, 0, 0, 0, 0, 0); | 981 | 1, 0, 0, 0, 0, 0); |
970 | kvm_do_resume_op(vcpu); | 982 | kvm_do_resume_op(vcpu); |
971 | } | 983 | } |
984 | |||
985 | void vmm_panic_handler(u64 vec) | ||
986 | { | ||
987 | struct kvm_vcpu *vcpu = current_vcpu; | ||
988 | vmm_sanity = 0; | ||
989 | panic_vm(vcpu, "Unexpected interruption occurs in VMM, vector:0x%lx\n", | ||
990 | vec2off[vec]); | ||
991 | } | ||
diff --git a/arch/ia64/kvm/vcpu.h b/arch/ia64/kvm/vcpu.h index 0dad8421791c..b2f12a562bdf 100644 --- a/arch/ia64/kvm/vcpu.h +++ b/arch/ia64/kvm/vcpu.h | |||
@@ -741,5 +741,8 @@ void panic_vm(struct kvm_vcpu *v, const char *fmt, ...); | |||
741 | 741 | ||
742 | extern u64 ia64_call_vsa(u64 proc, u64 arg1, u64 arg2, u64 arg3, | 742 | extern u64 ia64_call_vsa(u64 proc, u64 arg1, u64 arg2, u64 arg3, |
743 | u64 arg4, u64 arg5, u64 arg6, u64 arg7); | 743 | u64 arg4, u64 arg5, u64 arg6, u64 arg7); |
744 | |||
745 | extern long vmm_sanity; | ||
746 | |||
744 | #endif | 747 | #endif |
745 | #endif /* __VCPU_H__ */ | 748 | #endif /* __VCPU_H__ */ |
diff --git a/arch/ia64/kvm/vmm.c b/arch/ia64/kvm/vmm.c index d3dc0b040ce4..9eee5c04bacc 100644 --- a/arch/ia64/kvm/vmm.c +++ b/arch/ia64/kvm/vmm.c | |||
@@ -32,6 +32,8 @@ MODULE_LICENSE("GPL"); | |||
32 | extern char kvm_ia64_ivt; | 32 | extern char kvm_ia64_ivt; |
33 | extern fpswa_interface_t *vmm_fpswa_interface; | 33 | extern fpswa_interface_t *vmm_fpswa_interface; |
34 | 34 | ||
35 | long vmm_sanity = 1; | ||
36 | |||
35 | struct kvm_vmm_info vmm_info = { | 37 | struct kvm_vmm_info vmm_info = { |
36 | .module = THIS_MODULE, | 38 | .module = THIS_MODULE, |
37 | .vmm_entry = vmm_entry, | 39 | .vmm_entry = vmm_entry, |
diff --git a/arch/ia64/kvm/vmm_ivt.S b/arch/ia64/kvm/vmm_ivt.S index c1d7251a1480..50b464628536 100644 --- a/arch/ia64/kvm/vmm_ivt.S +++ b/arch/ia64/kvm/vmm_ivt.S | |||
@@ -70,14 +70,12 @@ | |||
70 | # define PSR_DEFAULT_BITS 0 | 70 | # define PSR_DEFAULT_BITS 0 |
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | |||
74 | #define KVM_FAULT(n) \ | 73 | #define KVM_FAULT(n) \ |
75 | kvm_fault_##n:; \ | 74 | kvm_fault_##n:; \ |
76 | mov r19=n;; \ | 75 | mov r19=n;; \ |
77 | br.sptk.many kvm_fault_##n; \ | 76 | br.sptk.many kvm_vmm_panic; \ |
78 | ;; \ | 77 | ;; \ |
79 | 78 | ||
80 | |||
81 | #define KVM_REFLECT(n) \ | 79 | #define KVM_REFLECT(n) \ |
82 | mov r31=pr; \ | 80 | mov r31=pr; \ |
83 | mov r19=n; /* prepare to save predicates */ \ | 81 | mov r19=n; /* prepare to save predicates */ \ |
@@ -85,17 +83,26 @@ | |||
85 | ;; \ | 83 | ;; \ |
86 | tbit.z p6,p7=r29,IA64_PSR_VM_BIT; \ | 84 | tbit.z p6,p7=r29,IA64_PSR_VM_BIT; \ |
87 | (p7)br.sptk.many kvm_dispatch_reflection; \ | 85 | (p7)br.sptk.many kvm_dispatch_reflection; \ |
88 | br.sptk.many kvm_panic; \ | 86 | br.sptk.many kvm_vmm_panic; \ |
89 | |||
90 | 87 | ||
91 | GLOBAL_ENTRY(kvm_panic) | 88 | GLOBAL_ENTRY(kvm_vmm_panic) |
92 | br.sptk.many kvm_panic | 89 | KVM_SAVE_MIN_WITH_COVER_R19 |
90 | alloc r14=ar.pfs,0,0,1,0 | ||
91 | mov out0=r15 | ||
92 | adds r3=8,r2 // set up second base pointer | ||
93 | ;; | 93 | ;; |
94 | END(kvm_panic) | 94 | ssm psr.ic |
95 | 95 | ;; | |
96 | 96 | srlz.i // guarantee that interruption collection is on | |
97 | 97 | ;; | |
98 | 98 | //(p15) ssm psr.i // restore psr.i | |
99 | addl r14=@gprel(ia64_leave_hypervisor),gp | ||
100 | ;; | ||
101 | KVM_SAVE_REST | ||
102 | mov rp=r14 | ||
103 | ;; | ||
104 | br.call.sptk.many b6=vmm_panic_handler; | ||
105 | END(kvm_vmm_panic) | ||
99 | 106 | ||
100 | .section .text.ivt,"ax" | 107 | .section .text.ivt,"ax" |
101 | 108 | ||