Skip to content

Commit

Permalink
KVM: arm/arm64: Don't reschedule in unmap_stage2_range()
Browse files Browse the repository at this point in the history
Upstream commits fdfe7cb ("KVM: Pass MMU notifier range flags to
kvm_unmap_hva_range()") and b533137 ("KVM: arm64: Only reschedule
if MMU_NOTIFIER_RANGE_BLOCKABLE is not set") fix a "sleeping from invalid
context" BUG caused by unmap_stage2_range() attempting to reschedule when
called on the OOM path.

Unfortunately, these patches rely on the MMU notifier callback being
passed knowledge about whether or not blocking is permitted, which was
introduced in 4.19. Rather than backport this considerable amount of
infrastructure just for KVM on arm, instead just remove the conditional
reschedule.

Cc: <stable@vger.kernel.org> # v4.4 only
Cc: Marc Zyngier <maz@kernel.org>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: James Morse <james.morse@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Will Deacon authored and Greg Kroah-Hartman committed Aug 26, 2020
1 parent 61e37ca commit 1dee8b8
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions arch/arm/kvm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,14 +300,6 @@ static void unmap_range(struct kvm *kvm, pgd_t *pgdp,
next = kvm_pgd_addr_end(addr, end);
if (!pgd_none(*pgd))
unmap_puds(kvm, pgd, addr, next);
/*
* If we are dealing with a large range in
* stage2 table, release the kvm->mmu_lock
* to prevent starvation and lockup detector
* warnings.
*/
if (kvm && (next != end))
cond_resched_lock(&kvm->mmu_lock);
} while (pgd++, addr = next, addr != end);
}

Expand Down

0 comments on commit 1dee8b8

Please sign in to comment.