* [PATCH 6.1.y and 6.6.y] LoongArch/smp: Call rcutree_report_cpu_starting() at tlb_init()
@ 2024-01-31 7:21 Huacai Chen
2024-02-03 1:27 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Huacai Chen @ 2024-01-31 7:21 UTC (permalink / raw
To: gregkh, Huacai Chen
Cc: loongarch, stable, Xuefeng Li, Guo Ren, Xuerui Wang, Jiaxun Yang,
linux-kernel, loongson-kernel, Huacai Chen
Machines which have more than 8 nodes fail to boot SMP after commit
a2ccf46333d7b2cf96 ("LoongArch/smp: Call rcutree_report_cpu_starting()
earlier"). Because such machines use tlb-based per-cpu base address
rather than dmw-based per-cpu base address, resulting per-cpu variables
can only be accessed after tlb_init(). But rcutree_report_cpu_starting()
is now called before tlb_init() and accesses per-cpu variables indeed.
Since the original patch want to avoid the lockdep warning caused by
page allocation in tlb_init(), we can move rcutree_report_cpu_starting()
to tlb_init() where after tlb exception configuration but before page
allocation.
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
arch/loongarch/kernel/smp.c | 1 -
arch/loongarch/mm/tlb.c | 16 ++++++++++------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/arch/loongarch/kernel/smp.c b/arch/loongarch/kernel/smp.c
index 3f3cdc7ffe7a..4b4ba3f9335d 100644
--- a/arch/loongarch/kernel/smp.c
+++ b/arch/loongarch/kernel/smp.c
@@ -506,7 +506,6 @@ asmlinkage void start_secondary(void)
sync_counter();
cpu = raw_smp_processor_id();
set_my_cpu_offset(per_cpu_offset(cpu));
- rcu_cpu_starting(cpu);
cpu_probe();
constant_clockevent_init();
diff --git a/arch/loongarch/mm/tlb.c b/arch/loongarch/mm/tlb.c
index 2c51d755fbbc..e71150dd7f4b 100644
--- a/arch/loongarch/mm/tlb.c
+++ b/arch/loongarch/mm/tlb.c
@@ -284,12 +284,16 @@ static void setup_tlb_handler(int cpu)
set_handler(EXCCODE_TLBNR * VECSIZE, handle_tlb_protect, VECSIZE);
set_handler(EXCCODE_TLBNX * VECSIZE, handle_tlb_protect, VECSIZE);
set_handler(EXCCODE_TLBPE * VECSIZE, handle_tlb_protect, VECSIZE);
- }
+ } else {
+ int vec_sz __maybe_unused;
+ void *addr __maybe_unused;
+ struct page *page __maybe_unused;
+
+ /* Avoid lockdep warning */
+ rcu_cpu_starting(cpu);
+
#ifdef CONFIG_NUMA
- else {
- void *addr;
- struct page *page;
- const int vec_sz = sizeof(exception_handlers);
+ vec_sz = sizeof(exception_handlers);
if (pcpu_handlers[cpu])
return;
@@ -305,8 +309,8 @@ static void setup_tlb_handler(int cpu)
csr_write64(pcpu_handlers[cpu], LOONGARCH_CSR_EENTRY);
csr_write64(pcpu_handlers[cpu], LOONGARCH_CSR_MERRENTRY);
csr_write64(pcpu_handlers[cpu] + 80*VECSIZE, LOONGARCH_CSR_TLBRENTRY);
- }
#endif
+ }
}
void tlb_init(int cpu)
--
2.39.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 6.1.y and 6.6.y] LoongArch/smp: Call rcutree_report_cpu_starting() at tlb_init()
2024-01-31 7:21 [PATCH 6.1.y and 6.6.y] LoongArch/smp: Call rcutree_report_cpu_starting() at tlb_init() Huacai Chen
@ 2024-02-03 1:27 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2024-02-03 1:27 UTC (permalink / raw
To: Huacai Chen
Cc: Huacai Chen, loongarch, stable, Xuefeng Li, Guo Ren, Xuerui Wang,
Jiaxun Yang, linux-kernel, loongson-kernel
On Wed, Jan 31, 2024 at 03:21:51PM +0800, Huacai Chen wrote:
> Machines which have more than 8 nodes fail to boot SMP after commit
> a2ccf46333d7b2cf96 ("LoongArch/smp: Call rcutree_report_cpu_starting()
> earlier"). Because such machines use tlb-based per-cpu base address
> rather than dmw-based per-cpu base address, resulting per-cpu variables
> can only be accessed after tlb_init(). But rcutree_report_cpu_starting()
> is now called before tlb_init() and accesses per-cpu variables indeed.
>
> Since the original patch want to avoid the lockdep warning caused by
> page allocation in tlb_init(), we can move rcutree_report_cpu_starting()
> to tlb_init() where after tlb exception configuration but before page
> allocation.
>
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> ---
> arch/loongarch/kernel/smp.c | 1 -
> arch/loongarch/mm/tlb.c | 16 ++++++++++------
> 2 files changed, 10 insertions(+), 7 deletions(-)
Now queued up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-03 1:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-31 7:21 [PATCH 6.1.y and 6.6.y] LoongArch/smp: Call rcutree_report_cpu_starting() at tlb_init() Huacai Chen
2024-02-03 1:27 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).