On 08/06/2017 14:32, Wanpeng Li wrote:
>>> I change the
>>> condition to "nr == PF_VECTOR && error_code == 0" to intercept async_pf, 
>>> however,
>>> the below bug will be splatted:
>> Right, because error_code == 0 is a valid error code.
>>
>> For stable releases, this should be enough:
> 
> We should also take care PAGE_READY async_pfs injection. I will send a
> patch to avoid async pf injection stuff in guest mode for stable
> release.

Right, the simplest thing to do here is another is_guest_mode check in
kvm_arch_can_inject_async_page_present.  That would delay the signaling
of ready pages while L2 runs, but hopefully we're under memory pressure
so L2 will get a page fault too.                

In fact, kvm_arch_can_inject_async_page_present should just be

        if (!(vcpu->arch.apf.msr_val & KVM_ASYNC_PF_ENABLED))
                return true;
        else
                return can_do_async_pf(vcpu);

where can_do_async_pf becomes nonstatic.
Paolo

Reply via email to