[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201203171118.372391-1-mlevitsk@redhat.com>
Date: Thu, 3 Dec 2020 19:11:15 +0200
From: Maxim Levitsky <mlevitsk@...hat.com>
To: kvm@...r.kernel.org
Cc: "H. Peter Anvin" <hpa@...or.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Jonathan Corbet <corbet@....net>,
Jim Mattson <jmattson@...gle.com>,
Wanpeng Li <wanpengli@...cent.com>,
linux-kselftest@...r.kernel.org (open list:KERNEL SELFTEST FRAMEWORK),
Vitaly Kuznetsov <vkuznets@...hat.com>,
Marcelo Tosatti <mtosatti@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Sean Christopherson <sean.j.christopherson@...el.com>,
linux-kernel@...r.kernel.org (open list),
Ingo Molnar <mingo@...hat.com>,
x86@...nel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)),
Joerg Roedel <joro@...tes.org>, Borislav Petkov <bp@...en8.de>,
Shuah Khan <shuah@...nel.org>,
Maxim Levitsky <mlevitsk@...hat.com>,
Andrew Jones <drjones@...hat.com>,
Oliver Upton <oupton@...gle.com>,
linux-doc@...r.kernel.org (open list:DOCUMENTATION)
Subject: [PATCH v2 0/3] RFC: Precise TSC migration
Hi!
This is the second version of the work to make TSC migration more accurate,
as was defined by Paulo at:
https://www.spinics.net/lists/kvm/msg225525.html
I omitted most of the semi-offtopic points I raised related to TSC
in the previous RFC where we can continue the discussion.
I do want to raise another thing that I almost forgot.
On AMD systems, the Linux kernel will mark the guest tsc as
unstable unless invtsc is set which is set on recent AMD
hardware.
Take a look at 'unsynchronized_tsc()' to verify this.
This is another thing that IMHO should be fixed at least when
running under KVM.
Note that I forgot to mention that
X86_FEATURE_TSC_RELIABLE also short-circuits this code,
thus giving another reason to enable it under KVM.
Changes from V1:
- added KVM_TSC_STATE_TIMESTAMP_VALID instead of testing ns == 0
- allow diff < 0, because it is still better that capping it to 0
- updated tsc_msr_test unit test to cover this feature
- refactoring
Patches to enable this feature in qemu are in the process of
being sent to qemu-devel mailing list.
Best regards,
Maxim Levitsky
Maxim Levitsky (3):
KVM: x86: implement KVM_{GET|SET}_TSC_STATE
KVM: x86: introduce KVM_X86_QUIRK_TSC_HOST_ACCESS
kvm/selftests: update tsc_msrs_test to cover
KVM_X86_QUIRK_TSC_HOST_ACCESS
Documentation/virt/kvm/api.rst | 65 +++++++++++++
arch/x86/include/uapi/asm/kvm.h | 1 +
arch/x86/kvm/x86.c | 92 ++++++++++++++++++-
include/uapi/linux/kvm.h | 15 +++
.../selftests/kvm/x86_64/tsc_msrs_test.c | 79 ++++++++++++++--
5 files changed, 237 insertions(+), 15 deletions(-)
--
2.26.2
Powered by blists - more mailing lists