From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roman Kagan Subject: [PATCH v2 3/5] kvm: kick vcpu when async_pf is resolved Date: Mon, 12 Dec 2016 17:32:23 +0300 Message-ID: <20161212143225.10580-4-rkagan@virtuozzo.com> References: <20161212143225.10580-1-rkagan@virtuozzo.com> Mime-Version: 1.0 Content-Type: text/plain Cc: Denis Lunev , Roman Kagan , Christian Borntraeger To: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , "Paolo Bonzini" , Return-path: Received: from mail-db5eur01on0097.outbound.protection.outlook.com ([104.47.2.97]:27175 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752165AbcLLUGP (ORCPT ); Mon, 12 Dec 2016 15:06:15 -0500 In-Reply-To: <20161212143225.10580-1-rkagan@virtuozzo.com> Sender: kvm-owner@vger.kernel.org List-ID: When async_pf is ready the guest needs to be made aware of it ASAP, because it may be holding off a higher priority task pending the async_pf resolution in favor of a lower priority one. In case async_pf's are harvested in vcpu context (x86) we have to not only wake the vcpu up but kick it into host. Signed-off-by: Roman Kagan Cc: Christian Borntraeger --- v1 -> v2: - do not break s390 build by using kvm_vcpu_wakeup (Christian) virt/kvm/async_pf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/virt/kvm/async_pf.c b/virt/kvm/async_pf.c index 9cced14..b5b9cca 100644 --- a/virt/kvm/async_pf.c +++ b/virt/kvm/async_pf.c @@ -105,8 +105,12 @@ static void async_pf_execute(struct work_struct *work) * This memory barrier pairs with prepare_to_wait's set_current_state() */ smp_mb(); +#ifdef CONFIG_KVM_ASYNC_PF_SYNC if (swait_active(&vcpu->wq)) swake_up(&vcpu->wq); +#else + kvm_vcpu_kick(vcpu); +#endif mmput(mm); kvm_put_kvm(vcpu->kvm); -- 2.9.3