]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86/mmu: Ensure forward progress when yielding in TDP MMU iter
authorBen Gardon <bgardon@google.com>
Tue, 2 Feb 2021 18:57:19 +0000 (10:57 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 4 Feb 2021 10:27:40 +0000 (05:27 -0500)
commit9ecec3e513d38afc1f2169ccad691af197e51a2e
tree7539c9764a9f789c9d02c337044cd988ec893206
parentfeddf9ba326472350ebc8d887144abc1c8406ca2
KVM: x86/mmu: Ensure forward progress when yielding in TDP MMU iter

In some functions the TDP iter risks not making forward progress if two
threads livelock yielding to one another. This is possible if two threads
are trying to execute wrprot_gfn_range. Each could write protect an entry
and then yield. This would reset the tdp_iter's walk over the paging
structure and the loop would end up repeating the same entry over and
over, preventing either thread from making forward progress.

Fix this issue by only yielding if the loop has made forward progress
since the last yield.

Fixes: c63f26e3339f ("kvm: x86/mmu: Support dirty logging for the TDP MMU")
Reviewed-by: Peter Feiner <pfeiner@google.com>
Signed-off-by: Ben Gardon <bgardon@google.com>
Message-Id: <20210202185734.1680553-14-bgardon@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/tdp_iter.c
arch/x86/kvm/mmu/tdp_iter.h
arch/x86/kvm/mmu/tdp_mmu.c