Re: [PATCH v2 22/28] KVM: x86/mmu: Mark SPTEs in disconnected pages as removed

From: Paolo Bonzini
Date: Wed Feb 03 2021 - 06:19:26 EST


On 02/02/21 19:57, Ben Gardon wrote:

+ * Marking the SPTE as a removed SPTE is not
+ * strictly necessary here as the MMU lock should

"should" is a bit too weak---the point of !shared is that the MMU lock *will* stop other threads from concurrent modifications of the SPTEs.

Paolo

+ * stop other threads from concurrentrly modifying
+ * this SPTE. Using the removed SPTE value keeps
+ * the shared and non-atomic cases consistent and
+ * simplifies the function.
+ */
+ WRITE_ONCE(*sptep, REMOVED_SPTE);