[PATCH 0/3] KVM: Reduce TSC scaling race condition mess

David Woodhouse posted 3 patches 4 years, 3 months ago
Documentation/virt/kvm/api.rst                        |  11 +++--
arch/x86/include/asm/kvm_host.h                       |   2 +
arch/x86/kvm/x86.c                                    |  54 ++++++++++++++++------
include/uapi/linux/kvm.h                              |   4 +-
tools/testing/selftests/kvm/Makefile                  |   1 +
tools/testing/selftests/kvm/x86_64/tsc_scaling_sync.c | 119 ++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 171 insertions(+), 20 deletions(-)
[PATCH 0/3] KVM: Reduce TSC scaling race condition mess
Posted by David Woodhouse 4 years, 3 months ago
As Sean says, we punt on a proper fix... but at least now I can create a
bunch of vCPUs with a scaled TSC and their TSC synchronization isn't 
*utterly* hosed, so the test case I posted last night is actually passing.

It would still be nice for the original test case to work, where each
vCPU thread creates its own vCPU, then sets the scale and the current
TSC value. But this resolves most sane use cases.

David Woodhouse (2):
      KVM: x86: Accept KVM_[GS]ET_TSC_KHZ as a VM ioctl.
      KVM: x86: Test case for TSC scaling and offset sync

Sean Christopherson (1):
      KVM: x86: Don't snapshot "max" TSC if host TSC is constant

 Documentation/virt/kvm/api.rst                        |  11 +++--
 arch/x86/include/asm/kvm_host.h                       |   2 +
 arch/x86/kvm/x86.c                                    |  54 ++++++++++++++++------
 include/uapi/linux/kvm.h                              |   4 +-
 tools/testing/selftests/kvm/Makefile                  |   1 +
 tools/testing/selftests/kvm/x86_64/tsc_scaling_sync.c | 119 ++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 171 insertions(+), 20 deletions(-)