Re: [PATCH 15/24] kvm: mmu: Wrap mmu_lock cond_resched and needbreak

From: Paolo Bonzini
Date: Tue Jan 26 2021 - 09:40:55 EST


On 21/01/21 01:19, Sean Christopherson wrote:
What if we simply make the common mmu_lock a union? The rwlock_t is probably a bit bigger, but that's a few bytes for an entire VM. And maybe this would entice/inspire other architectures to move to a similar MMU model.

Looking more at this, there is a problem in that MMU notifier functions take the MMU lock.

Yes, qrwlock the size is a bit larger than qspinlock. However, the fast path of qrwlocks is small, and if the slow paths are tiny compared to the mmu_lock critical sections that are so big as to require cond_resched. So I would consider just changing all architectures to an rwlock.

Paolo