Skip to content

Tags: Rust-for-Linux/linux

Tags

rust-hrtimer-for-v6.15-v3

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.

rust-hrtimer-for-v6.15-v2

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.

rust-fixes-6.14-3

Verified

This tag was signed with the committer’s verified signature.
ojeda Miguel Ojeda
Rust fixes for v6.14 (3rd)

Toolchain and infrastructure:

 - Disallow BTF generation with Rust + LTO.

 - Improve rust-analyzer support.

'kernel' crate:

 - 'init' module: remove 'Zeroable' implementation for a couple types
   that should not have it.

 - 'alloc' module: fix macOS failure in host test by satisfying POSIX
   alignment requirement.

 - Add missing '\n's to 'pr_*!()' calls.

And a couple other minor cleanups.

rust-hrtimer-for-v6.15

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.

v6.14-rc3

Linux 6.14-rc3

rust-fixes-6.14-2

Verified

This tag was signed with the committer’s verified signature.
ojeda Miguel Ojeda
Rust fixes for v6.14 (2nd)

Toolchain and infrastructure:

 - Fix objtool warning due to future Rust 1.85.0 (to be released in
   a few days).

 - Clean future Rust 1.86.0 (to be released 2025-04-03) Clippy warning.

rust-fixes-6.14

Verified

This tag was signed with the committer’s verified signature.
ojeda Miguel Ojeda
Rust fixes for v6.14

Toolchain and infrastructure:

 - Do not export KASAN ODR symbols to avoid gendwarfksyms warnings.

 - Fix future Rust 1.86.0 (to be released 2025-04-03) x86_64 builds.

 - Clean future Rust 1.86.0 (to be released 2025-04-03) warning.

 - Fix future GCC 15 (to be released in a few months) builds.

 - Fix `rusttest` target in macOS.

rust-6.14

Verified

This tag was signed with the committer’s verified signature.
ojeda Miguel Ojeda
Rust changes for v6.14

Toolchain and infrastructure:

 - Finish the move to custom FFI integer types started in the previous
   cycle and finally map 'long' to 'isize' and 'char' to 'u8'. Do a few
   cleanups on top thanks to that.

 - Start to use 'derive(CoercePointee)' on Rust >= 1.84.0.

   This is a major milestone on the path to build the kernel using only
   stable Rust features. In particular, previously we were using the
   unstable features 'coerce_unsized', 'dispatch_from_dyn' and 'unsize',
   and now we will use the new 'derive_coerce_pointee' one, which is on
   track to stabilization. This new feature is a macro that essentially
   expands into code that internally uses the unstable features that we
   were using before, without having to expose those.

   With it, stable Rust users, including the kernel, will be able to
   build custom smart pointers that work with trait objects, e.g.:

       fn f(p: &Arc<dyn Display>) {
           pr_info!("{p}\n");
       }

       let a: Arc<dyn Display> = Arc::new(42i32, GFP_KERNEL)?;
       let b: Arc<dyn Display> = Arc::new("hello there", GFP_KERNEL)?;

       f(&a); // Prints "42".
       f(&b); // Prints "hello there".

   Together with the 'arbitrary_self_types' feature that we started
   using in the previous cycle, using our custom smart pointers like
   'Arc' will eventually only rely in stable Rust.

 - Introduce 'PROCMACROLDFLAGS' environment variable to allow to link
   Rust proc macros using different flags than those used for linking
   Rust host programs (e.g. when 'rustc' uses a different C library
   than the host programs' one), which Android needs.

 - Help kernel builds under macOS with Rust enabled by accomodating
   other naming conventions for dynamic libraries (i.e. '.so' vs.
   '.dylib') which are used for Rust procedural macros. The actual
   support for macOS (i.e. the rest of the pieces needed) is provided
   out-of-tree by others, following the policy used for other parts of
   the kernel by Kbuild.

 - Run Clippy for 'rusttest' code too and clean the bits it spotted.

 - Provide Clippy with the minimum supported Rust version to improve
   the suggestions it gives.

 - Document 'bindgen' 0.71.0 regression.

'kernel' crate:

 - 'build_error!': move users of the hidden function to the documented
   macro, prevent such uses in the future by moving the function
   elsewhere and add the macro to the prelude.

 - 'types' module: add improved version of 'ForeignOwnable::borrow_mut'
   (which was removed in the past since it was problematic); change
   'ForeignOwnable' pointer type to '*mut'.

 - 'alloc' module: implement 'Display' for 'Box' and align the 'Debug'
   implementation to it; add example (doctest) for 'ArrayLayout::new()'.

 - 'sync' module: document 'PhantomData' in 'Arc'; use
   'NonNull::new_unchecked' in 'ForeignOwnable for Arc' impl.

 - 'uaccess' module: accept 'Vec's with different allocators in
   'UserSliceReader::read_all'.

 - 'workqueue' module: enable run-testing a couple more doctests.

 - 'error' module: simplify 'from_errno()'.

 - 'block' module: fix formatting in code documentation (a lint to catch
   these is being implemented).

 - Avoid 'unwrap()'s in doctests, which also improves the examples by
   showing how kernel code is supposed to be written.

 - Avoid 'as' casts with 'cast{,_mut}' calls which are a bit safer.

And a few other cleanups.

rust-fixes-6.13

Verified

This tag was signed with the committer’s verified signature.
ojeda Miguel Ojeda
Rust fixes for v6.13

Toolchain and infrastructure:

 - Set bindgen's Rust target version to prevent issues when pairing
   older rustc releases with newer bindgen releases, such as
   bindgen >= 0.71.0 and rustc < 1.82 due to unsafe_extern_blocks.

drm/panic:

 - Remove spurious empty line detected by a new Clippy warning.

v6.13-rc1

Linux 6.13-rc1