From: Franklin-Qi <yusq77@gmail.com>
To: FUJITA Tomonori <tomo@flapping.org>
Cc: Andreas Hindborg <a.hindborg@kernel.org>,
Lyude Paul <lyude@redhat.com>, Miguel Ojeda <ojeda@kernel.org>,
Alice Ryhl <aliceryhl@google.com>,
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: Re: [PATCH v2] rust: time: keep Instant invariant when adding/subtracting Delta
Date: Thu, 3 Dec 2026 17:20:11 +0800 [thread overview]
Message-ID: <20261203092011.63792-1-yusq77@gmail.com> (raw)
In-Reply-To: <20261202.202702.1454196968303324239.tomo@flapping.org>
Hi Tomonori,
Thanks for the review.
> The doc says a warning is printed when the result is clamped, but
> saturating_add() and saturating_sub() saturate to KTIME_MAX without a
> warning. Only a negative result prints the warning.
>
> With overflow checks, both cases panic. So without overflow checks, I
> think both cases should print the warning.
Agreed. In v3, without CONFIG_RUST_OVERFLOW_CHECKS, both a negative result
and a saturation at KTIME_MAX print the warning once (by comparing the
saturating and wrapping results before clamping into 0..=KTIME_MAX).
> This conflicts with timekeeping-next. Instant has changed there.
v3 is rebased onto timekeeping-next and updated for Instant<C, Nsec>.
I am also sending a second patch with KUnit tests for the clamping paths,
as Andreas and Miguel suggested. I verified rust_kernel_time with
CONFIG_RUST_OVERFLOW_CHECKS=n; all Instant clamp tests passed.
Best regards,
Franklin
next prev parent reply other threads:[~2026-12-03 9:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 8:02 [PATCH v2] rust: time: keep Instant invariant when adding/subtracting Delta Franklin-Qi
2026-12-02 11:27 ` FUJITA Tomonori
2026-12-03 9:20 ` Franklin-Qi [this message]
2026-12-03 9:20 ` [PATCH v3 0/2] " Franklin-Qi
2026-12-03 9:21 ` [PATCH v3 1/2] " Franklin-Qi
2026-12-03 9:21 ` [PATCH v3 2/2] rust: time: add KUnit tests for Instant Delta clamping Franklin-Qi
2026-12-03 12:34 ` Miguel Ojeda
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=20261203092011.63792-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 \
--cc=tomo@flapping.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.