Re: [PATCH/RFC 4/4] [WIP] ARM: shmobile: Enable ARM_GLOBAL_TIMER on Cortex-A9 MPCore SoCs
On Tue, Jul 31, 2018 at 6:08 PM Geert Uytterhoeven wrote: > SH-Mobile AG5 and R-Car H1 SoCs are based on the Cortex-A9 MPCore, which > includes a global timer. > > Enable the ARM global timer on these SoCs, which will be used for: > - the scheduler clock, improving scheduler accuracy from 10 ms to 3 or > 4 ns, > - delay loops, allowing removal of calls to shmobile_init_delay() from > the corresponding machine vectors. > > Note that when using an old DTB lacking the global timer, the kernel > will still work. However, loops-per-jiffies will no longer be preset, > and the delay loop will need to be calibrated during boot. > > Signed-off-by: Geert Uytterhoeven This seems to cause random system resume issues on the venerable SH-Mobile AG5, ranging from plain lockups to RCU warnings: WARNING: suspicious RCU usage 4.18.0-kzm9g-00218-gaf4425056bd09e9e #38 Not tainted - kernel/sched/fair.c:6231 suspicious rcu_dereference_check() usage! other info that might help us debug this: RCU used illegally from offline CPU! rcu_scheduler_active = 2, debug_locks = 1 3 locks held by swapper/1/0: #0: 6d7f5781 ((cpu_died).wait.lock){}, at: complete+0x14/0x48 #1: 84ce6f8e (>pi_lock){-.-.}, at: try_to_wake_up+0x30/0x3cc #2: 93591133 (rcu_read_lock){}, at: select_task_rq_fair+0x5c/0xe8c stack backtrace: CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.18.0-kzm9g-00218-gaf4425056bd09e9e #38 Hardware name: Generic SH73A0 (Flattened Device Tree) [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack+0x9c/0xd4) [] (dump_stack) from [] (select_task_rq_fair+0x140/0xe8c) [] (select_task_rq_fair) from [] (try_to_wake_up+0x210/0x3cc) [] (try_to_wake_up) from [] (__wake_up_common+0xcc/0x140) [] (__wake_up_common) from [] (__wake_up_locked+0x14/0x1c) [] (__wake_up_locked) from [] (complete+0x38/0x48) [] (complete) from [] (arch_cpu_idle_dead+0x2c/0x8c) [] (arch_cpu_idle_dead) from [] (do_idle+0x98/0x148) [] (do_idle) from [] (cpu_startup_entry+0x18/0x1c) [] (cpu_startup_entry) from [<4010246c>] (0x4010246c) Given secondary CPU startup is already quite flaky on this SoC, perhaps it's best to leave it alone? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
[PATCH/RFC 4/4] [WIP] ARM: shmobile: Enable ARM_GLOBAL_TIMER on Cortex-A9 MPCore SoCs
SH-Mobile AG5 and R-Car H1 SoCs are based on the Cortex-A9 MPCore, which includes a global timer. Enable the ARM global timer on these SoCs, which will be used for: - the scheduler clock, improving scheduler accuracy from 10 ms to 3 or 4 ns, - delay loops, allowing removal of calls to shmobile_init_delay() from the corresponding machine vectors. Note that when using an old DTB lacking the global timer, the kernel will still work. However, loops-per-jiffies will no longer be preset, and the delay loop will need to be calibrated during boot. Signed-off-by: Geert Uytterhoeven --- arch/arm/mach-shmobile/Kconfig | 2 ++ arch/arm/mach-shmobile/setup-r8a7779.c | 1 - arch/arm/mach-shmobile/setup-sh73a0.c | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig index 94e9431d92b87405..d39ab39bba92b124 100644 --- a/arch/arm/mach-shmobile/Kconfig +++ b/arch/arm/mach-shmobile/Kconfig @@ -92,6 +92,7 @@ config ARCH_R8A7778 config ARCH_R8A7779 bool "R-Car H1 (R8A77790)" + select ARM_GLOBAL_TIMER select ARCH_RCAR_GEN1 config ARCH_R8A7790 @@ -133,5 +134,6 @@ config ARCH_RZN1 config ARCH_SH73A0 bool "SH-Mobile AG5 (R8A73A00)" select ARCH_RMOBILE + select ARM_GLOBAL_TIMER select RENESAS_INTC_IRQPIN endif diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c index b13ec9088ce5354c..86406e3f9b22e31f 100644 --- a/arch/arm/mach-shmobile/setup-r8a7779.c +++ b/arch/arm/mach-shmobile/setup-r8a7779.c @@ -72,7 +72,6 @@ static const char *const r8a7779_compat_dt[] __initconst = { DT_MACHINE_START(R8A7779_DT, "Generic R8A7779 (Flattened Device Tree)") .smp= smp_ops(r8a7779_smp_ops), .map_io = r8a7779_map_io, - .init_early = shmobile_init_delay, .init_irq = r8a7779_init_irq_dt, .init_late = shmobile_init_late, .dt_compat = r8a7779_compat_dt, diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c index cc08aa752244764a..eb4a62fa42895ebe 100644 --- a/arch/arm/mach-shmobile/setup-sh73a0.c +++ b/arch/arm/mach-shmobile/setup-sh73a0.c @@ -56,7 +56,6 @@ static const char *const sh73a0_boards_compat_dt[] __initconst = { DT_MACHINE_START(SH73A0_DT, "Generic SH73A0 (Flattened Device Tree)") .smp= smp_ops(sh73a0_smp_ops), .map_io = sh73a0_map_io, - .init_early = shmobile_init_delay, .init_machine = sh73a0_generic_init, .init_late = shmobile_init_late, .dt_compat = sh73a0_boards_compat_dt, -- 2.17.1