diff options
author | Avi Kivity <avi@qumranet.com> | 2007-01-05 19:36:54 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2007-01-06 02:55:27 -0500 |
commit | e2dec939db126989808853d218e426daaeebc9e2 (patch) | |
tree | 5c742e609e43090df396fc1c7a6b4c526099dbea /drivers/kvm/svm.c | |
parent | 714b93da1a6d97307dfafb9915517879d8a66c0d (diff) |
[PATCH] KVM: MMU: Detect oom conditions and propagate error to userspace
Signed-off-by: Avi Kivity <avi@qumranet.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/kvm/svm.c')
-rw-r--r-- | drivers/kvm/svm.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index 99250011a471..af1e7b3f9171 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c | |||
@@ -852,6 +852,7 @@ static int pf_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
852 | u64 fault_address; | 852 | u64 fault_address; |
853 | u32 error_code; | 853 | u32 error_code; |
854 | enum emulation_result er; | 854 | enum emulation_result er; |
855 | int r; | ||
855 | 856 | ||
856 | if (is_external_interrupt(exit_int_info)) | 857 | if (is_external_interrupt(exit_int_info)) |
857 | push_irq(vcpu, exit_int_info & SVM_EVTINJ_VEC_MASK); | 858 | push_irq(vcpu, exit_int_info & SVM_EVTINJ_VEC_MASK); |
@@ -860,7 +861,12 @@ static int pf_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
860 | 861 | ||
861 | fault_address = vcpu->svm->vmcb->control.exit_info_2; | 862 | fault_address = vcpu->svm->vmcb->control.exit_info_2; |
862 | error_code = vcpu->svm->vmcb->control.exit_info_1; | 863 | error_code = vcpu->svm->vmcb->control.exit_info_1; |
863 | if (!kvm_mmu_page_fault(vcpu, fault_address, error_code)) { | 864 | r = kvm_mmu_page_fault(vcpu, fault_address, error_code); |
865 | if (r < 0) { | ||
866 | spin_unlock(&vcpu->kvm->lock); | ||
867 | return r; | ||
868 | } | ||
869 | if (!r) { | ||
864 | spin_unlock(&vcpu->kvm->lock); | 870 | spin_unlock(&vcpu->kvm->lock); |
865 | return 1; | 871 | return 1; |
866 | } | 872 | } |
@@ -1398,6 +1404,7 @@ static int svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1398 | u16 fs_selector; | 1404 | u16 fs_selector; |
1399 | u16 gs_selector; | 1405 | u16 gs_selector; |
1400 | u16 ldt_selector; | 1406 | u16 ldt_selector; |
1407 | int r; | ||
1401 | 1408 | ||
1402 | again: | 1409 | again: |
1403 | do_interrupt_requests(vcpu, kvm_run); | 1410 | do_interrupt_requests(vcpu, kvm_run); |
@@ -1565,7 +1572,8 @@ again: | |||
1565 | return 0; | 1572 | return 0; |
1566 | } | 1573 | } |
1567 | 1574 | ||
1568 | if (handle_exit(vcpu, kvm_run)) { | 1575 | r = handle_exit(vcpu, kvm_run); |
1576 | if (r > 0) { | ||
1569 | if (signal_pending(current)) { | 1577 | if (signal_pending(current)) { |
1570 | ++kvm_stat.signal_exits; | 1578 | ++kvm_stat.signal_exits; |
1571 | post_kvm_run_save(vcpu, kvm_run); | 1579 | post_kvm_run_save(vcpu, kvm_run); |
@@ -1581,7 +1589,7 @@ again: | |||
1581 | goto again; | 1589 | goto again; |
1582 | } | 1590 | } |
1583 | post_kvm_run_save(vcpu, kvm_run); | 1591 | post_kvm_run_save(vcpu, kvm_run); |
1584 | return 0; | 1592 | return r; |
1585 | } | 1593 | } |
1586 | 1594 | ||
1587 | static void svm_flush_tlb(struct kvm_vcpu *vcpu) | 1595 | static void svm_flush_tlb(struct kvm_vcpu *vcpu) |