LoongArch: warn when per-CPU TLB vector allocation fails
PATCH 1/1 LoongArch: warn when per-CPU TLB vector allocation fails
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.
--- arch/loongarch/mm/tlb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/loongarch/mm/tlb.c +4 -1
@@ -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;
Signature · 1 line
2.43.0
Huacai Chen
maintainerHi, Song,
Quoted 18 lines · Song Hu
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 thatconfigure_exception_vector()installed earlier inper_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(-)arch/loongarch/mm/tlb.c +0
-0
arch/loongarch/mm/tlb.c static void setup_tlb_handler(int cpu) · line 304
Quoted 9 lines
arch/loongarch/mm/tlb.c +4
-1@@ -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
Quoted 6 lines
arch/loongarch/mm/tlb.c +0
-1addr =page_address (page); pcpu_handlers[cpu] = (unsigned long )addr; --2.43.0
Quoted 22 lines · Huacai Chen
Hi, Song,
Quoted 19 lines · Song Hu
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 thatconfigure_exception_vector()installed earlier inper_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(-)arch/loongarch/mm/tlb.c +0
-0@@ -297,8 +297,11 @@ static void setup_tlb_handler(int cpu)return ;
Quoted 9 lines
arch/loongarch/mm/tlb.c static void setup_tlb_handler(int cpu) · line 304
Quoted 7 lines
arch/loongarch/mm/tlb.c +4
-1page =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
Quoted 7 lines
Huacai
Quoted 5 lines
arch/loongarch/mm/tlb.c +0
-1addr =page_address (page); pcpu_handlers[cpu] = (unsigned long )addr; --2.43.0