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

Song Hu <[email protected]> Fri, 17 Jul 2026 11:57:59 +0800
Newsgroups dev.linux.lists.loongarch,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
在 2026/7/17 11:33, Huacai Chen 写道:
> 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?
You're right — the fallback is completely benign and a pr_warn is too
loud for something that doesn't affect functionality.  I'll drop this
patch.

Thanks,
Song Hu
> Huacai
>
>>                 addr = page_address(page);
>>                 pcpu_handlers[cpu] = (unsigned long)addr;
>> --
>> 2.43.0
>>