ANDROID: KVM: arm64: Pre-alloctate mtree nodes in pkvm_mem_abort()
The call to mtree_insert_range() from insert_ppage() may end up doing
GFP_KERNEL allocations if the mtree's kmem_cache is empty. Sadly this is
all being done from an mmu_lock write critical section, where we can't
sleep.
Fix this by inserting dummy entries via mtree_insert_range() outside the
critical section which can then be overwritten without requiring memory
allocation. This is safe to do as we're using the builtin mtree lock,
but does require checking the validity of the ppage found in the tree
from all observers.
Bug: 278749606
Bug: 278011447
Change-Id: Ifa4a092e6280db4d02f5943a4eab94d958b431ee
Signed-off-by:
Quentin Perret <qperret@google.com>
Loading
Please sign in to comment