Rust for Linux List
 help / color / mirror / Atom feed
* [PATCH v1 0/2] hrtimer: Add hrtimer_forward_safe_from_callback()
@ 2026-11-01 23:28 FUJITA Tomonori
  2026-11-01 23:28 ` [PATCH v1 1/2] " FUJITA Tomonori
  2026-11-01 23:28 ` [PATCH v1 2/2] rust: hrtimer: Use hrtimer_forward_safe_from_callback() FUJITA Tomonori
  0 siblings, 2 replies; 4+ messages in thread
From: FUJITA Tomonori @ 2026-11-01 23:28 UTC (permalink / raw)
  To: a.hindborg, anna-maria, frederic, gary, ojeda, tglx
  Cc: acourbot, aliceryhl, bjorn3_gh, boqun, dakr, daniel.almeida,
	jstultz, lossin, lyude, sboyd, tamird, tmgross, work,
	linux-kernel, rust-for-linux, FUJITA Tomonori

From: FUJITA Tomonori <fujita.tomonori@gmail.com>

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


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

end of thread, other threads:[~2026-11-02 14:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-01 23:28 [PATCH v1 0/2] hrtimer: Add hrtimer_forward_safe_from_callback() FUJITA Tomonori
2026-11-01 23:28 ` [PATCH v1 1/2] " FUJITA Tomonori
2026-11-01 23:28 ` [PATCH v1 2/2] rust: hrtimer: Use hrtimer_forward_safe_from_callback() FUJITA Tomonori
2026-11-02 14:31   ` Andreas Hindborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox