[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87a58xwkq0.ffs@tglx>
Date: Thu, 03 Apr 2025 13:25:11 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Lyude Paul <lyude@...hat.com>, rust-for-linux@...r.kernel.org, Andreas
Hindborg <a.hindborg@...nel.org>, linux-kernel@...r.kernel.org
Cc: Boqun Feng <boqun.feng@...il.com>, Frederic Weisbecker
<frederic@...nel.org>, Anna-Maria Behnsen <anna-maria@...utronix.de>,
Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>, Gary
Guo <gary@...yguo.net>, Björn Roy Baron
<bjorn3_gh@...tonmail.com>, Benno
Lossin <benno.lossin@...ton.me>, Alice Ryhl <aliceryhl@...gle.com>, Trevor
Gross <tmgross@...ch.edu>
Subject: Re: [PATCH 2/6] rust: hrtimer: Add HrTimerCallbackContext and
::forward()
On Wed, Apr 02 2025 at 17:40, Lyude Paul wrote:
> With Linux's hrtimer API, certain functions require we either acquire
> proper locking to call specific methods - or that we call said methods from
> the context of the timer callback. hrtimer_forward() is one of these
> functions, so we start by adding a new HrTimerCallbackContext type which
> provides a way of calling these methods that is inaccessible outside of
> hrtimer callbacks.
Just for completeness:
When hrtimer_forward() is invoked from non-callback context, then there
is not necessarily a locking requirement. The caller has to make sure
that the timer is neither armed, nor running the callback.
hrtimer_cancel();
hrtimer_forward();
is a legitimate sequence, if there is no way that the timer is re-armed
concurrently. That works just without locks.
That said, I really like that callback context concept you are doing!
Thanks,
tglx
Powered by blists - more mailing lists