aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/vmx.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-06-04 08:58:30 -0400
committerAvi Kivity <avi@qumranet.com>2007-07-16 05:05:45 -0400
commit17c3ba9d37dbda490792a2b52953f09d0dee30d6 (patch)
tree44749b8658b61c7aa6cdb38d7823fa061d24b12c /drivers/kvm/vmx.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/vmx.c')
-rw-r--r--drivers/kvm/vmx.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index 93e5bb2c40e3..4d255493a57e 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -1988,6 +1988,10 @@ again:
1988 vmx_save_host_state(vcpu); 1988 vmx_save_host_state(vcpu);
1989 kvm_load_guest_fpu(vcpu); 1989 kvm_load_guest_fpu(vcpu);
1990 1990
1991 r = kvm_mmu_reload(vcpu);
1992 if (unlikely(r))
1993 goto out;
1994
1991 /* 1995 /*
1992 * Loading guest fpu may have cleared host cr0.ts 1996 * Loading guest fpu may have cleared host cr0.ts
1993 */ 1997 */