linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	lcapitulino@redhat.com
Subject: Re: [PATCH] KVM: x86: drop TSC offsetting kvm_x86_ops to fix KVM_GET/SET_CLOCK
Date: Wed, 2 Nov 2016 19:22:07 +0100	[thread overview]
Message-ID: <20161102182206.GA7771@potion> (raw)
In-Reply-To: <1478075883-22970-1-git-send-email-pbonzini@redhat.com>

2016-11-02 09:38+0100, Paolo Bonzini:
> Since commit a545ab6a0085 ("kvm: x86: add tsc_offset field to struct
> kvm_vcpu_arch", 2016-09-07) the offset between host and L1 TSC is
> cached and need not be fished out of the VMCS or VMCB.  This means
> that we can implement adjust_tsc_offset_guest and read_l1_tsc
> entirely in generic code.  The simplification is particularly
> significant for VMX code, where vmx->nested.vmcs01_tsc_offset
> was duplicating what is now in vcpu->arch.tsc_offset.  Therefore
> the vmcs01_tsc_offset can be dropped completely.
> 
> More importantly, this fixes KVM_GET_CLOCK/KVM_SET_CLOCK
> which, after commit 108b249c453d ("KVM: x86: introduce get_kvmclock_ns",
> 2016-09-01) called read_l1_tsc while the VMCS was not loaded.
> It thus returned bogus values on Intel CPUs.
> 
> Fixes: 108b249c453dd7132599ab6dc7e435a7036c193f
> Reported-by: Roman Kagan <rkagan@virtuozzo.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  arch/x86/include/asm/kvm_host.h |  3 ---
>  arch/x86/kvm/svm.c              | 23 -----------------------
>  arch/x86/kvm/vmx.c              | 39 +++------------------------------------
>  arch/x86/kvm/x86.c              |  6 +++---
>  4 files changed, 6 insertions(+), 65 deletions(-)

Yay,

Reviewed-by: Radim Krčmář <rkrcmar@redhat.com>

      reply	other threads:[~2016-11-02 18:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-02  8:38 [PATCH] KVM: x86: drop TSC offsetting kvm_x86_ops to fix KVM_GET/SET_CLOCK Paolo Bonzini
2016-11-02 18:22 ` Radim Krčmář [this message]

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=20161102182206.GA7771@potion \
    --to=rkrcmar@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=lcapitulino@redhat.com \
    --cc=linux-kernel@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;
as well as URLs for NNTP newsgroup(s).