[openwrt/openwrt] realtek: use irq_force_affinity on otto timer instead
LEDE Commits
lede-commits at lists.infradead.org
Sat Jan 21 11:06:05 PST 2023
svanheule pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/614bba095845cb58f64f5cb82c1710d42a338b61
commit 614bba095845cb58f64f5cb82c1710d42a338b61
Author: INAGAKI Hiroshi <musashino.open at gmail.com>
AuthorDate: Sat Dec 24 21:34:29 2022 +0900
realtek: use irq_force_affinity on otto timer instead
After commit e0d2c59ee995 ("genirq: Always limit the affinity to online
CPUs", 5.10) on Linux, the cpumask passed to irq_set_affinity of irqchip
driver is limited to online CPUs. When irq_do_set_affinity called from
otto timer driver with only one secondary CPU, that CPU is not marked as
online yet, filtered out by cpu_online_mask and fall to error path.
Then, fail to set affinity for that CPU and it leads to instability of
timer on secondary CPU(s).
At least, RTL839x system will be affected.
log:
[ 37.560020] rcu: INFO: rcu_sched detected stalls on CPUs/tasks:
[ 37.638025] rcu: 1-...!: (0 ticks this GP) idle=6ac/0/0x0 softirq=0/0 fqs=1 (false positive?)
[ 37.752683] (detected by 0, t=6002 jiffies, g=-1179, q=26293)
[ 37.829510] Sending NMI from CPU 0 to CPUs 1:
[ 37.886857] NMI backtrace for cpu 1 skipped: idling at r4k_wait_irqoff+0x1c/0x24
[ 37.984801] rcu: rcu_sched kthread timer wakeup didn't happen for 5999 jiffies! g-1179 f0x0 RCU_GP_WAIT_FQS(5) ->state=0x402
[ 38.132743] rcu: Possible timer handling issue on cpu=1 timer-softirq=0
[ 38.221033] rcu: rcu_sched kthread starved for 6000 jiffies! g-1179 f0x0 RCU_GP_WAIT_FQS(5) ->state=0x402 ->cpu=1
[ 38.356336] rcu: Unless rcu_sched kthread gets sufficient CPU time, OOM is now expected behavior.
[ 38.474440] rcu: RCU grace-period kthread stack dump:
...
Replace to irq_force_affinity from irq_set_affinity and ignore
cpu_online_mask to fix the issue.
Signed-off-by: INAGAKI Hiroshi <musashino.open at gmail.com>
Tested-by: Olliver Schinagl <oliver at schinagl.nl>
---
target/linux/realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c | 2 +-
target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/linux/realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c b/target/linux/realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c
index 14e28e50f4..c096d8742b 100644
--- a/target/linux/realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c
+++ b/target/linux/realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c
@@ -244,7 +244,7 @@ static int rttm_cpu_starting(unsigned int cpu)
RTTM_DEBUG(to->of_base.base);
to->clkevt.cpumask = cpumask_of(cpu);
- irq_set_affinity(to->of_irq.irq, to->clkevt.cpumask);
+ irq_force_affinity(to->of_irq.irq, to->clkevt.cpumask);
clockevents_config_and_register(&to->clkevt, RTTM_TICKS_PER_SEC,
RTTM_MIN_DELTA, RTTM_MAX_DELTA);
rttm_enable_irq(to->of_base.base);
diff --git a/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c b/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c
index 14e28e50f4..c096d8742b 100644
--- a/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c
+++ b/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c
@@ -244,7 +244,7 @@ static int rttm_cpu_starting(unsigned int cpu)
RTTM_DEBUG(to->of_base.base);
to->clkevt.cpumask = cpumask_of(cpu);
- irq_set_affinity(to->of_irq.irq, to->clkevt.cpumask);
+ irq_force_affinity(to->of_irq.irq, to->clkevt.cpumask);
clockevents_config_and_register(&to->clkevt, RTTM_TICKS_PER_SEC,
RTTM_MIN_DELTA, RTTM_MAX_DELTA);
rttm_enable_irq(to->of_base.base);
More information about the lede-commits
mailing list