mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Raslan, KarimAllah" <karahmed@amazon.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Cc: "jmattson@google.com" <jmattson@google.com>,
	"rkrcmar@redhat.com" <rkrcmar@redhat.com>
Subject: Re: [PATCH 1/2] X86/KVM: Properly update 'tsc_offset' to represent the running guest
Date: Fri, 13 Apr 2018 17:35:12 +0200	[thread overview]
Message-ID: <6ae8f089-4c77-d1cb-b79f-ec414f39a8d0@redhat.com> (raw)
In-Reply-To: <1523623218.32594.51.camel@amazon.de>

On 13/04/2018 14:40, Raslan, KarimAllah wrote:
>>  
>>  static void update_ia32_tsc_adjust_msr(struct kvm_vcpu *vcpu, s64 offset)
>>  {
>> -	u64 curr_offset = vcpu->arch.tsc_offset;
>> +	u64 curr_offset = kvm_x86_ops->read_l1_tsc_offset(vcpu);
> I might be missing something but is this really strictly needed or is
> it really a bug?
> 
> I can see update_ia32_tsc_adjust_msr called from kvm_write_tsc only 
> which is called from a) vmx_set_msr or b) kvm_arch_vcpu_postcreate.
> The adjust_msr would only be called if !host_initiated. So only 
> vmx_set_msr which is coming from an L1 write (or a restore but that
> would not be !host_initiated). So the only that tsc_adjust is called is
> !is_guest_mode.

It can also be called from guest mode if the MSR bitmap says there's no
L1 vmexit for that MSR; that's what the testcases do.

Paolo

>>  	vcpu->arch.ia32_tsc_adjust_msr += offset - curr_offset;

  reply	other threads:[~2018-04-13 15:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-13 11:23 [PATCH 0/2] MSR_IA32_TSC fixes for nested Paolo Bonzini
2018-04-13 11:23 ` [PATCH 1/2] X86/KVM: Properly update 'tsc_offset' to represent the running guest Paolo Bonzini
2018-04-13 12:40   ` Raslan, KarimAllah
2018-04-13 15:35     ` Paolo Bonzini [this message]
2018-04-14  6:31       ` Raslan, KarimAllah
2018-04-13 16:02   ` Jim Mattson
2018-04-13 16:04     ` Paolo Bonzini
2018-04-14  3:11       ` Raslan, KarimAllah
2018-04-13 11:23 ` [PATCH 2/2] kvm: x86: move MSR_IA32_TSC handling to x86.c Paolo Bonzini
2018-04-13 11:23 ` [PATCH 3/2] kvm: selftests: add vmx_tsc_adjust_test 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=6ae8f089-4c77-d1cb-b79f-ec414f39a8d0@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jmattson@google.com \
    --cc=karahmed@amazon.de \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®