Commit b146a9b3 authored by Sean Christopherson's avatar Sean Christopherson
Browse files

KVM: x86/mmu: Age TDP MMU SPTEs without holding mmu_lock



Walk the TDP MMU in an RCU read-side critical section without holding
mmu_lock when harvesting and potentially updating age information on
TDP MMU SPTEs.  Add a new macro to do RCU-safe walking of TDP MMU roots,
and do all SPTE aging with atomic updates; while clobbering Accessed
information is ok, KVM must not corrupt other bits, e.g. must not drop
a Dirty or Writable bit when making a SPTE young..

If updating a SPTE to mark it for access tracking fails, leave it as is
and treat it as if it were young.  If the spte is being actively modified,
it is most likely young.

Acquire and release mmu_lock for write when harvesting age information
from the shadow MMU, as the shadow MMU doesn't yet support aging outside
of mmu_lock.

Suggested-by: default avatarYu Zhao <yuzhao@google.com>
Signed-off-by: default avatarJames Houghton <jthoughton@google.com>
Reviewed-by: default avatarDavid Matlack <dmatlack@google.com>
Link: https://lore.kernel.org/r/20250204004038.1680123-5-jthoughton@google.com


[sean: massage changelog]
Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
parent 928c54b1
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment