From 95b8c5356384cf3dd8f41e1b5b999d3cfbcc3468 Mon Sep 17 00:00:00 2001 From: Jens Wiklander Date: Thu, 2 May 2024 15:41:31 +0200 Subject: [PATCH] core: callout: disable obsolete timeouts In callout_service_cb() when a timeout interrupt is received there's a check to see if this is the last scheduled CPU. If not the interrupt is ignored, but not disabled causing it to trigger again and again. So fix this by disabling the timeout too. Fixes: cf707bd0d695 ("core: add callout service") Signed-off-by: Jens Wiklander Acked-by: Jerome Forissier --- core/kernel/callout.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/kernel/callout.c b/core/kernel/callout.c index 6a1b0068418..54d6a8c2f6c 100644 --- a/core/kernel/callout.c +++ b/core/kernel/callout.c @@ -158,10 +158,13 @@ void callout_service_cb(void) * schedule_next_timeout() saves the core it was last * called on. If there's a mismatch here it means that * another core has been scheduled for the next callout, so - * there's no work to be done for this core. + * there's no work to be done for this core and we can + * disable the timeout on this CPU. */ cpu_spin_lock(&callout_sched_lock); do_callout = (get_core_pos() == callout_sched_core); + if (!do_callout) + desc->disable_timeout(desc); cpu_spin_unlock(&callout_sched_lock); if (!do_callout) return;