Re: [PATCH 4/8] KVM: avoid unnecessary wait for a async pf

From: Xiao Guangrong
Date: Thu Oct 28 2010 - 03:02:14 EST


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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/