| From cdc2aadbcc7814b17377e5affe9c1c229b3b408a Mon Sep 17 00:00:00 2001 |
| From: Rahul Sharma <rahul.sharma3@arm.com> |
| Date: Mon, 08 Jan 2024 11:20:23 +0000 |
| Subject: [PATCH] GPUCORE-40988 Crash when recovering from large page allocation |
| |
| The crash is caused by mmu_insert_pages_failure_recovery() attempting |
| to access page migration metadata for a 2MB/huge page. |
| |
| Page migration is not supported for 2MB/huge pages. |
| |
| Add check for huge page head to skip page migration related cleanup for |
| huge pages. |
| |
| The kutf test from the original commit has not been backported as it |
| requires additional features that are not present in the r47 branch. |
| |
| TI2: 1125220 (PLAN-11965r1028 DDK Precommit, unrelated reds on |
| user b/e) |
| Change-Id: I36ad4b928752a5eaed29ddf8b3315a6ff40cb8fe |
| (cherry picked from commit fcb337a34b759b51c7b8836a79b6790586bf5f29) |
| --- |
| |
| diff --git a/product/kernel/drivers/gpu/arm/midgard/mmu/mali_kbase_mmu.c b/product/kernel/drivers/gpu/arm/midgard/mmu/mali_kbase_mmu.c |
| index cc4de07..51c90df 100644 |
| --- a/product/kernel/drivers/gpu/arm/midgard/mmu/mali_kbase_mmu.c |
| +++ b/product/kernel/drivers/gpu/arm/midgard/mmu/mali_kbase_mmu.c |
| @@ -1,7 +1,7 @@ |
| // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note |
| /* |
| * |
| - * (C) COPYRIGHT 2010-2023 ARM Limited. All rights reserved. |
| + * (C) COPYRIGHT 2010-2024 ARM Limited. All rights reserved. |
| * |
| * This program is free software and is provided to you under the terms of the |
| * GNU General Public License version 2 as published by the Free Software |
| @@ -1728,7 +1728,8 @@ |
| * going to happen to these pages at this stage. They might return |
| * movable once they are returned to a memory pool. |
| */ |
| - if (kbase_is_page_migration_enabled() && !ignore_page_migration && phys) { |
| + if (kbase_is_page_migration_enabled() && !ignore_page_migration && phys && |
| + !is_huge(*phys) && !is_partial(*phys)) { |
| const u64 num_pages = (to_vpfn - from_vpfn) / GPU_PAGES_PER_CPU_PAGE; |
| u64 i; |
| |