Date: Fri, 03 Apr 2026 15:26:17 +0000 From: Jake Freeland <jfree@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 6a5176a100fb - stable/15 - timerfd: Wake up on discontinuous jump Message-ID: <69cfdc19.3e66c.c4b1abe@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by jfree: URL: https://cgit.FreeBSD.org/src/commit/?id=6a5176a100fbb19c48eabfc48ab626320606fcfb commit 6a5176a100fbb19c48eabfc48ab626320606fcfb Author: Jake Freeland <jfree@FreeBSD.org> AuthorDate: 2026-03-20 06:33:54 +0000 Commit: Jake Freeland <jfree@FreeBSD.org> CommitDate: 2026-04-03 15:25:36 +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 (cherry picked from commit b11fba41265ae132acfb05587a6dbf60334d3279) --- 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); } inthome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69cfdc19.3e66c.c4b1abe>
