Thread (44 messages) 44 messages, 4 authors, 2021-03-31

Re: [PATCH 16/18] KVM: Don't take mmu_lock for range invalidation unless necessary

From: Paolo Bonzini <pbonzini@redhat.com>
Date: 2021-03-31 21:37:16
Also in: kvm, kvmarm, linux-arm-kernel, lkml

On 31/03/21 23:22, Sean Christopherson wrote:
On a related topic, any preference on whether to have an explicit "must_lock"
flag (what I posted), or derive the logic based on other params?

The helper I posted does:

	if (range->must_lock &&
	    kvm_mmu_lock_and_check_handler(kvm, range, &locked))
		goto out_unlock;

but it could be:

	if (!IS_KVM_NULL_FN(range->on_lock) && !range->may_block &&
	    kvm_mmu_lock_and_check_handler(kvm, range, &locked))
		goto out_unlock;

The generated code should be nearly identical on a modern compiler, so it's
purely a question of aesthetics.  I slightly prefer the explicit "must_lock" to
avoid spreading out the logic too much, but it also feels a bit superfluous.
I do as well, but I hope we don't need any lock after all as in the 
email I've just sent.

Paolo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help