From: Andreas Hindborg <a.hindborg@kernel.org>
To: Miguel Ojeda <ojeda@kernel.org>
Cc: "Anna-Maria Behnsen" <anna-maria@linutronix.de>,
"Frederic Weisbecker" <frederic@kernel.org>,
"Thomas Gleixner" <tglx@linutronix.de>,
linux-kernel@vger.kernel.org,
"rust-for-linux@vger.kernel.org" <rust-for-linux@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [GIT PULL] Rust `hrtimer` support for v6.15
Date: Thu, 13 Mar 2025 14:09:21 +0100 [thread overview]
Message-ID: <87pliljcvy.fsf@kernel.org> (raw)
Hi Miguel,
Please pull the Rust support for hrtimer for v6.15.
This initial support allows for intrusive use of timers without
allocating when starting a timer. We support `Pin<Box<T>>`, `Arc<T>`,
`Pin<&T>` and `Pin<&mut T>` pointer types for working with these
intrusive timers. We support at most one `HrTimer` field in a struct for
use with this API.
For now, the primary users will be the Rust null block driver, `rnull`,
and the Rust kernel mode setting driver `rkvms`. I expect us to add more
features to the API as the demands from users grow.
The PR also includes two changes for the core rust and rust/alloc
subsytems that are dependencies of the hrtimer Rust API: `Arc::as_ptr`
and `Box::into_pin`. The alloc change was Ack'd by Danilo.
The commits were in linux-next since next-20250313.
The following changes since commit a64dcfb451e254085a7daee5fe51bf22959d52d3:
Linux 6.14-rc2 (2025-02-09 12:45:03 -0800)
are available in the Git repository at:
https://github.com/rust-for-linux/linux.git tags/rust-hrtimer-for-v6.15
for you to fetch changes up to 15a3c03ca02b6caec995de178904ab8c637d584c:
rust: hrtimer: add maintainer entry (2025-03-11 21:00:43 +0100)
Best regards,
Andreas Hindborg
----------------------------------------------------------------
Rust hrtimer API for v6.15
Introduce Rust support for the `hrtimer` subsystem:
- Add a way to use the `hrtimer` subsystem from Rust. Rust code can now set up
intrusive timers without allocating when starting the timer.
- Add support for `Pin<Box<_>>`, `Arc<_>`, `Pin<&_>` and `Pin<&mut _>` as
pointer types for use with timer callbacks.
- Add support for setting clock source and timer mode.
`kernel` crate:
- Add `Arc::as_ptr` for converting an `Arc` to a raw pointer. This is a
dependency for the `hrtimer` API.
- Add `Box::into_pin` for converting a `Box<_>` into a `Pin<Box<_>>` to align
with Rust `alloc`. This is a dependency for the `hrtimer` API.
----------------------------------------------------------------
Andreas Hindborg (13):
rust: hrtimer: introduce hrtimer support
rust: sync: add `Arc::as_ptr`
rust: hrtimer: implement `HrTimerPointer` for `Arc`
rust: hrtimer: allow timer restart from timer handler
rust: hrtimer: add `UnsafeHrTimerPointer`
rust: hrtimer: add `hrtimer::ScopedHrTimerPointer`
rust: hrtimer: implement `UnsafeHrTimerPointer` for `Pin<&T>`
rust: hrtimer: implement `UnsafeHrTimerPointer` for `Pin<&mut T>`
rust: alloc: add `Box::into_pin`
rust: hrtimer: implement `HrTimerPointer` for `Pin<Box<T>>`
rust: hrtimer: add `HrTimerMode`
rust: hrtimer: add clocksource selection through `ClockId`
rust: hrtimer: add maintainer entry
MAINTAINERS | 15 ++
rust/kernel/alloc/kbox.rs | 6 +
rust/kernel/sync/arc.rs | 13 +-
rust/kernel/time.rs | 68 +++++
rust/kernel/time/hrtimer.rs | 517 ++++++++++++++++++++++++++++++++++++
rust/kernel/time/hrtimer/arc.rs | 100 +++++++
rust/kernel/time/hrtimer/pin.rs | 104 ++++++++
rust/kernel/time/hrtimer/pin_mut.rs | 108 ++++++++
rust/kernel/time/hrtimer/tbox.rs | 120 +++++++++
9 files changed, 1049 insertions(+), 2 deletions(-)
create mode 100644 rust/kernel/time/hrtimer.rs
create mode 100644 rust/kernel/time/hrtimer/arc.rs
create mode 100644 rust/kernel/time/hrtimer/pin.rs
create mode 100644 rust/kernel/time/hrtimer/pin_mut.rs
create mode 100644 rust/kernel/time/hrtimer/tbox.rs
next reply other threads:[~2025-03-13 13:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-13 13:09 Andreas Hindborg [this message]
2025-03-21 12:10 ` [GIT PULL] Rust `hrtimer` support for v6.15 Andreas Hindborg
2025-03-22 11:15 ` Andreas Hindborg
2025-03-25 23:22 ` Miguel Ojeda
2025-03-25 23:24 ` Miguel Ojeda
2025-03-25 20:03 ` 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=87pliljcvy.fsf@kernel.org \
--to=a.hindborg@kernel.org \
--cc=anna-maria@linutronix.de \
--cc=frederic@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tglx@linutronix.de \
/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.