Re: [PATCH 1/2] KVM: x86/mmu: Protect marking SPs unsync when using TDP MMU with spinlock

From: Paolo Bonzini
Date: Wed Aug 11 2021 - 07:47:52 EST


On 11/08/21 00:45, Sean Christopherson wrote:
Use an entirely new spinlock even though piggybacking tdp_mmu_pages_lock
would functionally be ok. Usurping the lock could degrade performance when
building upper level page tables on different vCPUs, especially since the
unsync flow could hold the lock for a comparatively long time depending on
the number of indirect shadow pages and the depth of the paging tree.

If we are to introduce a new spinlock, do we need to make it conditional and pass it around like this? It would be simpler to just take it everywhere (just like, in patch 2, passing "shared == true" to tdp_mmu_link_page is always safe anyway).

Paolo