Re: [PATCH v4 1/2] KVM: X86: Less kvmclock sync induced vmexits after VM boots

From: Vitaly Kuznetsov
Date: Tue Feb 18 2020 - 11:29:52 EST


Paolo Bonzini <pbonzini@xxxxxxxxxx> writes:

> On 18/02/20 15:54, Vitaly Kuznetsov wrote:
>>> - schedule_delayed_work(&kvm->arch.kvmclock_sync_work,
>>> - KVMCLOCK_SYNC_PERIOD);
>>> + if (vcpu->vcpu_idx == 0)
>>> + schedule_delayed_work(&kvm->arch.kvmclock_sync_work,
>>> + KVMCLOCK_SYNC_PERIOD);
>>> }
>>>
>>> void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
>> Forgive me my ignorance, I was under the impression
>> schedule_delayed_work() doesn't do anything if the work is already
>> queued (see queue_delayed_work_on()) and we seem to be scheduling the
>> same work (&kvm->arch.kvmclock_sync_work) which is per-kvm (not
>> per-vcpu).
>
> No, it executes after 5 minutes. I agree that the patch shouldn't be
> really necessary, though you do save on cacheline bouncing due to
> test_and_set_bit.
>

True, but the changelog should probably be updated then.

--
Vitaly