mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>,
	Radim Krcmar <rkrcmar@redhat.com>,
	Peter Hornyack <peterhornyack@google.com>,
	David Matlack <dmatlack@google.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	kvm list <kvm@vger.kernel.org>
Subject: Re: [RFC PATCH] x86, kvm: use kvmclock to compute TSC deadline value
Date: Wed, 6 Jul 2016 15:03:01 +0200	[thread overview]
Message-ID: <023f49ec-df7a-f196-86da-976a8a22d77e@redhat.com> (raw)
In-Reply-To: <CALCETrUAm+-WP8_gVGTtvMdpBw4uhkgVA9rXy6WE2AL3TRgquw@mail.gmail.com>



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

  reply	other threads:[~2016-07-06 13:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-05 17:36 Paolo Bonzini
2016-07-06 13:01 ` Andy Lutomirski
2016-07-06 13:03   ` Paolo Bonzini [this message]
2016-07-06 17:17 ` David Matlack
2016-07-08 21:44   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=023f49ec-df7a-f196-86da-976a8a22d77e@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=dmatlack@google.com \
    --cc=ehabkost@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=peterhornyack@google.com \
    --cc=rkrcmar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome