[PATCH v1 0/2] hrtimer: Add hrtimer_forward_safe_from_callback()
From: FUJITA Tomonori
Date: Sun Nov 01 2026 - 18:33:56 EST
From: FUJITA Tomonori <fujita.tomonori@xxxxxxxxx>
Safe Rust code can arm a timer while its callback is running, so the
Rust abstraction cannot offer hrtimer_forward() from the callback as a
safe API.
Thomas suggested a helper that does the check and the update with the
base lock held [1]. Patch 1 adds it. Patch 2 makes the Rust callback
context use it.
The helper is not Rust specific. As Thomas noted, it can be used for
i915_pmu too. null_blk can use it as well. I can send those
conversions after the helper is merged.
[1] https://lore.kernel.org/all/877bk3ixp5.ffs@fw13/
FUJITA Tomonori (2):
hrtimer: Add hrtimer_forward_safe_from_callback()
rust: hrtimer: Use hrtimer_forward_safe_from_callback()
include/linux/hrtimer.h | 4 ++++
kernel/time/hrtimer.c | 30 ++++++++++++++++++++++++++++++
rust/kernel/time/hrtimer.rs | 25 ++++++++++++++++++-------
3 files changed, 52 insertions(+), 7 deletions(-)
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
--
2.43.0