git: b11fba41265a - main - timerfd: Wake up on discontinuous jump
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 20 Mar 2026 07:16:17 UTC
The branch main has been updated by jfree:
URL: https://cgit.FreeBSD.org/src/commit/?id=b11fba41265ae132acfb05587a6dbf60334d3279
commit b11fba41265ae132acfb05587a6dbf60334d3279
Author: Jake Freeland <jfree@FreeBSD.org>
AuthorDate: 2026-03-20 06:33:54 +0000
Commit: Jake Freeland <jfree@FreeBSD.org>
CommitDate: 2026-03-20 07:15:08 +0000
timerfd: Wake up on discontinuous jump
If a discontinous realtime clock change occurs and sets any TFD_JUMPED
bits on the timerfd, then wake up waiting readers. This fixes failures
from the timerfd_root__clock_change_notification test case.
MFC after: 2 weeks
---
sys/kern/sys_timerfd.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/sys/kern/sys_timerfd.c b/sys/kern/sys_timerfd.c
index f2a66e21cd63..e4d00f224505 100644
--- a/sys/kern/sys_timerfd.c
+++ b/sys/kern/sys_timerfd.c
@@ -118,6 +118,14 @@ timerfd_getboottime(struct timespec *ts)
TIMEVAL_TO_TIMESPEC(&tv, ts);
}
+static void
+timerfd_wakeup(struct timerfd *tfd)
+{
+ wakeup(&tfd->tfd_count);
+ selwakeup(&tfd->tfd_sel);
+ KNOTE_LOCKED(&tfd->tfd_sel.si_note, 0);
+}
+
/*
* Call when a discontinuous jump has occured in CLOCK_REALTIME and
* update timerfd's cached boottime. A jump can be triggered using
@@ -172,6 +180,8 @@ timerfd_jumped(void)
}
tfd->tfd_boottim = boottime;
+ if ((tfd->tfd_jumped & TFD_JUMPED) != 0)
+ timerfd_wakeup(tfd);
mtx_unlock(&tfd->tfd_lock);
}
mtx_unlock(&timerfd_list_lock);
@@ -418,9 +428,7 @@ timerfd_expire(void *arg)
timespecclear(&tfd->tfd_time.it_value);
}
- wakeup(&tfd->tfd_count);
- selwakeup(&tfd->tfd_sel);
- KNOTE_LOCKED(&tfd->tfd_sel.si_note, 0);
+ timerfd_wakeup(tfd);
}
int