Re: [PATCH v4 4/7] KVM: mmu: Add slots_arch_lock for memslot arch fields

From: Paolo Bonzini
Date: Tue May 11 2021 - 15:29:28 EST


On 11/05/21 21:21, Sean Christopherson wrote:
+ /* Released in install_new_memslots. */

This needs a much more comprehensive comment, either here or above the declaration
of slots_arch_lock. I can't find anything that explicitly states the the lock
must be held from the time the previous memslots are duplicated/copied until the
new memslots are set. Without that information, the rules/expecations are not
clear.

Indeed, this needs basically a description of the races that can happen, as you explained them in the v1 review.

Unfortunately I'm just whining at this point since I
don't have a better idea

Yeah, the synchronize_srcu call in install_new_memslots throws a wrench in most alternatives.

Paolo