Skip to contentSkip to conversation

rust: rxarray: add rust xarray support

RFC PATCH In review Daniel Gomez 2 participants 3 messages Oct 5 – Oct 9

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH v2 1/1 rust: rxarray: add rust xarray support

From: Daniel Gomez <[email protected]>

Add Rust XArray support.

This is the Rust implementation of the XArray lib/xarray.c. As of now, it supports basic functionality: store, load, load_mut and erase.

---
As discussed at LPC26, this is the version of the Rust XArray that is ready to merge for testing and evaluating purposes following the Rust reference implementation rule (experimental) [1]. Next, we will make progress following the roadmap suggested in v1.

For the motivation, see v1 link below in the changelog.

A branch with the patches can be found here [2].

---
Changes in v2:
- Add Matthew Wilcox in the XARRAY RUST MAINTAINERS entry.
- Drop bench lib and xarray_benchmark_rust benchmark module to scope the series to the Rust XArray implementation only.
- Link to v1: https://patch.msgid.link/[email protected]

---
 MAINTAINERS            |   12 +
 lib/Kconfig            |   11 +
 rust/kernel/lib.rs     |    2 +
 rust/kernel/rxarray.rs | 1407 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 1432 insertions(+)
MAINTAINERS +12 -0
index c2414447892c2..4dc402b30da15 100644
@@ -29681,6 +29681,18 @@ C:	https://rust-for-linux.zulipchat.com
 T:	git https://github.com/Rust-for-Linux/linux.git xarray-next
 F:	rust/kernel/xarray.rs
 
+XARRAY [RUST]
+M:	Daniel Gomez <[email protected]>
+M:	Matthew Wilcox <[email protected]>
+R:	Andreas Hindborg <[email protected]>
+L:	[email protected]
+S:	Supported
+W:	https://rust-for-linux.com
+B:	https://github.com/Rust-for-Linux/linux/issues
+C:	https://rust-for-linux.zulipchat.com
+T:	git git://git.kernel.org/pub/scm/linux/kernel/git/da.gomez/linux.git rxarray-next
+F:	rust/kernel/rxarray.rs
+
 XBOX DVD IR REMOTE
 M:	Benjamin Valentin <[email protected]>
 S:	Maintained
lib/Kconfig +11 -0
index 4e6b34c3346d5..ba7627b89f76e 100644
@@ -349,6 +349,17 @@ config XARRAY_MULTI
 	  Support entries which occupy multiple consecutive indices in the
 	  XArray.
 
+config XARRAY_RUST
+	bool "Rust XArray (EXPERIMENTAL)"
+	depends on RUST
+	depends on EXPERT
+	help
+	  This builds the Rust implementation of the XArray (kernel::rxarray).
+	  It is an experimental reference implementation under evaluation and does
+	  not yet cover every feature of the C XArray.
+
+	  If unsure, say N.
+
 config ASSOCIATIVE_ARRAY
 	bool
 	help
rust/kernel/lib.rs +2 -0
index 4d5c96ddc49c7..cedeeddddb71c 100644
@@ -122,6 +122,8 @@
 pub mod rbtree;
 pub mod regulator;
 pub mod revocable;
+#[cfg(CONFIG_XARRAY_RUST)]
+pub mod rxarray;
 pub mod safety;
 pub mod scatterlist;
 pub mod security;
rust/kernel/rxarray.rs new file +1407 -0

1,407 lines not on this page · raw message

---
base-commit: 4cfc5bf97cabf660c04b22ba933d198cc4aa98ec
change-id: 20260922-rxarray-next-f1912366209c

Best regards,

Signature · 1 line
Daniel Gomez <[email protected]>
Reviewed-by on v2 1/1
#1 lore raw
Quoted 15 lines · Daniel Gomez

From: Daniel Gomez <[email protected]>

Add Rust XArray support.

This is the Rust implementation of the XArray lib/xarray.c. As of now, it supports basic functionality: store, load, load_mut and erase.

---
As discussed at LPC26, this is the version of the Rust XArray that is ready to merge for testing and evaluating purposes following the Rust reference implementation rule (experimental) [1]. Next, we will make progress following the roadmap suggested in v1.

Quoted 6 lines

For the motivation, see v1 link below in the changelog.

A branch with the patches can be found here [2].

#2 lore raw
Quoted 16 lines · Matthew Wilcox
Quoted 15 lines · Daniel Gomez

From: Daniel Gomez <[email protected]>

Add Rust XArray support.

This is the Rust implementation of the XArray lib/xarray.c. As of now, it supports basic functionality: store, load, load_mut and erase.

---
As discussed at LPC26, this is the version of the Rust XArray that is ready to merge for testing and evaluating purposes following the Rust reference implementation rule (experimental) [1]. Next, we will make progress following the roadmap suggested in v1.

Quoted 9 lines
Quoted 6 lines

For the motivation, see v1 link below in the changelog.

A branch with the patches can be found here [2].

Thanks, Matthew.

Following our discussion with Miguel at LPC, I'll send PRs for the Rust XArray to you, ie. the "PRs from their Rust sub-maintainer" option in [1] using my tree at kernel.org [2]. If that ever doesn't fit your schedule, the Rust for Linux tree takes them as fallback [3]. Note that the Rust tree follows its key cycle dates, i.e. the last version of a series should reach the list before -rc5 [4]. We have passed that date, (for R4L tree) but I'll send the PR anyway so you can pick up when ready.

And as I mentioned, I'm happy to take on more of the work if it helps.

[1] https://rust-for-linux.com/rust-kernel-policy#how-is-rust-introduced-in-a-subsystem
[2] https://git.kernel.org/pub/scm/linux/kernel/git/da.gomez/linux.git/log/?h=rxarray-next
[3] https://rust-for-linux.com/rust-kernel-policy#who-maintains-rust-code-in-the-kernel
[4] https://rust-for-linux.com/contributing#key-cycle-dates