Re: [PATCH 2/4] KVM: x86/tdp_mmu: Merge the prefetch into the is_access_allowed() check

From: Sean Christopherson
Date: Fri Feb 07 2025 - 10:04:07 EST


On Fri, Feb 07, 2025, Yan Zhao wrote:
> Merge the prefetch check into the is_access_allowed() check to determine a
> spurious fault.
>
> In the TDP MMU, a spurious prefetch fault should also pass the
> is_access_allowed() check.

How so?

1. vCPU takes a write-fault on a swapped out page and queues an async #PF
2. A different task installs a writable SPTE
3. A third task write-protects the SPTE for dirty logging
4. Async #PF handler faults in the SPTE, encounters a read-only SPTE for its
write fault.

KVM shouldn't mark the gfn as dirty in this case.