linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] alarmtimer: Do not mess with an enqueued hrtimer
@ 2021-01-07  5:33 Li RongQing
  2021-02-05 17:07 ` Thomas Gleixner
  0 siblings, 1 reply; 2+ messages in thread
From: Li RongQing @ 2021-01-07  5:33 UTC (permalink / raw)
  To: linux-kernel, john.stultz, tglx

when an hrtimer is enqueued already, its expires should be not
changed, otherwise, this will corrupts the ordering of the
timerqueue RB tree, if other hrtimer is enqueued before this
hrtimer is restarted, whole RB tree is completely hosed

Fixes: 6cffe00f7d4e ("alarmtimer: Add functions for timerfd support")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 kernel/time/alarmtimer.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index f4ace1bf8382..3b34995ab8d2 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -388,8 +388,7 @@ void alarm_restart(struct alarm *alarm)
 	unsigned long flags;
 
 	spin_lock_irqsave(&base->lock, flags);
-	hrtimer_set_expires(&alarm->timer, alarm->node.expires);
-	hrtimer_restart(&alarm->timer);
+	hrtimer_start(&alarm->timer, alarm->node.expires, HRTIMER_MODE_ABS);
 	alarmtimer_enqueue(base, alarm);
 	spin_unlock_irqrestore(&base->lock, flags);
 }
-- 
2.17.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] alarmtimer: Do not mess with an enqueued hrtimer
  2021-01-07  5:33 [PATCH] alarmtimer: Do not mess with an enqueued hrtimer Li RongQing
@ 2021-02-05 17:07 ` Thomas Gleixner
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2021-02-05 17:07 UTC (permalink / raw)
  To: Li RongQing, linux-kernel, john.stultz

On Thu, Jan 07 2021 at 13:33, Li RongQing wrote:
> when an hrtimer is enqueued already, its expires should be not
> changed, otherwise, this will corrupts the ordering of the
> timerqueue RB tree, if other hrtimer is enqueued before this
> hrtimer is restarted, whole RB tree is completely hosed
>
> Fixes: 6cffe00f7d4e ("alarmtimer: Add functions for timerfd support")

I can't see what this fixes. alarm_restart() is only invoked when the
alarm has expired which means that the timer _cannot_ be queued.

Thanks,

        tglx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-05 17:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-07  5:33 [PATCH] alarmtimer: Do not mess with an enqueued hrtimer Li RongQing
2021-02-05 17:07 ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).