archive mirror
 help / color / mirror / Atom feed
* [GIT PULL] Rust for 6.4
@ 2023-04-29  1:21 Miguel Ojeda
  2023-04-30 20:08 ` pr-tracker-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Miguel Ojeda @ 2023-04-29  1:21 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Miguel Ojeda, Wedson Almeida Filho, Alex Gaynor, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, rust-for-linux,

Hi Linus,

One more set of core features for the Rust support.

The youngest commits have been in linux-next for 5 rounds; the older
half for 2 weeks.

No conflicts expected. No changes to the C side.

Please pull for v6.4 -- thanks!


The following changes since commit 09a9639e56c01c7a00d6c0ca63f4c7c41abe075d:

  Linux 6.3-rc6 (2023-04-09 11:15:57 -0700)

are available in the Git repository at: tags/rust-6.4

for you to fetch changes up to ea76e08f4d901a450619831a255e9e0a4c0ed162:

  rust: ioctl: Add ioctl number manipulation functions (2023-04-22 01:46:45 +0200)

Rust changes for v6.4

More additions to the Rust core. Importantly, this adds the pin-init
API, which will be used by other abstractions, such as the
synchronization ones added here too:

  - pin-init API: a solution for the safe pinned initialization problem.
    This allows to reduce the need for 'unsafe' code in the kernel when
    dealing with data structures that require a stable address. Commit
    90e53c5e70a6 ("rust: add pin-init API core") contains a nice
    introduction -- here is an example of how it looks like:

        struct Example {
            value: Mutex<u32>,

            value_changed: CondVar,

        impl Example {
            fn new() -> impl PinInit<Self> {
                pin_init!(Self {
                    value <- new_mutex!(0),
                    value_changed <- new_condvar!(),

        // In a `Box`.
        let b = Box::pin_init(Example::new())?;

        // In the stack.
        stack_pin_init!(let s = Example::new());

  - 'sync' module: new types 'LockClassKey' ('struct lock_class_key'),
    'Lock', 'Guard', 'Mutex' ('struct mutex'), 'SpinLock'
    ('spinlock_t'), 'LockedBy' and 'CondVar' (uses 'wait_queue_head_t'),
    plus macros such as 'static_lock_class!' and 'new_spinlock!'.

    In particular, 'Lock' and 'Guard' are generic implementations that
    contain code that is common to all locks. Then, different backends
    (the new 'Backend' trait) are implemented and used to define types
    like 'Mutex':

        type Mutex<T> = Lock<T, MutexBackend>;

    In addition, new methods 'assume_init()', 'init_with()' and
    'pin_init_with()' for 'UniqueArc<MaybeUninit<T>>' and 'downcast()'
    for 'Arc<dyn Any + Send + Sync>'; as well as 'Debug' and 'Display'
    implementations for 'Arc' and 'UniqueArc'. Reduced stack usage of
    'UniqueArc::try_new_uninit()', too.

  - 'types' module: new trait 'AlwaysRefCounted' and new type 'ARef'
    (an owned reference to an always-reference-counted object, meant to
    be used in wrappers for C types that have their own ref counting

    Moreover, new associated functions 'raw_get()' and 'ffi_init()'
    for 'Opaque'.

  - New 'task' module with a new type 'Task' ('struct task_struct'), and
    a new macro 'current!' to safely get a reference to the current one.

  - New 'ioctl' module with new '_IOC*' const functions (equivalent to
    the C macros).

  - New 'uapi' crate, intended to be accessible by drivers directly.

  - 'macros' crate: new 'quote!' macro (similar to the one provided in
    userspace by the 'quote' crate); and the 'module!' macro now allows
    specifying multiple module aliases.

  - 'error' module: new associated functions for the 'Error' type,
    such as 'from_errno()' and new functions such as 'to_result()'.

  - 'alloc' crate: more fallible 'Vec' methods: 'try_resize` and
    'try_extend_from_slice' and the infrastructure (imported from
    the Rust standard library) they need.

Asahi Lina (11):
      rust: Enable the new_uninit feature for kernel and driver crates
      rust: Import upstream `alloc::vec::set_len_on_drop` module
      rust: Import upstream `alloc::vec::spec_extend` module
      rust: Add SPDX headers to alloc::vec::{spec_extend, set_len_on_drop}
      rust: macros: Allow specifying multiple module aliases
      rust: sync: arc: Implement Arc<dyn Any + Send + Sync>::downcast()
      rust: sync: arc: Add UniqueArc<MaybeUninit<T>::assume_init()
      rust: error: Rename to_kernel_errno() -> to_errno()
      rust: error: Add Error::to_ptr()
      rust: uapi: Add UAPI crate
      rust: ioctl: Add ioctl number manipulation functions

Benno Lossin (14):
      rust: enable the `pin_macro` feature
      rust: sync: change error type of constructor functions
      rust: types: add `Opaque::raw_get`
      rust: add pin-init API core
      rust: init: add initialization macros
      rust: init/sync: add `InPlaceInit` trait to pin-initialize smart pointers
      rust: init: add `PinnedDrop` trait and macros
      rust: init: add `stack_pin_init!` macro
      rust: init: add `Zeroable` trait and `init::zeroed` function
      rust: prelude: add `pin-init` API items to prelude
      rust: types: add `Opaque::ffi_init`
      rust: sync: reduce stack usage of `UniqueArc::try_new_uninit`
      rust: sync: add functions for initializing `UniqueArc<MaybeUninit<T>>`
      rust: init: broaden the blanket impl of `Init`

Boqun Feng (2):
      rust: sync: impl {Debug,Display} for {Unique,}Arc
      samples: rust: print: Add sample code for Arc printing

Gary Guo (1):
      rust: macros: add `quote!` macro

Miguel Ojeda (3):
      rust: alloc: vec: Add some try_* methods we need
      rust: error: Add Error::from_errno{_unchecked}()
      MAINTAINERS: add Benno Lossin as Rust reviewer

Sven Van Asbroeck (1):
      rust: error: Add a helper to convert a C ERR_PTR to a `Result`

Wedson Almeida Filho (12):
      rust: error: Add to_result() helper
      rust: error: Add from_result() helper
      rust: sync: introduce `LockClassKey`
      rust: sync: introduce `Lock` and `Guard`
      rust: lock: introduce `Mutex`
      rust: lock: introduce `SpinLock`
      rust: introduce `ARef`
      rust: add basic `Task`
      rust: introduce `current`
      rust: sync: introduce `LockedBy`
      rust: lock: add `Guard::do_unlocked`
      rust: sync: introduce `CondVar`

 MAINTAINERS                        |    1 +
 rust/.gitignore                    |    1 +
 rust/Makefile                      |   28 +-
 rust/alloc/vec/              |  137 +++-
 rust/alloc/vec/  |   30 +
 rust/alloc/vec/      |  174 +++++
 rust/bindings/bindings_helper.h    |    2 +
 rust/helpers.c                     |   82 +++
 rust/kernel/               |  137 +++-
 rust/kernel/                | 1427 ++++++++++++++++++++++++++++++++++++
 rust/kernel/init/     |  235 ++++++
 rust/kernel/init/         |  971 ++++++++++++++++++++++++
 rust/kernel/               |   72 ++
 rust/kernel/                 |   10 +
 rust/kernel/             |    8 +-
 rust/kernel/                |   50 ++
 rust/kernel/sync/            |  108 ++-
 rust/kernel/sync/arc/ |   28 +
 rust/kernel/sync/        |  174 +++++
 rust/kernel/sync/           |  191 +++++
 rust/kernel/sync/lock/     |  118 +++
 rust/kernel/sync/lock/  |  117 +++
 rust/kernel/sync/      |  156 ++++
 rust/kernel/                |  155 ++++
 rust/kernel/               |  135 ++++
 rust/macros/             |   10 +-
 rust/macros/                 |   80 ++
 rust/macros/              |   32 +-
 rust/macros/            |   79 ++
 rust/macros/         |   49 ++
 rust/macros/               |  143 ++++
 rust/uapi/                   |   27 +
 rust/uapi/uapi_helper.h            |    9 +
 samples/rust/         |   26 +
 scripts/             |    2 +-
 35 files changed, 4980 insertions(+), 24 deletions(-)
 create mode 100644 rust/alloc/vec/
 create mode 100644 rust/alloc/vec/
 create mode 100644 rust/kernel/
 create mode 100644 rust/kernel/init/
 create mode 100644 rust/kernel/init/
 create mode 100644 rust/kernel/
 create mode 100644 rust/kernel/sync/arc/
 create mode 100644 rust/kernel/sync/
 create mode 100644 rust/kernel/sync/
 create mode 100644 rust/kernel/sync/lock/
 create mode 100644 rust/kernel/sync/lock/
 create mode 100644 rust/kernel/sync/
 create mode 100644 rust/kernel/
 create mode 100644 rust/macros/
 create mode 100644 rust/macros/
 create mode 100644 rust/macros/
 create mode 100644 rust/uapi/
 create mode 100644 rust/uapi/uapi_helper.h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-04-30 20:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-29  1:21 [GIT PULL] Rust for 6.4 Miguel Ojeda
2023-04-30 20:08 ` pr-tracker-bot

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).