summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/mmu.c
diff options
context:
space:
mode:
authorGleb Natapov2010-10-14 11:22:53 +0200
committerAvi Kivity2011-01-12 10:23:17 +0100
commit7c90705bf2a373aa238661bdb6446f27299ef489 (patch)
treed3d00b4413b0d33254d53bbb3285be82444494d9 /arch/x86/kvm/mmu.c
parentKVM: Handle async PF in a guest. (diff)
downloadkernel-qcow2-linux-7c90705bf2a373aa238661bdb6446f27299ef489.tar.gz
kernel-qcow2-linux-7c90705bf2a373aa238661bdb6446f27299ef489.tar.xz
kernel-qcow2-linux-7c90705bf2a373aa238661bdb6446f27299ef489.zip
KVM: Inject asynchronous page fault into a PV guest if page is swapped out.
Send async page fault to a PV guest if it accesses swapped out memory. Guest will choose another task to run upon receiving the fault. Allow async page fault injection only when guest is in user mode since otherwise guest may be in non-sleepable context and will not be able to reschedule. Vcpu will be halted if guest will fault on the same page again or if vcpu executes kernel code. Acked-by: Rik van Riel <riel@redhat.com> Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r--arch/x86/kvm/mmu.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index b2c60986a7ce..64f90db369fb 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2592,6 +2592,7 @@ static int nonpaging_page_fault(struct kvm_vcpu *vcpu, gva_t gva,
int kvm_arch_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn)
{
struct kvm_arch_async_pf arch;
+ arch.token = (vcpu->arch.apf.id++ << 12) | vcpu->vcpu_id;
arch.gfn = gfn;
return kvm_setup_async_pf(vcpu, gva, gfn, &arch);