[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH5fLgjFaduZ1AmfGGGo-kCNK-NO6qN9XK__Dz=VYHJ7dU4NvQ@mail.gmail.com>
Date: Fri, 22 Mar 2024 08:51:17 +0100
From: Alice Ryhl <aliceryhl@...gle.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: Miguel Ojeda <ojeda@...nel.org>, John Stultz <jstultz@...gle.com>,
Stephen Boyd <sboyd@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...il.com>, Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...sung.com>,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rust: time: add Ktime
On Wed, Mar 20, 2024 at 2:18 PM Thomas Gleixner <tglx@...utronix.de> wrote:
>
> On Wed, Mar 20 2024 at 10:08, Alice Ryhl wrote:
> > +impl Ktime {
> > + /// Create a `Ktime` from a raw `ktime_t`.
> > + #[inline]
> > + pub fn from_raw(inner: bindings::ktime_t) -> Self {
> > + Self { inner }
> > + }
> > +
> > + /// Get the current time using `CLOCK_MONOTONIC`.
> > + #[inline]
> > + pub fn ktime_get() -> Self {
> > + // SAFETY: It is always safe to call `ktime_get`.
>
> That's not entirely correct. ktime_get() cannot be safely invoked from
> NMI context. That won't matter for driver writers obviously.
>
> Looks sensible otherwise.
Thanks for pointing that out. I will send a v2 with a reworded comment soon.
Alice
Powered by blists - more mailing lists