[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6ae8f089-4c77-d1cb-b79f-ec414f39a8d0@redhat.com>
Date: Fri, 13 Apr 2018 17:35:12 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: "Raslan, KarimAllah" <karahmed@...zon.de>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>
Cc: "jmattson@...gle.com" <jmattson@...gle.com>,
"rkrcmar@...hat.com" <rkrcmar@...hat.com>
Subject: Re: [PATCH 1/2] X86/KVM: Properly update 'tsc_offset' to represent
the running guest
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;
Powered by blists - more mailing lists