git: nvmm: Revamp host TLB flush mechanism

Aaron LI aly at
Tue Jul 20 16:30:23 PDT 2021

commit 9bbbdb7e3226d49e14a8b3e4974a01202d69aca2
Author: Aaron LI <aly at>
Date:   Sun Jun 27 13:36:00 2021 +0800

    nvmm: Revamp host TLB flush mechanism
    * Leverage the pmap layer to track guest pmap generation id and the host
      CPUs that the guest pmap is active on.  This avoids the inefficient
      _tlb_flush() callbacks from NVMM that invalidate all TLB entries.
    * Currently just add all CPUs to the backing pmap for guest physical
      memory as they are encountered.  Do not yet try to remove any CPUs,
      because multiple vCPUs may wind up (temporarily) scheduled to the same
      physical CPU.  So more sophisticated tracking is needed.
    * Fix a bug in SVM's host TLB flush handling where breaking out of the
      loop and returning, then re-entering the loop on the same cpu, could
      improperly clear the machine flush request.
    Credit to Matt Dillon.

Summary of changes:
 sys/dev/virtual/nvmm/nvmm.c             | 10 ++++++++++
 sys/dev/virtual/nvmm/nvmm_compat.h      |  1 +
 sys/dev/virtual/nvmm/x86/nvmm_x86_svm.c | 33 +++++++++++++++++++++++----------
 sys/dev/virtual/nvmm/x86/nvmm_x86_vmx.c | 24 ++++++++++++++++--------
 sys/platform/pc64/include/pmap.h        |  4 ----
 sys/platform/pc64/x86_64/pmap.c         |  5 +----
 sys/platform/pc64/x86_64/pmap_inval.c   | 18 ------------------
 7 files changed, 51 insertions(+), 44 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list