From: "Raslan, KarimAllah" <karahmed@amazon.de>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"pbonzini@redhat.com" <pbonzini@redhat.com>
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: Sat, 14 Apr 2018 06:31:48 +0000 [thread overview]
Message-ID: <1523687508.32594.69.camel@amazon.de> (raw)
In-Reply-To: <6ae8f089-4c77-d1cb-b79f-ec414f39a8d0@redhat.com>
On Fri, 2018-04-13 at 17:35 +0200, Paolo Bonzini wrote:
> 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.
Apparently I will never wrap my head around this nested stuff :D
>
> Paolo
>
> >
> > >
> > > vcpu->arch.ia32_tsc_adjust_msr += offset - curr_offset;
>
>
Amazon Development Center Germany GmbH
Berlin - Dresden - Aachen
main office: Krausenstr. 38, 10117 Berlin
Geschaeftsfuehrer: Dr. Ralf Herbrich, Christian Schlaeger
Ust-ID: DE289237879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B
next prev parent reply other threads:[~2018-04-14 6:31 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
2018-04-14 6:31 ` Raslan, KarimAllah [this message]
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=1523687508.32594.69.camel@amazon.de \
--to=karahmed@amazon.de \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.