From: Christian Borntraeger Subject: Re: [PATCH 3/5] kvm: kick vcpu when async_pf is resolved Date: Fri, 2 Dec 2016 10:35:02 +0100 Message-ID: References: <20161202084754.22860-1-rkagan@virtuozzo.com> <20161202084754.22860-4-rkagan@virtuozzo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Cc: Denis Lunev To: Roman Kagan , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Paolo Bonzini , kvm@vger.kernel.org Return-path: Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:48190 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757484AbcLBJfJ (ORCPT ); Fri, 2 Dec 2016 04:35:09 -0500 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uB29Yl5R002585 for ; Fri, 2 Dec 2016 04:35:08 -0500 Received: from e19.ny.us.ibm.com (e19.ny.us.ibm.com [129.33.205.209]) by mx0b-001b2d01.pphosted.com with ESMTP id 272xu89w56-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 02 Dec 2016 04:35:08 -0500 Received: from localhost by e19.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 2 Dec 2016 04:35:08 -0500 In-Reply-To: <20161202084754.22860-4-rkagan@virtuozzo.com> Sender: kvm-owner@vger.kernel.org List-ID: On 12/02/2016 09:47 AM, Roman Kagan wrote: > 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. > > While at this, also replace the open-coded vcpu wakeup by the existing > helper. > > Signed-off-by: Roman Kagan > --- > virt/kvm/async_pf.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/virt/kvm/async_pf.c b/virt/kvm/async_pf.c > index 9cced14..5f0a66c 100644 > --- a/virt/kvm/async_pf.c > +++ b/virt/kvm/async_pf.c > @@ -105,8 +105,11 @@ static void async_pf_execute(struct work_struct *work) > * This memory barrier pairs with prepare_to_wait's set_current_state() > */ > smp_mb(); > - if (swait_active(&vcpu->wq)) > - swake_up(&vcpu->wq); > +#ifdef CONFIG_KVM_ASYNC_PF_SYNC > + kvm_vcpu_wake_up(vcpu); > +#else > + kvm_vcpu_kick(vcpu); > +#endif This will break s390, both functions are disabled for s390. On s390 do not want to kick the CPU for a completion. Instead we implement the kvm_async_page_present_sync call above and handle completion via an "pfault done" interrupt via the normal interrupt delivery. > > mmput(mm); > kvm_put_kvm(vcpu->kvm); >