On 02/09/21 21:21, Sean Christopherson wrote:

+       if (!matched) {
+               ...
+               spin_lock(&kvm->arch.pvclock_gtod_sync_lock);
+               kvm->arch.nr_vcpus_matched_tsc = 0;
+       } else if (!already_matched) {
+               spin_lock(&kvm->arch.pvclock_gtod_sync_lock);
+               kvm->arch.nr_vcpus_matched_tsc++;
+       }
+
+       kvm_track_tsc_matching(vcpu);
+       spin_unlock(&kvm->arch.pvclock_gtod_sync_lock);

This unlock is imbalanced if matched and already_matched are both true.  It's 
not
immediately obvious that that_can't_  happen, and if it truly can't happen then
conditionally locking is pointless (because it's not actually conditional).

This is IMO another reason to unify tsc_write_lock and pvclock_gtod_sync_lock. The chances of contention are pretty slim. As soon as I sort out the next -rc3 pull request I'll send out my version of Oliver's patches.

Thanks,

Paolo

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

Reply via email to