git: nvmm - Fix TSC synchronization issues

Aaron LI aly at crater.dragonflybsd.org
Tue Jul 20 16:30:23 PDT 2021


commit c9096cab4ce6c0febd2dfe41f841c7e844fea2a9
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Wed Jun 23 17:51:40 2021 -0700

    nvmm - Fix TSC synchronization issues
    
    * Save the guest TSC offset in cpudata as 'gtsc_offset', replacing the
      origin absolute TSC value stored as 'gtsc'.
    
    * QEMU and other emulators probably have no intention of actually
      forcing the TSC state in the SETSTATE call, so don't act on it
      if it matches the value we previously returned.
    
      This allows the guest to inherit a completely synchronized TSC from
      the host.  Without it, the TSC's for the VCPUs wind up being badly
      out of sync.
    
    * Updating MSR_TSC completely blows up TSC mp synchronization.  We
      assume QEMU did not intend to update the TSC if it tries to write
      0 or tries to write the value returned in the previous getstate.
    
    * This allows kernels to use the TSC as a clock, which costs nothing,
      verses the ACPI or HPET which have horrible overhead and a global
      mutex in QEMU.

Summary of changes:
 sys/dev/virtual/nvmm/x86/nvmm_x86_svm.c | 37 ++++++++++++++++++++++++++-------
 sys/dev/virtual/nvmm/x86/nvmm_x86_vmx.c | 36 +++++++++++++++++++++++++-------
 2 files changed, 57 insertions(+), 16 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/c9096cab4ce6c0febd2dfe41f841c7e844fea2a9


-- 
DragonFly BSD source repository


More information about the Commits mailing list