]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: x86/mmu: Refactor low level rmap helpers to prep for walking w/o mmu_lock
authorSean Christopherson <seanjc@google.com>
Tue, 4 Feb 2025 00:40:35 +0000 (00:40 +0000)
committerSean Christopherson <seanjc@google.com>
Fri, 14 Feb 2025 15:17:33 +0000 (07:17 -0800)
commit9fb13ba6b5ff9649f4283724ed75828d8a53cf3b
tree7f735713c8676f36d91b2d78af12fa2c55c7db1f
parent8c403cf23119356245a8d69a4c0966f350b3c6a3
KVM: x86/mmu: Refactor low level rmap helpers to prep for walking w/o mmu_lock

Refactor the pte_list and rmap code to always read and write rmap_head->val
exactly once, e.g. by collecting changes in a local variable and then
propagating those changes back to rmap_head->val as appropriate.  This will
allow implementing a per-rmap rwlock (of sorts) by adding a LOCKED bit into
the rmap value alongside the MANY bit.

Signed-off-by: James Houghton <jthoughton@google.com>
Acked-by: Yu Zhao <yuzhao@google.com>
Reviewed-by: James Houghton <jthoughton@google.com>
Link: https://lore.kernel.org/r/20250204004038.1680123-9-jthoughton@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/mmu/mmu.c