Re: [PATCH 2/4] KVM: x86: hyper-v: Prevent using not-yet-updated TSC page by secondary CPUs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Paolo Bonzini <pbonzini@xxxxxxxxxx> writes:

> On 15/03/21 16:55, Vitaly Kuznetsov wrote:
>>> I think we should instead write 0 to the page in kvm_gen_update_masterclock.
>>
>> We can do that but we will also need to invalidate
>> hv->tsc_ref.tsc_sequence to prevent MSR based clocksource
>> (HV_X64_MSR_TIME_REF_COUNT -> get_time_ref_counter()) from using stale
>> hv->tsc_ref.tsc_scale/tsc_offset values (in case we had them
>> calculated).
>
> Yes, we're talking about the same thing (invalidating tsc_sequence is 
> done by writing 0 to it).
>

Yes, 'hv->tsc_ref' is a 'shadow TSC page' which almost always caches
what's in the 'real' one. One notable exception is that after migration
our cache is out of sync until the first successful
kvm_hv_setup_tsc_page() call.

What I was trying to say is that we not only need to write '0' to the
'real' TSC page but also invalidate our internal 'hv->tsc_ref'. Anyway,
I think we're in a violent agreement here, v2 is coming with this change
after I'm done testing it.

Thanks!

> Paolo
>
>> Also, we can't really disable TSC page for nested scenario when guest
>> opted for reenlightenment (PATCH4) but we're not going to update the
>> page anyway so there's not much different.
>> 
>

-- 
Vitaly




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux