aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2010-10-14 05:22:53 -0400
committerAvi Kivity <avi@redhat.com>2011-01-12 04:23:17 -0500
commit7c90705bf2a373aa238661bdb6446f27299ef489 (patch)
treed3d00b4413b0d33254d53bbb3285be82444494d9 /virt/kvm
parent631bc4878220932fe67fc46fc7cf7cccdb1ec597 (diff)
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 'virt/kvm')
-rw-r--r--virt/kvm/async_pf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/virt/kvm/async_pf.c b/virt/kvm/async_pf.c
index 1f59498561b2..60df9e059e69 100644
--- a/virt/kvm/async_pf.c
+++ b/virt/kvm/async_pf.c
@@ -124,7 +124,8 @@ void kvm_check_async_pf_completion(struct kvm_vcpu *vcpu)
124{ 124{
125 struct kvm_async_pf *work; 125 struct kvm_async_pf *work;
126 126
127 if (list_empty_careful(&vcpu->async_pf.done)) 127 if (list_empty_careful(&vcpu->async_pf.done) ||
128 !kvm_arch_can_inject_async_page_present(vcpu))
128 return; 129 return;
129 130
130 spin_lock(&vcpu->async_pf.lock); 131 spin_lock(&vcpu->async_pf.lock);