summaryrefslogtreecommitdiffstats
path: root/drivers/kvm/svm.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-06-04 15:58:30 +0300
committerAvi Kivity <avi@qumranet.com>2007-07-16 12:05:45 +0300
commit17c3ba9d37dbda490792a2b52953f09d0dee30d6 (patch)
tree44749b8658b61c7aa6cdb38d7823fa061d24b12c /drivers/kvm/svm.c
parentbd2b2baa5c5fbb08b4b0df7508ff419407f7ece6 (diff)
KVM: Lazy guest cr3 switching
Switch guest paging context may require us to allocate memory, which might fail. Instead of wiring up error paths everywhere, make context switching lazy and actually do the switch before the next guest entry, where we can return an error if allocation fails. Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/svm.c')
-rw-r--r--drivers/kvm/svm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c
index 6cd6a50a034..ec040e2f8c5 100644
--- a/drivers/kvm/svm.c
+++ b/drivers/kvm/svm.c
@@ -1483,6 +1483,10 @@ static int svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
int r;
again:
+ r = kvm_mmu_reload(vcpu);
+ if (unlikely(r))
+ return r;
+
if (!vcpu->mmio_read_completed)
do_interrupt_requests(vcpu, kvm_run);