From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: [PATCH 4/8] KVM: avoid unnecessary wait for a async pf Date: Thu, 28 Oct 2010 15:06:26 +0800 Message-ID: <4CC920F2.4080008@cn.fujitsu.com> References: <4CC7EA7D.5020901@cn.fujitsu.com> <4CC7EB3A.6070002@cn.fujitsu.com> <20101027104210.GN26191@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Avi Kivity , Marcelo Tosatti , LKML , KVM To: Gleb Natapov Return-path: Received: from cn.fujitsu.com ([222.73.24.84]:58759 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1755495Ab0J1HCD (ORCPT ); Thu, 28 Oct 2010 03:02:03 -0400 In-Reply-To: <20101027104210.GN26191@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 10/27/2010 06:42 PM, Gleb Natapov wrote: > On Wed, Oct 27, 2010 at 05:04:58PM +0800, Xiao Guangrong wrote: >> In current code, it checks async pf completion out of the wait context, >> like this: >> >> if (vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE && >> !vcpu->arch.apf.halted) >> r = vcpu_enter_guest(vcpu); >> else { >> ...... >> kvm_vcpu_block(vcpu) >> ^- waiting until 'async_pf.done' is not empty >> } >> >> kvm_check_async_pf_completion(vcpu) >> ^- delete list from async_pf.done >> >> So, if we check aysnc pf completion first, it can be blocked at >> kvm_vcpu_block >> > Correct, but it can be fixed by adding vcpu->arch.apf.halted = false; to > kvm_arch_async_page_present(), no? > Adding kvm_check_async_pf_completion() to arch independent kvm_vcpu_block() > constrains how other archs may implement async pf support IMO. > Um, i think it's reasonable, will fix it address your comment.