mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Avi Weiss <thnkslprpt@gmail.com>
To: jstultz@google.com, tglx@kernel.org
Cc: sboyd@kernel.org, mlichvar@redhat.com,
	linux-kernel@vger.kernel.org, Avi Weiss <thnkslprpt@gmail.com>
Subject: [PATCH] alarmtimer: Preserve rearmed alarms during callback expiry
Date: Sun,  1 Nov 2026 18:39:55 +0200	[thread overview]
Message-ID: <20261101163954.767646-2-thnkslprpt@gmail.com> (raw)

An alarm can be rearmed while its previous hrtimer callback is still
running. alarmtimer_fired() then dequeues the newly armed alarm, so
alarmtimer_suspend() no longer sees the wakeup even though the hrtimer
remains queued.

Only dequeue the alarm if the hrtimer is no longer queued.

Fixes: dae373be9fec ("alarmtimer: Use hrtimer per-alarm instead of per-base")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
---
 kernel/time/alarmtimer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index ea5be5870e515..bf77af5e32c22 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -189,7 +189,8 @@ static enum hrtimer_restart alarmtimer_fired(struct hrtimer *timer)
 	struct alarm_base *base = &alarm_bases[alarm->type];
 
 	scoped_guard(spinlock_irqsave, &base->lock)
-		alarmtimer_dequeue(base, alarm);
+		if (!hrtimer_is_queued(timer))
+			alarmtimer_dequeue(base, alarm);
 
 	if (alarm->function)
 		alarm->function(alarm, base->get_ktime());

base-commit: cbbddb6b08cc9900a87cccaa9b22bbe06aa4f50a
-- 
2.43.0


                 reply	other threads:[~2026-11-01 16:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261101163954.767646-2-thnkslprpt@gmail.com \
    --to=thnkslprpt@gmail.com \
    --cc=jstultz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mlichvar@redhat.com \
    --cc=sboyd@kernel.org \
    --cc=tglx@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®