On Tue, Oct 29, 2019 at 2:06 PM Aaron Lewis <aaronlewis@xxxxxxxxxx> wrote: > > The L1 hypervisor may include the IA32_TIME_STAMP_COUNTER MSR in the > vmcs12 MSR VM-exit MSR-store area as a way of determining the highest > TSC value that might have been observed by L2 prior to VM-exit. The > current implementation does not capture a very tight bound on this > value. To tighten the bound, add the IA32_TIME_STAMP_COUNTER MSR to the > vmcs02 VM-exit MSR-store area whenever it appears in the vmcs12 VM-exit > MSR-store area. When L0 processes the vmcs12 VM-exit MSR-store area > during the emulation of an L2->L1 VM-exit, special-case the > IA32_TIME_STAMP_COUNTER MSR, using the value stored in the vmcs02 > VM-exit MSR-store area to derive the value to be stored in the vmcs12 > VM-exit MSR-store area. > > Signed-off-by: Aaron Lewis <aaronlewis@xxxxxxxxxx> > Change-Id: I876e79d98e8f2e5439deafb070be1daa2e1a8e4a Drop the Change-Id. > --- > arch/x86/kvm/vmx/nested.c | 91 ++++++++++++++++++++++++++++++++++++--- > arch/x86/kvm/vmx/vmx.h | 4 ++ > 2 files changed, 89 insertions(+), 6 deletions(-) > > diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c > index 7b058d7b9fcc..19863f2a6588 100644 > --- a/arch/x86/kvm/vmx/nested.c > +++ b/arch/x86/kvm/vmx/nested.c > @@ -929,6 +929,36 @@ static u32 nested_vmx_load_msr(struct kvm_vcpu *vcpu, u64 gpa, u32 count) > return i + 1; > } > > +static bool nested_vmx_get_msr_value(struct kvm_vcpu *vcpu, u32 msr_index, > + u64 *data) Maybe change this to nested_vmx_get_vmexit_msr_value, to clarify that this is for getting the value of an MSR at emulated VM-exit from L2 ot L1? Reviewed-by: Jim Mattson <jmattson@xxxxxxxxxx>