Message ID | 20191108051439.185635-1-aaronlewis@google.com (mailing list archive) |
---|---|
Headers | show |
Series | Add support for capturing the highest observable L2 TSC | expand |
On 08/11/19 06:14, Aaron Lewis 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. > > v3 -> v4: > - Squash the final commit with the previous one used to prepare the MSR-store > area. There is no need for this split after all. > > v2 -> v3: > - Rename NR_MSR_ENTRIES to NR_LOADSAVE_MSRS > - Pull setup code for preparing the MSR-store area out of the final commit and > put it in it's own commit (4/5). > - Export vmx_find_msr_index() in the final commit instead of in commit 3/5 as > it isn't until the final commit that we actually use it. > > v1 -> v2: > - Rename function nested_vmx_get_msr_value() to > nested_vmx_get_vmexit_msr_value(). > - Remove unneeded tag 'Change-Id' from commit messages. > > Aaron Lewis (4): > kvm: nested: Introduce read_and_check_msr_entry() > kvm: vmx: Rename NR_AUTOLOAD_MSRS to NR_LOADSTORE_MSRS > kvm: vmx: Rename function find_msr() to vmx_find_msr_index() > KVM: nVMX: Add support for capturing highest observable L2 TSC > > arch/x86/kvm/vmx/nested.c | 136 ++++++++++++++++++++++++++++++++------ > arch/x86/kvm/vmx/vmx.c | 14 ++-- > arch/x86/kvm/vmx/vmx.h | 9 ++- > 3 files changed, 131 insertions(+), 28 deletions(-) > Queued, but it would be good to have a testcase for this, either for kvm-unit-tests or for tools/testing/selftests/kvm. Paolo
On Fri, Nov 15, 2019 at 2:23 AM Paolo Bonzini <pbonzini@redhat.com> wrote: > > On 08/11/19 06:14, Aaron Lewis 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. > > > > v3 -> v4: > > - Squash the final commit with the previous one used to prepare the MSR-store > > area. There is no need for this split after all. > > > > v2 -> v3: > > - Rename NR_MSR_ENTRIES to NR_LOADSAVE_MSRS > > - Pull setup code for preparing the MSR-store area out of the final commit and > > put it in it's own commit (4/5). > > - Export vmx_find_msr_index() in the final commit instead of in commit 3/5 as > > it isn't until the final commit that we actually use it. > > > > v1 -> v2: > > - Rename function nested_vmx_get_msr_value() to > > nested_vmx_get_vmexit_msr_value(). > > - Remove unneeded tag 'Change-Id' from commit messages. > > > > Aaron Lewis (4): > > kvm: nested: Introduce read_and_check_msr_entry() > > kvm: vmx: Rename NR_AUTOLOAD_MSRS to NR_LOADSTORE_MSRS > > kvm: vmx: Rename function find_msr() to vmx_find_msr_index() > > KVM: nVMX: Add support for capturing highest observable L2 TSC > > > > arch/x86/kvm/vmx/nested.c | 136 ++++++++++++++++++++++++++++++++------ > > arch/x86/kvm/vmx/vmx.c | 14 ++-- > > arch/x86/kvm/vmx/vmx.h | 9 ++- > > 3 files changed, 131 insertions(+), 28 deletions(-) > > > > Queued, but it would be good to have a testcase for this, either for > kvm-unit-tests or for tools/testing/selftests/kvm. > > Paolo > Agreed. I have some test cases in kvm-unit-tests for this code that I've been using to test these changes locally, however, they would fail upstream without "[kvm-unit-tests PATCH] x86: Fix the register order to match struct regs" being taken first. I'll ping that patch again.
On 15/11/19 15:25, Aaron Lewis wrote: > Agreed. I have some test cases in kvm-unit-tests for this code that > I've been using to test these changes locally, however, they would > fail upstream without "[kvm-unit-tests PATCH] x86: Fix the register > order to match struct regs" being taken first. I'll ping that patch > again. > You've just done that... :) Paolo