lkml.org 
[lkml]   [2016]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC PATCH] x86, kvm: use kvmclock to compute TSC deadline value
From
Date


On 06/07/2016 15:01, Andy Lutomirski wrote:
> On Jul 5, 2016 1:36 PM, "Paolo Bonzini" <pbonzini@redhat.com> wrote:
>>
>> Bad things happen if a guest using the TSC deadline timer is migrated.
>> The guest doesn't re-calibrate the TSC after migration, and the
>> TSC frequency can and will change unless your processor supports TSC
>> scaling (on Intel this is only Skylake) or your data center is perfectly
>> homogeneous.
>>
>> The solution in this patch is to skip tsc_khz, and instead derive the
>> frequency from kvmclock's (mult, shift) pair. Because kvmclock
>> parameters convert from tsc to nanoseconds, this needs a division
>> but that's the least of our problems when the TSC_DEADLINE_MSR write
>> costs 2000 clock cycles. Luckily tsc_khz is really used by very little
>> outside the tsc clocksource (which kvmclock replaces) and the TSC
>> deadline timer.
>
> I'm wondering if it would be more straightforward to blacklist the
> APIC timer entirely (on KVM guests that have the TSC deadline
> capability) and to instead offer a paravirt clockevent that still uses
> the deadline timer under the hood. After all, these systems should be
> mostly quirk-free, so I imagine that the whole implementation would
> only be a few lines of code.

Very good idea!

Paolo

\
 
 \ /
  Last update: 2016-07-06 15:41    [W:0.050 / U:4.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site