linux-yocto/kernel/time
Xiongfeng Wang 4a19dac7ac hrtimers: Unconditionally update target CPU base after offline timer migration
[ Upstream commit e895f8e29119c8c966ea794af9e9100b10becb88 ]

When testing softirq based hrtimers on an ARM32 board, with high resolution
mode and NOHZ inactive, softirq based hrtimers fail to expire after being
moved away from an offline CPU:

CPU0				CPU1
				hrtimer_start(..., HRTIMER_MODE_SOFT);
cpu_down(CPU1)			...
				hrtimers_cpu_dying()
				  // Migrate timers to CPU0
				  smp_call_function_single(CPU0, returgger_next_event);
  retrigger_next_event()
    if (!highres && !nohz)
        return;

As retrigger_next_event() is a NOOP when both high resolution timers and
NOHZ are inactive CPU0's hrtimer_cpu_base::softirq_expires_next is not
updated and the migrated softirq timers never expire unless there is a
softirq based hrtimer queued on CPU0 later.

Fix this by removing the hrtimer_hres_active() and tick_nohz_active() check
in retrigger_next_event(), which enforces a full update of the CPU base.
As this is not a fast path the extra cost does not matter.

[ tglx: Massaged change log ]

Fixes: 5c0930ccaa ("hrtimers: Push pending hrtimers away from outgoing CPU earlier")
Co-developed-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250805081025.54235-1-wangxiongfeng2@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-09-19 16:29:59 +02:00
..
alarmtimer.c
clockevents.c
clocksource-wdtest.c
clocksource.c clocksource: Fix the CPUs' choice in the watchdog per CPU verification 2025-06-27 11:07:31 +01:00
hrtimer.c hrtimers: Unconditionally update target CPU base after offline timer migration 2025-09-19 16:29:59 +02:00
itimer.c
jiffies.c
Kconfig
Makefile
namespace.c
ntp_internal.h
ntp.c ntp: Remove invalid cast in time offset math 2024-12-14 19:54:26 +01:00
posix-clock.c
posix-cpu-timers.c posix-cpu-timers: fix race between handle_posix_cpu_timers() and posix_cpu_timer_del() 2025-06-27 11:07:24 +01:00
posix-stubs.c
posix-timers.c posix-timers: Add cond_resched() to posix_timer_add() search loop 2025-06-04 14:40:06 +02:00
posix-timers.h
sched_clock.c
test_udelay.c
tick-broadcast-hrtimer.c
tick-broadcast.c
tick-common.c
tick-internal.h
tick-legacy.c
tick-oneshot.c
tick-sched.c
tick-sched.h
time_test.c
time.c
timeconst.bc
timeconv.c
timecounter.c
timekeeping_debug.c
timekeeping_internal.h
timekeeping.c
timekeeping.h
timer_list.c timer_list: Don't use %pK through printk() 2025-06-04 14:40:07 +02:00
timer.c
vsyscall.c