Re: [PATCH v2] KVM: x86/mmu: Consume the locked rmap value in the lockless rmap walk
From: Sean Christopherson
Date: Fri Jul 31 2026 - 16:20:43 EST
On Mon, 20 Jul 2026 13:45:49 -0400, Phil Rosenthal wrote:
> __kvm_rmap_lock() deliberately elides the rmap lock when it observes an
> empty rmap. In that case kvm_rmap_lock_readonly() also re-enables
> preemption and returns zero, so the caller holds neither the rmap lock
> nor a preemption reference. The elision documents the invariant it
> relies on:
>
> * Elide the lock if the rmap is empty, as lockless walkers (read-only
> * mode) don't need to (and can't) walk an empty rmap, nor can they add
> * entries to the rmap. I.e. the only paths that process empty rmaps
> * do so while holding mmu_lock for write, and are mutually exclusive.
>
> [...]
Applied to kvm-x86 mmu, thanks!
[1/1] KVM: x86/mmu: Consume the locked rmap value in the lockless rmap walk
https://github.com/kvm-x86/linux/commit/e428f9779a43
--
https://github.com/kvm-x86/linux/tree/next