rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] rust: time: Add clock read support
@ 2024-03-24 22:33 Boqun Feng
  2024-03-24 22:33 ` [PATCH 1/5] rust: time: doc: Add missing C header link to jiffies Boqun Feng
                   ` (4 more replies)
  0 siblings, 5 replies; 22+ messages in thread
From: Boqun Feng @ 2024-03-24 22:33 UTC (permalink / raw)
  To: rust-for-linux, linux-kernel, Thomas Gleixner
  Cc: Alice Ryhl, Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho,
	Boqun Feng, Gary Guo, Björn Roy Baron, benno.lossin,
	Andreas Hindborg, John Stultz, Stephen Boyd, Valentin Obst

Hi Thomas,

This is an updated version of:

	https://lore.kernel.org/rust-for-linux/Zf2kio8NYG5DEgyY@tardis/	

where I'm trying to provide the same functionality of Alice's patch:

	https://lore.kernel.org/rust-for-linux/20240322-rust-ktime_ms_delta-v2-1-d98de1f7c282@google.com/

along with the lesson we learned from the previous discussion:

	https://lore.kernel.org/rust-for-linux/20230221-gpu-up-time-v1-1-bf8fe74b7f55@asahilina.net/
	https://lore.kernel.org/rust-for-linux/20230714-rust-time-v2-1-f5aed84218c4@asahilina.net/

There are three important types or traits (the design was mostly brought
from previous patches):

* Instant type: it's a generic type for timestamps, whose backend is
  just ktime_t, but it has a generic type to differentiate clocks.

* Clock trait: to read a clock, one must implement the `now` function,
  in this series, only CLOCK_MONOTONIC support is added.

* Duration type: it's a signed 64 bit value which represents the
  timedelta, I've considered making it unsigned, but I want the
  following code:

  	d = ts2 - ts1;
	ts = ts3 + d;

  to work even when ts2 < ts1, but I'm also OK to define it as an
  unsigned.

Let me know how you think about this.

Regards,
Boqun

Alice Ryhl (1):
  rust: time: Introduce Duration type

Boqun Feng (4):
  rust: time: doc: Add missing C header link to jiffies
  rust: time: Introduce clock reading framework
  rust: time: Support reading CLOCK_MONOTONIC
  rust: time: Add Instant::elapsed() for monotonic clocks

 rust/kernel/time.rs | 139 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 139 insertions(+)

-- 
2.44.0


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

end of thread, other threads:[~2024-03-27 17:50 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-24 22:33 [PATCH 0/5] rust: time: Add clock read support Boqun Feng
2024-03-24 22:33 ` [PATCH 1/5] rust: time: doc: Add missing C header link to jiffies Boqun Feng
2024-03-26 16:44   ` Benno Lossin
2024-03-24 22:33 ` [PATCH 2/5] rust: time: Introduce Duration type Boqun Feng
2024-03-26 16:50   ` Benno Lossin
2024-03-26 17:11     ` Boqun Feng
2024-03-26 17:17       ` Boqun Feng
2024-03-27 11:18         ` Benno Lossin
2024-03-24 22:33 ` [PATCH 3/5] rust: time: Introduce clock reading framework Boqun Feng
2024-03-26 17:00   ` Benno Lossin
2024-03-26 19:19     ` Boqun Feng
2024-03-27 12:50       ` Benno Lossin
2024-03-27 17:49         ` Boqun Feng
2024-03-24 22:33 ` [PATCH 4/5] rust: time: Support reading CLOCK_MONOTONIC Boqun Feng
2024-03-26 17:03   ` Benno Lossin
2024-03-26 19:21     ` Boqun Feng
2024-03-24 22:33 ` [PATCH 5/5] rust: time: Add Instant::elapsed() for monotonic clocks Boqun Feng
2024-03-26 17:13   ` Benno Lossin
2024-03-26 18:00     ` Boqun Feng
2024-03-26 18:04       ` Boqun Feng
2024-03-27  1:09       ` Boqun Feng
2024-03-27 11:31         ` Benno Lossin

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).