openwrt/target/linux/generic/pending-6.12/360-Revert-MIPS-mm-kmalloc-tlb_vpn-array-to-avoid-stack-.patch
Hauke Mehrtens 0bfc66e7b5
Some checks are pending
Build Kernel / Build all affected Kernels (push) Waiting to run
Build all core packages / Build all core packages for selected target (push) Waiting to run
kernel: Fix boot of realtek rtl838x
Revert two patches from upstream Linux:
135178e90a
63a93d1cd6

This fixes a boot hang on realtek rtl838x switches.
This is the last printed message:
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)

Thread on mips mailing list:
https://lore.kernel.org/linux-mips/b35fe4b3-8f42-49f4-a6bf-9f0e56d4050c@hauke-m.de/T/#u

Link: https://github.com/openwrt/openwrt/pull/21166
Signed-off-by: John Audia <therealgraysky@proton.me>
Link: https://github.com/openwrt/openwrt/pull/21126
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2025-12-17 00:30:46 +01:00

60 lines
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Mon, 15 Dec 2025 01:45:07 +0100
Subject: Revert "MIPS: mm: kmalloc tlb_vpn array to avoid stack overflow"
This reverts commit 63a93d1cd6077d79735f804f5a4957bfb240280c.
---
arch/mips/mm/tlb-r4k.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -12,7 +12,6 @@
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/smp.h>
-#include <linux/memblock.h>
#include <linux/mm.h>
#include <linux/hugetlb.h>
#include <linux/export.h>
@@ -523,26 +522,17 @@ static int r4k_vpn_cmp(const void *a, co
* Initialise all TLB entries with unique values that do not clash with
* what we have been handed over and what we'll be using ourselves.
*/
-static void __ref r4k_tlb_uniquify(void)
+static void r4k_tlb_uniquify(void)
{
+ unsigned long tlb_vpns[1 << MIPS_CONF1_TLBS_SIZE];
int tlbsize = current_cpu_data.tlbsize;
- bool use_slab = slab_is_available();
int start = num_wired_entries();
- phys_addr_t tlb_vpn_size;
- unsigned long *tlb_vpns;
unsigned long vpn_mask;
int cnt, ent, idx, i;
vpn_mask = GENMASK(cpu_vmbits - 1, 13);
vpn_mask |= IS_ENABLED(CONFIG_64BIT) ? 3ULL << 62 : 1 << 31;
- tlb_vpn_size = tlbsize * sizeof(*tlb_vpns);
- tlb_vpns = (use_slab ?
- kmalloc(tlb_vpn_size, GFP_KERNEL) :
- memblock_alloc_raw(tlb_vpn_size, sizeof(*tlb_vpns)));
- if (WARN_ON(!tlb_vpns))
- return; /* Pray local_flush_tlb_all() is good enough. */
-
htw_stop();
for (i = start, cnt = 0; i < tlbsize; i++, cnt++) {
@@ -595,10 +585,6 @@ static void __ref r4k_tlb_uniquify(void)
tlbw_use_hazard();
htw_start();
flush_micro_tlb();
- if (use_slab)
- kfree(tlb_vpns);
- else
- memblock_free(tlb_vpns, tlb_vpn_size);
}
/*