Re: [PATCH v2 1/1] KVM: x86: fix MSR_IA32_TSC read for nested migration

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

 



On 21/09/20 18:23, Sean Christopherson wrote:
> Avoid "should" in code comments and describe what the code is doing, not what
> it should be doing.  The only exception for this is when the code has a known
> flaw/gap, e.g. "KVM should do X, but because of Y, KVM actually does Z".
> 
>> +		 * return it's real L1 value so that its restore will be correct.
> s/it's/its
> 
> Perhaps add "unconditionally" somewhere, since arch.tsc_offset can also contain
> the L1 value.  E.g. 
> 
> 		 * Unconditionally return L1's TSC offset on userspace reads
> 		 * so that userspace reads and writes always operate on L1's
> 		 * offset, e.g. to ensure deterministic behavior for migration.
> 		 */
> 

Technically the host need not restore MSR_IA32_TSC at all.  This follows
the idea of the discussion with Oliver Upton about transmitting the
state of the kvmclock heuristics to userspace, which include a (TSC,
CLOCK_MONOTONIC) pair to transmit the offset to the destination.  All
that needs to be an L1 value is then the TSC value in that pair.

I'm a bit torn over this patch.  On one hand it's an easy solution, on
the other hand it's... just wrong if KVM_GET_MSR is used for e.g.
debugging the guest.

I'll talk to Maxim and see if he can work on the kvmclock migration stuff.

Paolo




[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