ANDROID: KVM: arm64: Enable RCU for pinned pages mtree
A maple tree might need memory allocation during insertion. This is not
possible under the rwlock. Therefore, we need to preallocate memory
before that lock is taken. This is done with the KVM_DUMMY_PPAGE
insert_range. However, to do so, we need to enable the maple tree RCU
locking that'll ensure the tree is stable between this lock-less
insertion and concurrent tree walks. RCU protection must be
manually.
The sole limitation to the RCU protection is the mt_find() returned
entry might not be valid. This is however not a problem as all the
readers are protected from modifiers by the mmu_lock.
On the VM destroy path, we can relax the RCU protection. No vCPU can run
and as a consequence no concurrent tree access will occur.
Bug: 278749606
Bug: 395429108
Change-Id: I8400f3b7bdda76d2a60ddcaeb3ea027607898eb2
Signed-off-by:
Vincent Donnefort <vdonnefort@google.com>
Loading
Please sign in to comment