Re: [PATCH 2/6] kvm: x86: drop read_tsc_offset()

From: Jim Mattson
Date: Mon Sep 19 2016 - 18:18:08 EST


Hmmm. Yes, I think it does. With this patch series,
vcpu->arch.tsc_offset appears to contain L1's TSC offset (perhaps
making vmx->nested.vmcs01_tsc_offset redundant).

However, this unfortunately limits the newly added functionality to
merging host and *L1* guest traces. It doesn't work with L2 (or
deeper) guests. Or perhaps I'm missing something?

On Mon, Sep 19, 2016 at 8:34 AM, Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote:
>
>
> On 19/09/2016 17:30, Jim Mattson wrote:
>> vmx_read_tsc_offset has a bug when running nested VMs. It should really be:
>>
>> if (is_guest_mode(vcpu))
>> return to_vmx(vcpu)->nested.vmcs01_tsc_offset;
>> else
>> return vmcs_read64(TSC_OFFSET);
>>
>> Perhaps a better name woulf be "vmx_get_l1_tsc_offset."
>
> I agree, but doesn't this patch fix the bug too?
>
> Paolo
>
>> In any case, this does not seem consistent with vcpu->arch.tsc_offset.
>