From: Andreas Hindborg <a.hindborg@kernel.org>
To: "FUJITA Tomonori" <fujita.tomonori@gmail.com>
Cc: <aliceryhl@google.com>, <alex.gaynor@gmail.com>,
<ojeda@kernel.org>, <boqun.feng@gmail.com>,
<anna-maria@linutronix.de>, <bjorn3_gh@protonmail.com>,
<dakr@kernel.org>, <frederic@kernel.org>, <gary@garyguo.net>,
<jstultz@google.com>, <linux-kernel@vger.kernel.org>,
<lossin@kernel.org>, <lyude@redhat.com>,
<rust-for-linux@vger.kernel.org>, <sboyd@kernel.org>,
<tglx@linutronix.de>, <tmgross@umich.edu>
Subject: Re: [PATCH v1] rust: time: make ClockSource unsafe trait
Date: Wed, 02 Jul 2025 11:17:00 +0200 [thread overview]
Message-ID: <87sejfuf3n.fsf@kernel.org> (raw)
In-Reply-To: <20250701.083940.2222161064880631447.fujita.tomonori@gmail.com> (FUJITA Tomonori's message of "Tue, 01 Jul 2025 08:39:40 +0900")
"FUJITA Tomonori" <fujita.tomonori@gmail.com> writes:
> On Mon, 30 Jun 2025 15:33:31 +0200
> Alice Ryhl <aliceryhl@google.com> wrote:
>
>> On Mon, Jun 30, 2025 at 3:10 PM FUJITA Tomonori
>> <fujita.tomonori@gmail.com> wrote:
>>>
>>> Mark the ClockSource trait as unsafe and document its safety
>>> requirements. Specifically, implementers must guarantee that their
>>> `ktime_get()` implementation returns a value in the inclusive range
>>> [0, KTIME_MAX].
>>>
>>> Update all existing implementations to use `unsafe impl` with
>>> corresponding safety comments.
>>>
>>> Note that there could be potential users of a customized clock source [1]
>>> so we don't seal the trait.
>>>
>>> Link: https://lore.kernel.org/rust-for-linux/Z9xb1r1x5tOzAIZT@boqun-archlinux/ [1]
>>> Suggested-by: Boqun Feng <boqun.feng@gmail.com>
>>> Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
>>
>> LGTM:
>> Reviewed-by: Alice Ryhl <aliceryhl@google.com>
>
> Thanks!
>
>> Though you're missing `` around [0; KTIME_MAX] in some places, which
>> may be worth adding.
>
> Andreas, would you like me to send v2 with the above changes?
Perhaps we should use rust ranges instead [1]? Like this, no brackets: `0..=KTIME_MAX`.
Best regards,
Andreas Hindborg
[1] https://doc.rust-lang.org/reference/expressions/range-expr.html
next prev parent reply other threads:[~2025-07-02 9:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-30 13:10 [PATCH v1] rust: time: make ClockSource unsafe trait FUJITA Tomonori
2025-06-30 13:33 ` Alice Ryhl
2025-06-30 23:39 ` FUJITA Tomonori
2025-07-02 8:38 ` Andreas Hindborg
2025-07-02 9:17 ` Andreas Hindborg [this message]
2025-07-02 9:50 ` Alice Ryhl
2025-07-04 0:07 ` FUJITA Tomonori
2025-07-04 6:42 ` Miguel Ojeda
2025-07-04 7:13 ` Andreas Hindborg
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=87sejfuf3n.fsf@kernel.org \
--to=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=anna-maria@linutronix.de \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=frederic@kernel.org \
--cc=fujita.tomonori@gmail.com \
--cc=gary@garyguo.net \
--cc=jstultz@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=lyude@redhat.com \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=sboyd@kernel.org \
--cc=tglx@linutronix.de \
--cc=tmgross@umich.edu \
/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 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).