Re: [PATCH v5] KVM: x86/mmu: Retry fault before acquiring mmu_lock if mapping is changing

From: Sean Christopherson
Date: Thu Feb 22 2024 - 20:36:00 EST


On Wed, 21 Feb 2024 17:26:40 -0800, Sean Christopherson wrote:
> Retry page faults without acquiring mmu_lock, and without even faulting
> the page into the primary MMU, if the resolved gfn is covered by an active
> invalidation. Contending for mmu_lock is especially problematic on
> preemptible kernels as the mmu_notifier invalidation task will yield
> mmu_lock (see rwlock_needbreak()), delay the in-progress invalidation, and
> ultimately increase the latency of resolving the page fault. And in the
> worst case scenario, yielding will be accompanied by a remote TLB flush,
> e.g. if the invalidation covers a large range of memory and vCPUs are
> accessing addresses that were already zapped.
>
> [...]

Applied (quickly) to kvm-x86 fixes, as I want to get this into -next for at
least a day or two before sending it to Paolo for 6.8. But I'm more than happy
to squash in reviews/acks, especially since many people gave very helpful
feedback on earlier versions.

[1/1] KVM: x86/mmu: Retry fault before acquiring mmu_lock if mapping is changing
https://github.com/kvm-x86/linux/commit/67e4022ffad6

--
https://github.com/kvm-x86/linux/tree/next