From: Marcelo Tosatti <mtosatti@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm-devel <kvm@vger.kernel.org>
Subject: Re: KVM: x86: fix tsc catchup issue with tsc scaling
Date: Wed, 15 Jan 2014 10:25:21 -0200 [thread overview]
Message-ID: <20140115122521.GA26690@amt.cnet> (raw)
In-Reply-To: <52D67446.3020403@redhat.com>
On Wed, Jan 15, 2014 at 12:43:02PM +0100, Paolo Bonzini wrote:
> Il 06/01/2014 15:18, Marcelo Tosatti ha scritto:
> >
> > To fix a problem related to different resolution of TSC and system clock,
> > the offset in TSC units is approximated by
> >
> > delta = vcpu->hv_clock.tsc_timestamp - vcpu->last_guest_tsc
> >
> > (Guest TSC value at (Guest TSC value at last VM-exit)
> > the last kvm_guest_time_update
> > call)
> >
> > Delta is then later scaled using mult,shift pair found in hv_clock
> > structure (which is correct against tsc_timestamp in that
> > structure).
> >
> > However, if a frequency change is performed between these two points,
> > this delta is measured using different TSC frequencies, but scaled using
> > mult,shift pair for one frequency only.
> >
> > The end result is an incorrect delta.
> >
> > The bug which this code works around is not the only cause for
> > clock backwards events. The global accumulator is still
> > necessary, so remove the max_kernel_ns fix and rely on the
> > global accumulator for no clock backwards events.
>
> This is basically reverting commit 1d5f066 (KVM: x86: Fix a possible
> backwards warp of kvmclock, 2010-08-19).
>
> Your commit message basically says that the guest-side 489fb49 (x86,
> paravirt: Add a global synchronization point for pvclock, 2010-05-11) is
> the real solution to the problem that the host-side commit 1d5f066 was
> trying to fix. Right?
Yes.
> This patch makes vcpu->hv_clock.tsc_timestamp write only. Please
> provide a follow up that drops the field entirely, then I'll apply both.
OK.
next prev parent reply other threads:[~2014-01-15 12:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-06 14:18 KVM: x86: fix tsc catchup issue with tsc scaling Marcelo Tosatti
2014-01-15 11:43 ` Paolo Bonzini
2014-01-15 12:25 ` Marcelo Tosatti [this message]
2014-01-15 12:34 ` Marcelo Tosatti
2014-01-15 12:55 ` Paolo Bonzini
2014-01-15 16:37 ` Marcelo Tosatti
2014-01-15 16:53 ` Paolo Bonzini
2014-01-15 16:55 ` Marcelo Tosatti
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=20140115122521.GA26690@amt.cnet \
--to=mtosatti@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@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