From: Franklin-Qi <yusq77@gmail.com>
To: Andreas Hindborg <a.hindborg@kernel.org>,
Lyude Paul <lyude@redhat.com>, Miguel Ojeda <ojeda@kernel.org>,
Alice Ryhl <aliceryhl@google.com>
Cc: FUJITA Tomonori <fujita.tomonori@gmail.com>,
Boqun Feng <boqun@kernel.org>, Danilo Krummrich <dakr@kernel.org>,
rust-for-linux@vger.kernel.org, Thomas Gleixner <tglx@kernel.org>,
John Stultz <jstultz@google.com>, Stephen Boyd <sboyd@kernel.org>,
Frederic Weisbecker <frederic@kernel.org>,
Anna-Maria Behnsen <anna-maria@linutronix.de>,
Georgios Androutsopoulos <georgeandrout13@gmail.com>,
stable@vger.kernel.org, Franklin-Qi <yusq77@gmail.com>
Subject: [PATCH v4 0/2] rust: time: keep Instant invariant when adding/subtracting Delta
Date: Fri, 4 Dec 2026 16:34:06 +0800 [thread overview]
Message-ID: <20261204083408.229840-1-yusq77@gmail.com> (raw)
Hi Andreas, Miguel,
This is v4 of the Instant + Delta invariant series.
v3: https://lore.kernel.org/rust-for-linux/20261203092101.63850-1-yusq77@gmail.com/
v2: https://lore.kernel.org/rust-for-linux/20261202080227.898512-1-yusq77@gmail.com/
Changes in v4:
- Address Miguel's review of v3 2/2: restore Instant::from_ktime() with
debug_assert!(ktime >= 0), and build the KUnit Instant fixtures through
that constructor instead of writing the private fields directly.
- Add static_assert!(bindings::ktime_t::MAX == i64::MAX) in from_ktime().
bindings::KTIME_MAX is not exported by bindgen today; ktime_t is s64 and
KTIME_MAX is documented as i64::MAX, so this is the same upper-bound
guarantee Miguel asked for.
- from_ktime() is only used by the time KUnit tests at the moment, so it
carries expect(dead_code) when CONFIG_RUST_TIME_KUNIT_TEST is off (it was
previously removed after HrTimer::expires() went away).
1/2 is unchanged from v3. 2/2 picks up the constructor change above.
Tested:
- CONFIG_RUST_OVERFLOW_CHECKS=n, CONFIG_RUST_TIME_KUNIT_TEST=y:
rust_kernel_time: pass:12 fail:0 (includes the Instant clamp cases; one
expected "clamping" warning on the above-KTIME_MAX path).
Franklin-Qi
Franklin-Qi (2):
rust: time: keep Instant invariant when adding/subtracting Delta
rust: time: add KUnit tests for Instant Delta clamping
rust/kernel/time.rs | 176 +++++++++++++++++++++++++++++++++++++++-----
1 file changed, 156 insertions(+), 20 deletions(-)
--
2.55.0
next reply other threads:[~2026-12-04 8:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 8:34 Franklin-Qi [this message]
2026-12-04 9:28 ` [PATCH v4 1/2] rust: time: keep Instant invariant when adding/subtracting Delta Franklin-Qi
2026-12-04 10:07 ` FUJITA Tomonori
2026-12-04 9:29 ` [PATCH v4 2/2] rust: time: add KUnit tests for Instant Delta clamping Franklin-Qi
2026-12-04 10:38 ` FUJITA Tomonori
2026-12-05 9:55 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261204083408.229840-1-yusq77@gmail.com \
--to=yusq77@gmail.com \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=anna-maria@linutronix.de \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=frederic@kernel.org \
--cc=fujita.tomonori@gmail.com \
--cc=georgeandrout13@gmail.com \
--cc=jstultz@google.com \
--cc=lyude@redhat.com \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=sboyd@kernel.org \
--cc=stable@vger.kernel.org \
--cc=tglx@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.