summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Percival <samuel.percival@arm.com>2023-12-18 08:37:58 +0000
committerRenato Grottesi <otaner@google.com>2023-12-19 13:06:22 +0000
commit3b9d05436064ad14aa01f73d42e1c7408ab8b6b4 (patch)
treebfe16a4a95eda0a6d84795e578c527f48661adde
parent816d412ab903b9fb6eb0608e405e984c42c988b9 (diff)
downloadgpu-3b9d05436064ad14aa01f73d42e1c7408ab8b6b4.tar.gz
Fix invalid page table entries from occuring.
GPUCORE-40571 Fix invalid page table entries from occuring. This patch prevents the invalid page table entries from occuring. Bug: 316204010 Change-Id: I6aa1fdb9f0a40dab5d8a7d1dcd85f7485c960a22 Signed-off-by: Renato Grottesi <otaner@google.com> Test: platform can boot. Provenance: https://code.ipdelivery.arm.com/c/GPU/mali-ddk/+/6262
-rw-r--r--mali_kbase/mali_kbase_mem.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/mali_kbase/mali_kbase_mem.c b/mali_kbase/mali_kbase_mem.c
index 9de0893..5547bef 100644
--- a/mali_kbase/mali_kbase_mem.c
+++ b/mali_kbase/mali_kbase_mem.c
@@ -4066,9 +4066,6 @@ static int kbase_jit_grow(struct kbase_context *kctx,
if (reg->gpu_alloc->nents >= info->commit_pages)
goto done;
- /* Grow the backing */
- old_size = reg->gpu_alloc->nents;
-
/* Allocate some more pages */
delta = info->commit_pages - reg->gpu_alloc->nents;
pages_required = delta;
@@ -4111,6 +4108,17 @@ static int kbase_jit_grow(struct kbase_context *kctx,
kbase_mem_pool_lock(pool);
}
+ if (reg->gpu_alloc->nents >= info->commit_pages) {
+ kbase_mem_pool_unlock(pool);
+ spin_unlock(&kctx->mem_partials_lock);
+ dev_info(
+ kctx->kbdev->dev,
+ "JIT alloc grown beyond the required number of initially required pages, this grow no longer needed.");
+ goto done;
+ }
+
+ old_size = reg->gpu_alloc->nents;
+ delta = info->commit_pages - old_size;
gpu_pages = kbase_alloc_phy_pages_helper_locked(reg->gpu_alloc, pool,
delta, &prealloc_sas[0]);
if (!gpu_pages) {