1. 22 10月, 2021 8 次提交
    • S
      KVM: x86/mmu: Drop a redundant remote TLB flush in kvm_zap_gfn_range() · e8be2a5b
      Sean Christopherson 提交于
      Remove an unnecessary remote TLB flush in kvm_zap_gfn_range() now that
      said function holds mmu_lock for write for its entire duration.  The
      flush was added by the now-reverted commit to allow TDP MMU to flush while
      holding mmu_lock for read, as the transition from write=>read required
      dropping the lock and thus a pending flush needed to be serviced.
      
      Fixes: 5a324c24 ("Revert "KVM: x86/mmu: Allow zap gfn range to operate under the mmu read lock"")
      Cc: Maxim Levitsky <mlevitsk@redhat.com>
      Cc: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
      Cc: Ben Gardon <bgardon@google.com>
      Signed-off-by: NSean Christopherson <seanjc@google.com>
      Message-Id: <20211022010005.1454978-3-seanjc@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      e8be2a5b
    • S
      KVM: x86/mmu: Drop a redundant, broken remote TLB flush · bc3b3c10
      Sean Christopherson 提交于
      A recent commit to fix the calls to kvm_flush_remote_tlbs_with_address()
      in kvm_zap_gfn_range() inadvertantly added yet another flush instead of
      fixing the existing flush.  Drop the redundant flush, and fix the params
      for the existing flush.
      
      Cc: stable@vger.kernel.org
      Fixes: 2822da44 ("KVM: x86/mmu: fix parameters to kvm_flush_remote_tlbs_with_address")
      Cc: Maxim Levitsky <mlevitsk@redhat.com>
      Cc: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
      Signed-off-by: NSean Christopherson <seanjc@google.com>
      Message-Id: <20211022010005.1454978-2-seanjc@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      bc3b3c10
    • L
      KVM: X86: Don't unload MMU in kvm_vcpu_flush_tlb_guest() · 61b05a9f
      Lai Jiangshan 提交于
      kvm_mmu_unload() destroys all the PGD caches.  Use the lighter
      kvm_mmu_sync_roots() and kvm_mmu_sync_prev_roots() instead.
      Signed-off-by: NLai Jiangshan <laijs@linux.alibaba.com>
      Message-Id: <20211019110154.4091-5-jiangshanlai@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      61b05a9f
    • L
      KVM: X86: pair smp_wmb() of mmu_try_to_unsync_pages() with smp_rmb() · 264d3dc1
      Lai Jiangshan 提交于
      The commit 578e1c4d ("kvm: x86: Avoid taking MMU lock
      in kvm_mmu_sync_roots if no sync is needed") added smp_wmb() in
      mmu_try_to_unsync_pages(), but the corresponding smp_load_acquire() isn't
      used on the load of SPTE.W.  smp_load_acquire() orders _subsequent_
      loads after sp->is_unsync; it does not order _earlier_ loads before
      the load of sp->is_unsync.
      
      This has no functional change; smp_rmb() is a NOP on x86, and no
      compiler barrier is required because there is a VMEXIT between the
      load of SPTE.W and kvm_mmu_snc_roots.
      
      Cc: Junaid Shahid <junaids@google.com>
      Signed-off-by: NLai Jiangshan <laijs@linux.alibaba.com>
      Message-Id: <20211019110154.4091-4-jiangshanlai@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      264d3dc1
    • J
      kvm: x86: mmu: Make NX huge page recovery period configurable · 4dfe4f40
      Junaid Shahid 提交于
      Currently, the NX huge page recovery thread wakes up every minute and
      zaps 1/nx_huge_pages_recovery_ratio of the total number of split NX
      huge pages at a time. This is intended to ensure that only a
      relatively small number of pages get zapped at a time. But for very
      large VMs (or more specifically, VMs with a large number of
      executable pages), a period of 1 minute could still result in this
      number being too high (unless the ratio is changed significantly,
      but that can result in split pages lingering on for too long).
      
      This change makes the period configurable instead of fixing it at
      1 minute. Users of large VMs can then adjust the period and/or the
      ratio to reduce the number of pages zapped at one time while still
      maintaining the same overall duration for cycling through the
      entire list. By default, KVM derives a period from the ratio such
      that a page will remain on the list for 1 hour on average.
      Signed-off-by: NJunaid Shahid <junaids@google.com>
      Message-Id: <20211020010627.305925-1-junaids@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      4dfe4f40
    • D
      KVM: x86/mmu: Rename slot_handle_leaf to slot_handle_level_4k · 610265ea
      David Matlack 提交于
      slot_handle_leaf is a misnomer because it only operates on 4K SPTEs
      whereas "leaf" is used to describe any valid terminal SPTE (4K or
      large page). Rename slot_handle_leaf to slot_handle_level_4k to
      avoid confusion.
      
      Making this change makes it more obvious there is a benign discrepency
      between the legacy MMU and the TDP MMU when it comes to dirty logging.
      The legacy MMU only iterates through 4K SPTEs when zapping for
      collapsing and when clearing D-bits. The TDP MMU, on the other hand,
      iterates through SPTEs on all levels.
      
      The TDP MMU behavior of zapping SPTEs at all levels is technically
      overkill for its current dirty logging implementation, which always
      demotes to 4k SPTES, but both the TDP MMU and legacy MMU zap if and only
      if the SPTE can be replaced by a larger page, i.e. will not spuriously
      zap 2m (or larger) SPTEs. Opportunistically add comments to explain this
      discrepency in the code.
      Signed-off-by: NDavid Matlack <dmatlack@google.com>
      Message-Id: <20211019162223.3935109-1-dmatlack@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      610265ea
    • P
      KVM: x86/mmu: clean up prefetch/prefault/speculative naming · 2839180c
      Paolo Bonzini 提交于
      "prefetch", "prefault" and "speculative" are used throughout KVM to mean
      the same thing.  Use a single name, standardizing on "prefetch" which
      is already used by various functions such as direct_pte_prefetch,
      FNAME(prefetch_gpte), FNAME(pte_prefetch), etc.
      Suggested-by: NDavid Matlack <dmatlack@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      2839180c
    • D
      KVM: cleanup allocation of rmaps and page tracking data · 1e76a3ce
      David Stevens 提交于
      Unify the flags for rmaps and page tracking data, using a
      single flag in struct kvm_arch and a single loop to go
      over all the address spaces and memslots.  This avoids
      code duplication between alloc_all_memslots_rmaps and
      kvm_page_track_enable_mmu_write_tracking.
      Signed-off-by: NDavid Stevens <stevensd@chromium.org>
      [This patch is the delta between David's v2 and v3, with conflicts
       fixed and my own commit message. - Paolo]
      Co-developed-by: NSean Christopherson <seanjc@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      1e76a3ce
  2. 18 10月, 2021 1 次提交
  3. 01 10月, 2021 27 次提交
  4. 30 9月, 2021 4 次提交