Skip to content

In-place module initialisation

Wedson Almeida Filho lkml netdev rust-for-linux 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 15 repliesIn review
  2. v12 patches 9 repliesSuperseded

Changes in v2 from the cover letter

- Rebased to latest rust-next
- Split off adding Send requirement to Module into a separate patch
- Prefixed all core and kernel references with :: in
module! macro-generated code.
- Calling __pinned_init with explicit full path.
- Add Mutex to rust_inplace sample.
- Added Send implementation for Registration in net/phy.
- Link to v1: https://lore.kernel.org/rust-for-linux/[email protected]/T/#t

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5rust: phy: implement `Send` for `Registration`rust/kernel/net/phy.rs+4 -02 replies
2/5rust: kernel: require `Send` for `Module` implementationsrust/kernel/lib.rs+1 -12 replies
3/5rust: module: prefix all module paths with `::`rust/macros/module.rs+10 -102 replies
4/5rust: introduce `InPlaceModule`rust/kernel/lib.rs rust/macros/module.rs+29 -121 reply
5/5samples: rust: add in-place initialisation samplesamples/rust/Kconfig samples/rust/Makefile samples/rust/rust_inplace.rs+56 -02 replies

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchBenno LossinValentin ObstAlice Ryhl
1/5R-b
2/5R-b R-b
3/5R-b R-b
4/5R-b T-b R-b
5/5R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [PATCH v2 0/5] In-place module initialisation

From: Wedson Almeida Filho <[email protected]>

Introduce InPlaceModule, which allows modules to be initialised inplace, as opposed to the current state where modules must return an instance which is moved to its final memory location.

This allows us to have modules whose state hold objects that must be initialised inplace like locks. It also allows us to implement registrations (e.g., driver registration) inplace and have them similar to their C counterparts where no new allocations are needed.

This is built on top of the allocation APIs because the sample module is a modified version of rust_minimal, which would be incompatible with the allocation API series because it uses vectors.

---

Changes in v2:

- Rebased to latest rust-next
- Split off adding Send requirement to Module into a separate patch
- Prefixed all core and kernel references with :: in
module! macro-generated code.
- Calling __pinned_init with explicit full path.
- Add Mutex to rust_inplace sample.
- Added Send implementation for Registration in net/phy.
- Link to v1: https://lore.kernel.org/rust-for-linux/[email protected]/T/#t

---
Wedson Almeida Filho (5):
rust: phy: implement Send for Registration
rust: kernel: require Send for Module implementations
rust: module: prefix all module paths with ::
rust: introduce InPlaceModule
samples: rust: add in-place initialisation sample

 rust/kernel/lib.rs           | 25 +++++++++++++++++++-
 rust/kernel/net/phy.rs       |  4 ++++
 rust/macros/module.rs        | 36 ++++++++++++-----------------
 samples/rust/Kconfig         | 11 +++++++++
 samples/rust/Makefile        |  1 +
 samples/rust/rust_inplace.rs | 44 ++++++++++++++++++++++++++++++++++++
 6 files changed, 99 insertions(+), 22 deletions(-)
 create mode 100644 samples/rust/rust_inplace.rs

base-commit: 453275c66aa4d87c73c5152140b3573ab2435bb7

Signature · 1 line
2.34.1