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

Huacai Chen <[email protected]> Fri, 17 Jul 2026 11:33:52 +0800
Newsgroups dev.linux.lists.loongarch,org.kernel.vger.linux-kernel
Message-ID <CAAhV-H5sgnvth4_uKSrz0U+0gPOWMT7E5YODyNVVzHq_Y+cgmw@mail.gmail.com>
Hi, Song,

On Fri, Jul 17, 2026 at 10:38 AM Song Hu <[email protected]> wrote:
>
> 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;
> +               }
A warning usually make users nervous, this failure completely doesn't
hurt anything, why you want to shout loudly here?

Huacai

>
>                 addr = page_address(page);
>                 pcpu_handlers[cpu] = (unsigned long)addr;
> --
> 2.43.0
>