rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] rust: time: Introduce typed clock sources and generalize Instant
@ 2025-06-09  1:04 FUJITA Tomonori
  2025-06-09  1:04 ` [PATCH v3 1/3] rust: time: Replace ClockId enum with ClockSource trait FUJITA Tomonori
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: FUJITA Tomonori @ 2025-06-09  1:04 UTC (permalink / raw)
  To: a.hindborg, alex.gaynor, ojeda
  Cc: aliceryhl, anna-maria, bjorn3_gh, boqun.feng, dakr, frederic,
	gary, jstultz, linux-kernel, lossin, lyude, rust-for-linux, sboyd,
	tglx, tmgross

This patch series introduces a type-safe abstraction over clock
sources. The goal is to remove the need for runtime clock selection
(via ClockId) and instead leverage Rust's type system to statically
associate the Instant type with a specific clock.

This approach enables compile-time enforcement of clock correctness
across the APIs of Instant type.

v3:
- rebased on 6.16-rc1
v2: https://lore.kernel.org/rust-for-linux/20250504042436.237756-1-fujita.tomonori@gmail.com/
- removed most of changes to hrtimer code 
v1: https://lore.kernel.org/rust-for-linux/20250413105629.162349-1-fujita.tomonori@gmail.com/

FUJITA Tomonori (3):
  rust: time: Replace ClockId enum with ClockSource trait
  rust: time: Make Instant generic over ClockSource
  rust: time: Add ktime_get() to ClockSource trait

 rust/helpers/helpers.c      |   1 +
 rust/helpers/time.c         |  18 ++++
 rust/kernel/time.rs         | 201 ++++++++++++++++++++++--------------
 rust/kernel/time/hrtimer.rs |   6 +-
 4 files changed, 148 insertions(+), 78 deletions(-)
 create mode 100644 rust/helpers/time.c


base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
-- 
2.43.0


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

end of thread, other threads:[~2025-06-10 10:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-09  1:04 [PATCH v3 0/3] rust: time: Introduce typed clock sources and generalize Instant FUJITA Tomonori
2025-06-09  1:04 ` [PATCH v3 1/3] rust: time: Replace ClockId enum with ClockSource trait FUJITA Tomonori
2025-06-09  1:04 ` [PATCH v3 2/3] rust: time: Make Instant generic over ClockSource FUJITA Tomonori
2025-06-09  1:04 ` [PATCH v3 3/3] rust: time: Add ktime_get() to ClockSource trait FUJITA Tomonori
2025-06-10  8:01   ` Andreas Hindborg
2025-06-10  8:15     ` FUJITA Tomonori
2025-06-10  9:34       ` Andreas Hindborg
2025-06-09  2:55 ` [PATCH v3 0/3] rust: time: Introduce typed clock sources and generalize Instant Boqun Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).