@@ -2358,7 +2358,7 @@ static bool kvm_asyc_pf_is_done(struct kvm_vcpu *vcpu)
spin_lock(&vcpu->arch.mmu_async_pf_lock);
list_for_each_entry_safe(p, node, &vcpu->arch.mmu_async_pf_done, link) {
- if (p->guest_task != vcpu->arch.pv_shm->current_task)
+ if (p->token != vcpu->arch.pv_shm->param)
continue;
list_del(&p->link);
found = true;
@@ -2370,7 +2370,7 @@ static bool kvm_asyc_pf_is_done(struct kvm_vcpu *vcpu)
p->error_code);
put_page(p->page);
async_pf_work_free(p);
- trace_kvm_mmu_async_pf_wait(vcpu->arch.pv_shm->current_task, 0);
+ trace_kvm_mmu_async_pf_wait(vcpu->arch.pv_shm->param, 0);
}
return found;
}
@@ -2378,7 +2378,7 @@ static bool kvm_asyc_pf_is_done(struct kvm_vcpu *vcpu)
int kvm_pv_wait_for_async_pf(struct kvm_vcpu *vcpu)
{
++vcpu->stat.pf_async_wait;
- trace_kvm_mmu_async_pf_wait(vcpu->arch.pv_shm->current_task, 1);
+ trace_kvm_mmu_async_pf_wait(vcpu->arch.pv_shm->param, 1);
wait_event(vcpu->wq, kvm_asyc_pf_is_done(vcpu));
return 0;
@@ -2386,17 +2386,13 @@ int kvm_pv_wait_for_async_pf(struct kvm_vcpu *vcpu)
static bool can_do_async_pf(struct kvm_vcpu *vcpu)
{
- struct kvm_segment kvm_seg;
-
if (!vcpu->arch.pv_shm ||
!(vcpu->arch.pv_shm->features & KVM_PV_SHM_FEATURES_ASYNC_PF) ||
- kvm_event_needs_reinjection(vcpu))
+ kvm_event_needs_reinjection(vcpu) ||
+ !kvm_x86_ops->interrupt_allowed(vcpu))
return false;
- kvm_get_segment(vcpu, &kvm_seg, VCPU_SREG_CS);
-
- /* is userspace code? TODO check VM86 mode */
- return !!(kvm_seg.selector & 3);
+ return true;
}
static int setup_async_pf(struct kvm_vcpu *vcpu, gpa_t cr3, gva_t gva,