]> www.infradead.org Git - users/dwmw2/linux.git/commit
KVM: x86/mmu: Drop RCU after processing each root in MMU notifier hooks
authorSean Christopherson <seanjc@google.com>
Sat, 26 Feb 2022 00:15:27 +0000 (00:15 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 2 Mar 2022 17:58:30 +0000 (12:58 -0500)
commit277b4655c66d43f3096e11305dccf1a3c1a9339c
treed40eead89c78b25cb4f392968b0480bf79b42df7
parentcd4e3be0338fd14e2a2ad6b832477c9547c711c6
KVM: x86/mmu: Drop RCU after processing each root in MMU notifier hooks

Drop RCU protection after processing each root when handling MMU notifier
hooks that aren't the "unmap" path, i.e. aren't zapping.  Temporarily
drop RCU to let RCU do its thing between roots, and to make it clear that
there's no special behavior that relies on holding RCU across all roots.

Currently, the RCU protection is completely superficial, it's necessary
only to make rcu_dereference() of SPTE pointers happy.  A future patch
will rely on holding RCU as a proxy for vCPUs in the guest, e.g. to
ensure shadow pages aren't freed before all vCPUs do a TLB flush (or
rather, acknowledge the need for a flush), but in that case RCU needs to
be held until the flush is complete if and only if the flush is needed
because a shadow page may have been removed.  And except for the "unmap"
path, MMU notifier events cannot remove SPs (don't toggle PRESENT bit,
and can't change the PFN for a SP).

Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Ben Gardon <bgardon@google.com>
Message-Id: <20220226001546.360188-10-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/tdp_mmu.c