<feed xmlns='http://www.w3.org/2005/Atom'>
<title>g/linux.git/include/linux/hrtimer.h, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>https://bastion.nosebs.vip/g/linux.git/atom/include/linux/hrtimer.h?h=master</id>
<link rel='self' href='https://bastion.nosebs.vip/g/linux.git/atom/include/linux/hrtimer.h?h=master'/>
<link rel='alternate' type='text/html' href='https://bastion.nosebs.vip/g/linux.git/'/>
<updated>2026-11-01T17:19:12Z</updated>
<entry>
<title>Merge tag 'timers-urgent-2026-11-01' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip</title>
<updated>2026-11-01T17:19:12Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2026-11-01T17:19:12Z</published>
<link rel='alternate' type='text/html' href='https://bastion.nosebs.vip/g/linux.git/commit/?id=7a3d2740d1b1b5ed8d22e1e5430de3b5046cf6a9'/>
<id>urn:sha1:7a3d2740d1b1b5ed8d22e1e5430de3b5046cf6a9</id>
<content type='text'>
Pull timer fixes from Ingo Molnar:

 - Fix on-stack hrtimer cleanup in play_idle_precise(), and
   add the hrtimer_on_stack cleanup class to facilitate the fix
   (Hui Su)

 - Fix clock_getres() system call's handling of NULL output
   pointer in the !CONFIG_POSIX_TIMERS case (Hungyu Lin)

 - Fix get_cpu_itimer() to return TICK_NSEC when the sampled CPU time
   is exactly equal to the nonzero expiry (Hungyu Lin)

 - Fix do_timens_ktime_to_host() time offset subtraction underflow
   check (Hungyu Lin)

 - Report zero remaining time for disarmed SIGEV_NONE posix timers,
   and add a self-test to detect this bug in the future (Hung-Jui Lin)

 - Fix NOHZ 'full kick' handling bug that can cause missed
   tick updates (Peng Wang)

 - Fix field access bug in the vdso/gettimeofday code that works
   only by accident (Thomas Weißschuh)

 - Fix &amp; prevent immediate clocksource watchdog rerun after a delay
   (Karl Mehltretter)

* tag 'timers-urgent-2026-11-01' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  clocksource: Prevent immediate watchdog rerun after a delay
  vdso/gettimeofday: Correct the read of tz_minuteswest and tz_dsttime
  tick/nohz: Reevaluate the tick for kicks flushed outside hardirq
  selftests: timers: Add a test for disarmed SIGEV_NONE timers
  posix-timers: Report zero remaining time for disarmed SIGEV_NONE timers
  time/namespace: Fix overflow when converting absolute deadlines
  timers/itimer: Keep a nonzero value at CPU timer expiry
  posix-timers: Accept NULL clock_getres() output in stubs
  sched/idle: Use hrtimer cleanup class in play_idle_precise()
  hrtimer: Add cleanup class for on-stack timers
</content>
</entry>
<entry>
<title>hrtimer: Add cleanup class for on-stack timers</title>
<updated>2026-10-25T21:43:19Z</updated>
<author>
<name>Hui Su</name>
<email>sh_def@163.com</email>
</author>
<published>2026-10-16T01:09:43Z</published>
<link rel='alternate' type='text/html' href='https://bastion.nosebs.vip/g/linux.git/commit/?id=064bcd117e8a1a266bb92b840f63862999b7cb87'/>
<id>urn:sha1:064bcd117e8a1a266bb92b840f63862999b7cb87</id>
<content type='text'>
hrtimer_setup_on_stack() requires callers to destroy the timer before its
backing stack storage goes out of scope, but the setup interface does not
encode the required teardown pairing.

Add an hrtimer_on_stack cleanup class that pairs on-stack setup with
destroy_hrtimer_on_stack(). Document the existing setup API's lifetime
requirement.

The cleanup class provides debug-object teardown, not timer
cancellation. Callers must ensure that no hrtimer operation can still
access the timer before the scope ends; in particular, the timer must
no longer be queued and any running callback must have completed.

Signed-off-by: Hui Su &lt;sh_def@163.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Link: https://patch.msgid.link/5f48c32490d19f51035e4209174f9cfe44472c71.1792083743.git.sh_def@163.com
</content>
</entry>
<entry>
<title>hrtimer: Mark the hrtimer_sleeper structure's -&gt;task field __private</title>
<updated>2026-09-29T19:02:52Z</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@kernel.org</email>
</author>
<published>2026-09-19T00:14:27Z</published>
<link rel='alternate' type='text/html' href='https://bastion.nosebs.vip/g/linux.git/commit/?id=ad80926d780340ab08799cdb38be010e0dce8ec0'/>
<id>urn:sha1:ad80926d780340ab08799cdb38be010e0dce8ec0</id>
<content type='text'>
The hrtimer_sleeper structure's -&gt;task field is now used only by the
hrtimer_sleeper_task_get() and hrtimer_sleeper_task_set() functions,
and there is no reason for it to be directly accessed anywhere else.

Therefore, mark this field __private and use ACCESS_PRIVATE() in
hrtimer_sleeper_task_get() and hrtimer_sleeper_task_set().

Suggested-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Link: https://patch.msgid.link/20260919001428.3133388-11-paulmck@kernel.org
</content>
</entry>
<entry>
<title>hrtimer: Mark data-racy accesses to hrtimer_sleeper -&gt;task field</title>
<updated>2026-09-29T19:02:51Z</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@kernel.org</email>
</author>
<published>2026-09-19T00:14:17Z</published>
<link rel='alternate' type='text/html' href='https://bastion.nosebs.vip/g/linux.git/commit/?id=d166a1cd901615280be050929e5a5c9e4d300a62'/>
<id>urn:sha1:d166a1cd901615280be050929e5a5c9e4d300a62</id>
<content type='text'>
The hrtimer_sleeper structure's -&gt;task field is used as a flag to indicate
that the associated hrtimer has expired.  This means that the hrtimer
handler can be storing to this field while other code is loading from it
to check for expiry.  Note that additional races appear for hrtimers that
can be restarted, which could be argued to be a user error.  However,
that is no reason to let the compiler introduce additional confusion.

Therefore, mark data-racy accesses to the hrtimer_sleeper -&gt;task field
using READ_ONCE() (using a new hrtimer_sleeper_task_get() access function)
and WRITE_ONCE() (using a new hrtimer_sleeper_task_set() access function).

KCSAN located this issue.

Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Reviewed-by: Dmitry Ilvokhin &lt;d@ilvokhin.com&gt;
Link: https://patch.msgid.link/20260919001428.3133388-1-paulmck@kernel.org
</content>
</entry>
<entry>
<title>hrtimer: Remove inclusion of hrtimer_bases.h remove from hrtimer.h</title>
<updated>2026-07-07T21:43:45Z</updated>
<author>
<name>Thomas Weißschuh (Schneider Electric)</name>
<email>thomas.weissschuh@linutronix.de</email>
</author>
<published>2026-07-02T09:42:05Z</published>
<link rel='alternate' type='text/html' href='https://bastion.nosebs.vip/g/linux.git/commit/?id=faef65e45a2a03f1fa32bc4e55c11d79f6aaae6f'/>
<id>urn:sha1:faef65e45a2a03f1fa32bc4e55c11d79f6aaae6f</id>
<content type='text'>
hrtimer.h is used all over the kernel. Any change to hrtimer_bases.h
effectively triggers a full rebuild.

As all logical dependencies from hrtimer.h to hrtimer_bases.h have been
removed, the inclusion is now unncessary. Remove it.

Signed-off-by: Thomas Weißschuh (Schneider Electric) &lt;thomas.weissschuh@linutronix.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Link: https://patch.msgid.link/20260702-hrtimer-header-dependencies-v1-8-c50b19bda473@linutronix.de
</content>
</entry>
<entry>
<title>hrtimer: Move hrtimer_update_function() to hrtimer.c</title>
<updated>2026-07-07T21:43:44Z</updated>
<author>
<name>Thomas Weißschuh (Schneider Electric)</name>
<email>thomas.weissschuh@linutronix.de</email>
</author>
<published>2026-07-02T09:42:00Z</published>
<link rel='alternate' type='text/html' href='https://bastion.nosebs.vip/g/linux.git/commit/?id=a116c7582d7f7701736801a47e3432eb7cabd674'/>
<id>urn:sha1:a116c7582d7f7701736801a47e3432eb7cabd674</id>
<content type='text'>
The usage of the hrtimer base forces hrtimer.h to also expose the base
structure definitions.

Move the function to hrtimer.c to avoid this.

Signed-off-by: Thomas Weißschuh (Schneider Electric) &lt;thomas.weissschuh@linutronix.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Link: https://patch.msgid.link/20260702-hrtimer-header-dependencies-v1-3-c50b19bda473@linutronix.de
</content>
</entry>
<entry>
<title>hrtimer: Move hrtimer_callback_running() to hrtimer_bases.h</title>
<updated>2026-07-07T21:43:44Z</updated>
<author>
<name>Thomas Weißschuh (Schneider Electric)</name>
<email>thomas.weissschuh@linutronix.de</email>
</author>
<published>2026-07-02T09:41:59Z</published>
<link rel='alternate' type='text/html' href='https://bastion.nosebs.vip/g/linux.git/commit/?id=d3dc7fabd4c4a3baaa7e7bfa84558fedad699580'/>
<id>urn:sha1:d3dc7fabd4c4a3baaa7e7bfa84558fedad699580</id>
<content type='text'>
The usage of the hrtimer base introduces a dependency on the timer base
structure definitions from the widely-used hrtimer.h.

Move the helper to hrtimer_bases.h to trim this dependency.

Also adapt the two only callers to now include hrtimer_bases.h.

Signed-off-by: Thomas Weißschuh (Schneider Electric) &lt;thomas.weissschuh@linutronix.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Link: https://patch.msgid.link/20260702-hrtimer-header-dependencies-v1-2-c50b19bda473@linutronix.de
</content>
</entry>
<entry>
<title>hrtimer: Rename hrtimer_defs.h to hrtimer_bases.h</title>
<updated>2026-07-07T21:43:44Z</updated>
<author>
<name>Thomas Weißschuh (Schneider Electric)</name>
<email>thomas.weissschuh@linutronix.de</email>
</author>
<published>2026-07-02T09:41:58Z</published>
<link rel='alternate' type='text/html' href='https://bastion.nosebs.vip/g/linux.git/commit/?id=03b5d4c2798234d9ee3c4a719a2fefe785a6aec4'/>
<id>urn:sha1:03b5d4c2798234d9ee3c4a719a2fefe785a6aec4</id>
<content type='text'>
This header was originally added for #defines and was later extended
with the hrtimer base structures. All the #defines have been removed
in the meantime, so the naming is off now.

Rename the header to fit its contents more.

This will also make the upcoming addition of some functions nicer.

Signed-off-by: Thomas Weißschuh (Schneider Electric) &lt;thomas.weissschuh@linutronix.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Link: https://patch.msgid.link/20260702-hrtimer-header-dependencies-v1-1-c50b19bda473@linutronix.de
</content>
</entry>
<entry>
<title>hrtimer: Return ktime_t from hrtimer_get_next_event()/hrtimer_next_event_without()</title>
<updated>2026-05-06T06:33:09Z</updated>
<author>
<name>Thomas Weißschuh</name>
<email>thomas.weissschuh@linutronix.de</email>
</author>
<published>2026-05-04T06:56:10Z</published>
<link rel='alternate' type='text/html' href='https://bastion.nosebs.vip/g/linux.git/commit/?id=3af1f49f415dcac8c0df8bfc593df0371c219876'/>
<id>urn:sha1:3af1f49f415dcac8c0df8bfc593df0371c219876</id>
<content type='text'>
These functions really work in terms of ktime_t and not u64.

Change their return types and adapt the callers.

Signed-off-by: Thomas Weißschuh &lt;thomas.weissschuh@linutronix.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Link: https://patch.msgid.link/20260504-hrtimer-next_event-v2-1-7a5d0550b42f@linutronix.de
</content>
</entry>
<entry>
<title>hrtimer: Provide hrtimer_start_range_ns_user()</title>
<updated>2026-05-01T19:36:11Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@kernel.org</email>
</author>
<published>2026-04-08T11:53:46Z</published>
<link rel='alternate' type='text/html' href='https://bastion.nosebs.vip/g/linux.git/commit/?id=bd5956166d20adbde3af0f6f265dc2f0ce5f4df9'/>
<id>urn:sha1:bd5956166d20adbde3af0f6f265dc2f0ce5f4df9</id>
<content type='text'>
Calvin reported an odd NMI watchdog lockup which claims that the CPU locked
up in user space. He provided a reproducer, which set's up a timerfd based
timer and then rearms it in a loop with an absolute expiry time of 1ns.

As the expiry time is in the past, the timer ends up as the first expiring
timer in the per CPU hrtimer base and the clockevent device is programmed
with the minimum delta value. If the machine is fast enough, this ends up
in a endless loop of programming the delta value to the minimum value
defined by the clock event device, before the timer interrupt can fire,
which starves the interrupt and consequently triggers the lockup detector
because the hrtimer callback of the lockup mechanism is never invoked.

The clockevents code already has a last resort mechanism to prevent that,
but it's sensible to catch such issues before trying to reprogram the clock
event device.

Provide a variant of hrtimer_start_range_ns(), which sanity checks the
timer after queueing it. It does not so before because the timer might be
armed and therefore needs to be dequeued. also we optimize for the latest
possible point to check, so that the clock event prevention is avoided as
much as possible.

If the timer is already expired _before_ the clock event is reprogrammed,
remove the timer from the queue and signal to the caller that the operation
failed by returning false.

That allows the caller to take immediate action without going through the
loops and hoops of the hrtimer interrupt.

The queueing code can't invoke the timer callback as the caller might hold
a lock which is taken in the callback.

Add a tracepoint which allows to analyze the expired at start situation.

Reported-by: Calvin Owens &lt;calvin@wbinvd.org&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@kernel.org&gt;
Tested-by: Calvin Owens &lt;calvin@wbinvd.org&gt;
Reviewed-by: Frederic Weisbecker &lt;frederic@kernel.org&gt;
Acked-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://patch.msgid.link/20260408114951.995031895@kernel.org
</content>
</entry>
</feed>
