KVM: x86/mmu: Require mmu_lock be held for write in unyielding root iter
authorSean Christopherson <seanjc@google.com>
Sat, 26 Feb 2022 00:15:24 +0000 (00:15 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 8 Mar 2022 14:31:47 +0000 (09:31 -0500)
commit226b8c8f85e4246f31947be1c11bf36208fe9052
tree58281acdb4f1677fdb7c228e14723f689b399ca9
parent7ae5840e6f3325b52ee46437d46ba0465016584d
KVM: x86/mmu: Require mmu_lock be held for write in unyielding root iter

Assert that mmu_lock is held for write by users of the yield-unfriendly
TDP iterator.  The nature of a shared walk means that the caller needs to
play nice with other tasks modifying the page tables, which is more or
less the same thing as playing nice with yielding.  Theoretically, KVM
could gain a flow where it could legitimately take mmu_lock for read in
a non-preemptible context, but that's highly unlikely and any such case
should be viewed with a fair amount of scrutiny.

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