All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] rust: use Delta instead of raw jiffies for timeouts and delays
@ 2026-07-12 23:52 FUJITA Tomonori
  2026-07-12 23:52 ` [PATCH v2 1/4] rust: time: add jiffies conversion helpers to Delta FUJITA Tomonori
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: FUJITA Tomonori @ 2026-07-12 23:52 UTC (permalink / raw)
  To: a.hindborg, aliceryhl, arve, boqun, brauner, cmllamas, gary,
	gregkh, ojeda, tkjos
  Cc: acourbot, anna-maria, bjorn3_gh, dakr, daniel.almeida, frederic,
	jstultz, lossin, lyude, sboyd, tamird, tglx, tmgross, work,
	rust-for-linux, FUJITA Tomonori

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

CondVar::wait_interruptible_timeout() and Queue::enqueue_delayed() use
a raw jiffies count (a plain c_ulong alias with no type
safety). Callers have to know on their own that the value meant
jiffies and convert to/from it themselves, which is easy to get wrong
(e.g. passing a millisecond value where a jiffies value is expected).

Both APIs just take a span of time so, they can use the Delta type
instead. Jiffies are just another time unit, like milliseconds or
nanoseconds.

This series adds jiffies conversion helpers to Delta, switches
CondVar and Queue to use Delta instead of raw jiffies (updating
binder's ioctl_freeze(), the only caller of
wait_interruptible_timeout()), and then removes the now-unused
Jiffies and Msecs type aliases.

v2:
- Fix potential overflow in from_jiffies()
- Fix inflating bug in as_jiffies_ceil()
- Add a patch to convert enqueue_delayed()
- Add a patch to remove Jiffies/Msecs aliases
v1: https://lore.kernel.org/rust-for-linux/20260704132558.2253275-1-tomo@aliasing.net/

FUJITA Tomonori (4):
  rust: time: add jiffies conversion helpers to Delta
  rust: sync: use Delta for CondVar timeout API
  rust: workqueue: use Delta for enqueue_delayed's delay parameter
  rust: time: remove unused Jiffies/Msecs helpers

 drivers/android/binder/process.rs | 12 ++++-----
 rust/kernel/sync/condvar.rs       | 20 ++++++++------
 rust/kernel/time.rs               | 44 +++++++++++++++++++++----------
 rust/kernel/workqueue.rs          |  6 ++---
 4 files changed, 51 insertions(+), 31 deletions(-)


base-commit: 0e35b9b6ec0ffcc5e23cbdec09f5c622ad532b53
-- 
2.43.0


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

end of thread, other threads:[~2026-07-13 12:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-12 23:52 [PATCH v2 0/4] rust: use Delta instead of raw jiffies for timeouts and delays FUJITA Tomonori
2026-07-12 23:52 ` [PATCH v2 1/4] rust: time: add jiffies conversion helpers to Delta FUJITA Tomonori
2026-07-12 23:52 ` [PATCH v2 2/4] rust: sync: use Delta for CondVar timeout API FUJITA Tomonori
2026-07-12 23:52 ` [PATCH v2 3/4] rust: workqueue: use Delta for enqueue_delayed's delay parameter FUJITA Tomonori
2026-07-13  8:59   ` Alice Ryhl
2026-07-13  9:07     ` Onur Özkan
2026-07-13  9:40       ` FUJITA Tomonori
2026-07-13 11:55         ` Gary Guo
2026-07-13 12:17           ` FUJITA Tomonori
2026-07-12 23:52 ` [PATCH v2 4/4] rust: time: remove unused Jiffies/Msecs helpers 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.