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

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.

This patchset can be applied on top of the division fix for 32-bit
architectures:

https://lore.kernel.org/lkml/20250502004524.230553-1-fujita.tomonori@gmail.com/

Most of the changes to the hrtimer code that were included in v1 have
been removed, as it does not use `Instant` yet. I plan to convert
hrtimer to use `Instant` and `Delta` in a separate patchset.

v2:
- 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/time.c         |  16 +++
 rust/kernel/time.rs         | 201 ++++++++++++++++++++++--------------
 rust/kernel/time/hrtimer.rs |   6 +-
 3 files changed, 145 insertions(+), 78 deletions(-)


base-commit: adf04b7cc66574ec2a43b540046975dbe73e0382
-- 
2.43.0


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

end of thread, other threads:[~2025-05-30 11:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-04  4:24 [PATCH v2 0/3] rust: time: Introduce typed clock sources and generalize Instant FUJITA Tomonori
2025-05-04  4:24 ` [PATCH v2 1/3] rust: time: Replace ClockId enum with ClockSource trait FUJITA Tomonori
2025-05-04  4:24 ` [PATCH v2 2/3] rust: time: Make Instant generic over ClockSource FUJITA Tomonori
2025-05-30 11:42   ` Andreas Hindborg
2025-05-04  4:24 ` [PATCH v2 3/3] rust: time: Add ktime_get() to ClockSource trait FUJITA Tomonori

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.