[PATCH] LoongArch: warn when per-CPU TLB vector allocation fails

Song Hu <[email protected]> Fri, 17 Jul 2026 10:37:12 +0800
Newsgroups dev.linux.lists.loongarch,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On a secondary CPU, setup_tlb_handler() allocates a NUMA-local page
for the per-CPU TLB exception vectors and silently returns if the
allocation fails.  The CPU keeps running on the shared vectors that
configure_exception_vector() installed earlier in per_cpu_trap_init(),
losing NUMA locality with nothing logged.  Warn so the fallback is
observable.

Signed-off-by: Song Hu <[email protected]>
---
 arch/loongarch/mm/tlb.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/loongarch/mm/tlb.c b/arch/loongarch/mm/tlb.c
index aaf7d685cc2a..e5220653279c 100644
--- a/arch/loongarch/mm/tlb.c
+++ b/arch/loongarch/mm/tlb.c
@@ -297,8 +297,11 @@ static void setup_tlb_handler(int cpu)
 			return;
 
 		page = alloc_pages_node(cpu_to_node(cpu), GFP_ATOMIC, get_order(vec_sz));
-		if (!page)
+		if (!page) {
+			pr_warn("CPU%d: TLB vector allocation failed; "
+				"using shared vectors\n", cpu);
 			return;
+		}
 
 		addr = page_address(page);
 		pcpu_handlers[cpu] = (unsigned long)addr;
-- 
2.43.0