]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86/mmu: Voluntarily reschedule as needed when zapping all sptes
authorSean Christopherson <sean.j.christopherson@intel.com>
Tue, 5 Feb 2019 21:01:33 +0000 (13:01 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 20 Feb 2019 21:48:46 +0000 (22:48 +0100)
commit8ec418539ccaf7d03be6e9a703d283c93a0fb010
tree6bbcdb18a12decd98ce8aa9f38d0d9f4575ad2b0
parentf72c580cbbf325b0c7da07bd7ff72dd0588017ff
KVM: x86/mmu: Voluntarily reschedule as needed when zapping all sptes

Call cond_resched_lock() when zapping all sptes to reschedule if needed
or to release and reacquire mmu_lock in case of contention.  There is no
need to flush or zap when temporarily dropping mmu_lock as zapping all
sptes is done only when the owning userspace VMM has exited or when the
VM is being destroyed, i.e. there is no interplay with memslots or MMIO
generations to worry about.

Be paranoid and restart the walk if mmu_lock is dropped to avoid any
potential issues with consuming a stale iterator.  The overhead in doing
so is negligible as at worst there will be a few root shadow pages at
the head of the list, i.e. the iterator is essentially the head of the
list already.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu.c