diff options
author | Sean Christopherson <seanjc@google.com> | 2024-01-11 05:00:47 +0300 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2024-02-23 03:28:45 +0300 |
commit | dab285e4ec736d964cfa6c7fd6eebd22666b5ebc (patch) | |
tree | 98bbef43624d3b7bb39501294b4c7c3d72b70913 /lib/memory-notifier-error-inject.c | |
parent | f5238c2a60f1e0eb48ce21037bce6f4781afa37f (diff) | |
download | linux-dab285e4ec736d964cfa6c7fd6eebd22666b5ebc.tar.xz |
KVM: x86/mmu: Alloc TDP MMU roots while holding mmu_lock for read
Allocate TDP MMU roots while holding mmu_lock for read, and instead use
tdp_mmu_pages_lock to guard against duplicate roots. This allows KVM to
create new roots without forcing kvm_tdp_mmu_zap_invalidated_roots() to
yield, e.g. allows vCPUs to load new roots after memslot deletion without
forcing the zap thread to detect contention and yield (or complete if the
kernel isn't preemptible).
Note, creating a new TDP MMU root as an mmu_lock reader is safe for two
reasons: (1) paths that must guarantee all roots/SPTEs are *visited* take
mmu_lock for write and so are still mutually exclusive, e.g. mmu_notifier
invalidations, and (2) paths that require all roots/SPTEs to *observe*
some given state without holding mmu_lock for write must ensure freshness
through some other means, e.g. toggling dirty logging must first wait for
SRCU readers to recognize the memslot flags change before processing
existing roots/SPTEs.
Link: https://lore.kernel.org/r/20240111020048.844847-8-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'lib/memory-notifier-error-inject.c')
0 files changed, 0 insertions, 0 deletions