[PATCH v17 4/7] rust: module: use a reference in macros::module::module

2025-07-10 Thread Andreas Hindborg
Signed-off-by: Andreas Hindborg --- rust/macros/module.rs | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/rust/macros/module.rs b/rust/macros/module.rs index 2ddd2eeb2852..1a867a1e787e 100644 --- a/rust/macros/module.rs +++ b/rust/macros/module.rs @@ -179,26

[PATCH v17 3/7] rust: introduce module_param module

2025-07-10 Thread Andreas Hindborg
Add types and traits for interfacing the C moduleparam API. Reviewed-by: Benno Lossin Signed-off-by: Andreas Hindborg --- rust/kernel/lib.rs | 1 + rust/kernel/module_param.rs | 181 2 files changed, 182 insertions(+) diff --git a/rust

[PATCH v17 1/7] rust: sync: add `SetOnce`

2025-07-10 Thread Andreas Hindborg
Introduce the `SetOnce` type, a container that can only be written once. The container uses an internal atomic to synchronize writes to the internal value. Reviewed-by: Alice Ryhl Reviewed-by: Benno Lossin Signed-off-by: Andreas Hindborg --- rust/kernel/sync.rs | 2 + rust/kernel

[PATCH v17 0/7] rust: extend `module!` macro with integer parameter support

2025-07-10 Thread Andreas Hindborg
-Linux/linux/pull/7 [1] Link: https://github.com/Rust-for-Linux/linux/pull/82 [2] Link: https://github.com/Rust-for-Linux/linux/pull/87 [3] Link: https://github.com/Rust-for-Linux/linux/issues/11 [4] Signed-off-by: Andreas Hindborg --- Changes in v17: - Fix drop impl of `SetOnce` so that it works

[PATCH v17 7/7] modules: add rust modules files to MAINTAINERS

2025-07-10 Thread Andreas Hindborg
The module subsystem people agreed to maintain rust support for modules [1]. Thus, add entries for relevant files to modules entry in MAINTAINERS. Link: https://lore.kernel.org/all/0d9e596a-5316-4e00-862b-fd77552ae...@suse.com/ [1] Acked-by: Daniel Gomez Signed-off-by: Andreas Hindborg

[PATCH v17 6/7] rust: samples: add a module parameter to the rust_minimal sample

2025-07-10 Thread Andreas Hindborg
Showcase the rust module parameter support by adding a module parameter to the `rust_minimal` sample. Reviewed-by: Benno Lossin Signed-off-by: Andreas Hindborg --- samples/rust/rust_minimal.rs | 10 ++ 1 file changed, 10 insertions(+) diff --git a/samples/rust/rust_minimal.rs b

[PATCH v17 2/7] rust: str: add radix prefixed integer parsing functions

2025-07-10 Thread Andreas Hindborg
Reviewed-by: Benno Lossin Signed-off-by: Andreas Hindborg --- rust/kernel/str.rs | 2 + rust/kernel/str/parse_int.rs | 148 +++ 2 files changed, 150 insertions(+) diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs index a927db8e079c..2b6c8b4a0ae4

[PATCH v17 5/7] rust: module: update the module macro with module parameter support

2025-07-10 Thread Andreas Hindborg
Allow module parameters to be declared in the rust `module!` macro. Reviewed-by: Benno Lossin Signed-off-by: Andreas Hindborg --- rust/macros/helpers.rs | 25 +++ rust/macros/lib.rs | 31 + rust/macros/module.rs | 178 ++--- 3

Re: [PATCH v16 1/7] rust: sync: add `SetOnce`

2025-07-10 Thread Andreas Hindborg
"Benno Lossin" writes: > On Wed Jul 9, 2025 at 7:52 PM CEST, Andreas Hindborg wrote: >> Introduce the `SetOnce` type, a container that can only be written once. >> The container uses an internal atomic to synchronize writes to the internal >> value. >> >

[PATCH v16 2/7] rust: str: add radix prefixed integer parsing functions

2025-07-09 Thread Andreas Hindborg
Reviewed-by: Benno Lossin Signed-off-by: Andreas Hindborg --- rust/kernel/str.rs | 2 + rust/kernel/str/parse_int.rs | 148 +++ 2 files changed, 150 insertions(+) diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs index a927db8e079c3..2b6c8b4a0ae4b

[PATCH v16 4/7] rust: module: use a reference in macros::module::module

2025-07-09 Thread Andreas Hindborg
Signed-off-by: Andreas Hindborg --- rust/macros/module.rs | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/rust/macros/module.rs b/rust/macros/module.rs index 2ddd2eeb28521..1a867a1e787ed 100644 --- a/rust/macros/module.rs +++ b/rust/macros/module.rs

[PATCH v16 1/7] rust: sync: add `SetOnce`

2025-07-09 Thread Andreas Hindborg
Introduce the `SetOnce` type, a container that can only be written once. The container uses an internal atomic to synchronize writes to the internal value. Reviewed-by: Alice Ryhl Signed-off-by: Andreas Hindborg --- rust/kernel/sync.rs | 2 + rust/kernel/sync/set_once.rs | 122

[PATCH v16 6/7] rust: samples: add a module parameter to the rust_minimal sample

2025-07-09 Thread Andreas Hindborg
Showcase the rust module parameter support by adding a module parameter to the `rust_minimal` sample. Reviewed-by: Benno Lossin Signed-off-by: Andreas Hindborg --- samples/rust/rust_minimal.rs | 10 ++ 1 file changed, 10 insertions(+) diff --git a/samples/rust/rust_minimal.rs b

[PATCH v16 7/7] modules: add rust modules files to MAINTAINERS

2025-07-09 Thread Andreas Hindborg
The module subsystem people agreed to maintain rust support for modules [1]. Thus, add entries for relevant files to modules entry in MAINTAINERS. Link: https://lore.kernel.org/all/0d9e596a-5316-4e00-862b-fd77552ae...@suse.com/ [1] Acked-by: Daniel Gomez Signed-off-by: Andreas Hindborg

[PATCH v16 3/7] rust: introduce module_param module

2025-07-09 Thread Andreas Hindborg
Add types and traits for interfacing the C moduleparam API. Reviewed-by: Benno Lossin Signed-off-by: Andreas Hindborg --- rust/kernel/lib.rs | 1 + rust/kernel/module_param.rs | 181 2 files changed, 182 insertions(+) diff --git a/rust

[PATCH v16 5/7] rust: module: update the module macro with module parameter support

2025-07-09 Thread Andreas Hindborg
Allow module parameters to be declared in the rust `module!` macro. Reviewed-by: Benno Lossin Signed-off-by: Andreas Hindborg --- rust/macros/helpers.rs | 25 +++ rust/macros/lib.rs | 31 + rust/macros/module.rs | 178 ++--- 3

[PATCH v16 0/7] rust: extend `module!` macro with integer parameter support

2025-07-09 Thread Andreas Hindborg
-Linux/linux/pull/7 [1] Link: https://github.com/Rust-for-Linux/linux/pull/82 [2] Link: https://github.com/Rust-for-Linux/linux/pull/87 [3] Link: https://github.com/Rust-for-Linux/linux/issues/11 [4] Signed-off-by: Andreas Hindborg --- Changes in v16: - Normalize imports in `set_once.rs`. - Use

Re: [PATCH v15 1/7] rust: sync: add `SetOnce`

2025-07-09 Thread Andreas Hindborg
"Benno Lossin" writes: > On Tue Jul 8, 2025 at 10:54 AM CEST, Andreas Hindborg wrote: >> "Boqun Feng" writes: >> >>> On Mon, Jul 07, 2025 at 03:38:58PM +0200, Alice Ryhl wrote: >>>> On Mon, Jul 7, 2025 at 3:32 PM Andreas Hindborg &

Re: [PATCH v15 1/7] rust: sync: add `SetOnce`

2025-07-09 Thread Andreas Hindborg
"Benno Lossin" writes: > On Tue Jul 8, 2025 at 3:06 PM CEST, Andreas Hindborg wrote: >> "Benno Lossin" writes: >>> On Mon Jul 7, 2025 at 3:29 PM CEST, Andreas Hindborg wrote: >>>> diff --git a/rust/kernel/sync.rs b/rust/kernel/sync.rs >>

Re: [PATCH v15 0/7] rust: extend `module!` macro with integer parameter support

2025-07-08 Thread Andreas Hindborg
"Miguel Ojeda" writes: > On Mon, Jul 7, 2025 at 3:31 PM Andreas Hindborg wrote: >> >> Based on code by Adam Bratschi-Kaye lifted from the original `rust` branch >> [1]. > > I would suggest adding this sort of note to the commit messages, > especially s

Re: [PATCH v15 1/7] rust: sync: add `SetOnce`

2025-07-08 Thread Andreas Hindborg
"Benno Lossin" writes: > On Mon Jul 7, 2025 at 3:29 PM CEST, Andreas Hindborg wrote: >> Introduce the `SetOnce` type, a container that can only be written once. >> The container uses an internal atomic to synchronize writes to the internal >> value. >> >&g

Re: [PATCH v15 1/7] rust: sync: add `SetOnce`

2025-07-08 Thread Andreas Hindborg
"Boqun Feng" writes: > On Mon, Jul 07, 2025 at 03:38:58PM +0200, Alice Ryhl wrote: >> On Mon, Jul 7, 2025 at 3:32 PM Andreas Hindborg >> wrote: >> > >> > Introduce the `SetOnce` type, a container that can only be written once. >> > The contai

Re: [PATCH v15 1/7] rust: sync: add `SetOnce`

2025-07-08 Thread Andreas Hindborg
"Alice Ryhl" writes: > On Mon, Jul 7, 2025 at 3:32 PM Andreas Hindborg wrote: >> >> Introduce the `SetOnce` type, a container that can only be written once. >> The container uses an internal atomic to synchronize writes to the internal >> value. >> &

Re: [PATCH v15 1/7] rust: sync: add `SetOnce`

2025-07-07 Thread Andreas Hindborg
Andreas Hindborg writes: > Introduce the `SetOnce` type, a container that can only be written once. > The container uses an internal atomic to synchronize writes to the internal > value. > > Signed-off-by: Andreas Hindborg > --- > rust/kernel/sync.rs | 2

[PATCH v15 3/7] rust: introduce module_param module

2025-07-07 Thread Andreas Hindborg
Add types and traits for interfacing the C moduleparam API. Reviewed-by: Benno Lossin Signed-off-by: Andreas Hindborg --- rust/kernel/lib.rs | 1 + rust/kernel/module_param.rs | 181 2 files changed, 182 insertions(+) diff --git a/rust

[PATCH v15 4/7] rust: module: use a reference in macros::module::module

2025-07-07 Thread Andreas Hindborg
Signed-off-by: Andreas Hindborg --- rust/macros/module.rs | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/rust/macros/module.rs b/rust/macros/module.rs index 2ddd2eeb28521..1a867a1e787ed 100644 --- a/rust/macros/module.rs +++ b/rust/macros/module.rs

[PATCH v15 7/7] modules: add rust modules files to MAINTAINERS

2025-07-07 Thread Andreas Hindborg
The module subsystem people agreed to maintain rust support for modules [1]. Thus, add entries for relevant files to modules entry in MAINTAINERS. Link: https://lore.kernel.org/all/0d9e596a-5316-4e00-862b-fd77552ae...@suse.com/ [1] Acked-by: Daniel Gomez Signed-off-by: Andreas Hindborg

[PATCH v15 2/7] rust: str: add radix prefixed integer parsing functions

2025-07-07 Thread Andreas Hindborg
-off-by: Andreas Hindborg --- rust/kernel/str.rs | 2 + rust/kernel/str/parse_int.rs | 148 +++ 2 files changed, 150 insertions(+) diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs index a927db8e079c3..2b6c8b4a0ae4b 100644 --- a/rust/kernel

[PATCH v15 5/7] rust: module: update the module macro with module parameter support

2025-07-07 Thread Andreas Hindborg
Allow module parameters to be declared in the rust `module!` macro. Reviewed-by: Benno Lossin Signed-off-by: Andreas Hindborg --- rust/macros/helpers.rs | 25 +++ rust/macros/lib.rs | 31 + rust/macros/module.rs | 178 ++--- 3

[PATCH v15 1/7] rust: sync: add `SetOnce`

2025-07-07 Thread Andreas Hindborg
Introduce the `SetOnce` type, a container that can only be written once. The container uses an internal atomic to synchronize writes to the internal value. Signed-off-by: Andreas Hindborg --- rust/kernel/sync.rs | 2 + rust/kernel/sync/set_once.rs | 125

[PATCH v15 0/7] rust: extend `module!` macro with integer parameter support

2025-07-07 Thread Andreas Hindborg
/tree/bc22545f38d74473cfef3e9fd65432733435b79f [1] Signed-off-by: Andreas Hindborg --- Changes in v15: - Rebase on v6.16-rc5. - Dedent code in module macro for better formatting. - Rename `OnceLock` to `SetOnce`. - Use "being initialized" rather than "being mutably accessed&quo

[PATCH v15 6/7] rust: samples: add a module parameter to the rust_minimal sample

2025-07-07 Thread Andreas Hindborg
Showcase the rust module parameter support by adding a module parameter to the `rust_minimal` sample. Reviewed-by: Benno Lossin Signed-off-by: Andreas Hindborg --- samples/rust/rust_minimal.rs | 10 ++ 1 file changed, 10 insertions(+) diff --git a/samples/rust/rust_minimal.rs b

Re: [PATCH v14 5/7] rust: module: update the module macro with module parameter support

2025-07-04 Thread Andreas Hindborg
"Benno Lossin" writes: > On Fri Jul 4, 2025 at 2:29 PM CEST, Andreas Hindborg wrote: >> "Benno Lossin" writes: >>> On Wed Jul 2, 2025 at 3:18 PM CEST, Andreas Hindborg wrote: >>>> +perm: 0, // Will not appear in

Re: [PATCH v14 5/7] rust: module: update the module macro with module parameter support

2025-07-04 Thread Andreas Hindborg
"Benno Lossin" writes: > On Wed Jul 2, 2025 at 3:18 PM CEST, Andreas Hindborg wrote: >> Allow module parameters to be declared in the rust `module!` macro. >> >> Signed-off-by: Andreas Hindborg > > A few nits below, with those fixed > > Reviewed

Re: [PATCH v14 3/7] rust: introduce module_param module

2025-07-04 Thread Andreas Hindborg
"Benno Lossin" writes: > On Fri Jul 4, 2025 at 9:37 AM CEST, Andreas Hindborg wrote: >> Andreas Hindborg writes: >> >>> "Danilo Krummrich" writes: >>> >>>> On 7/2/25 3:18 PM, Andreas Hindborg wrote: >>>>> +/

Re: [PATCH v14 3/7] rust: introduce module_param module

2025-07-04 Thread Andreas Hindborg
"Benno Lossin" writes: > On Wed Jul 2, 2025 at 3:18 PM CEST, Andreas Hindborg wrote: >> Add types and traits for interfacing the C moduleparam API. >> >> Signed-off-by: Andreas Hindborg > > I have some nits below, but overall > > Reviewed-by: Be

Re: [PATCH v14 3/7] rust: introduce module_param module

2025-07-04 Thread Andreas Hindborg
Andreas Hindborg writes: > "Danilo Krummrich" writes: > >> On 7/2/25 3:18 PM, Andreas Hindborg wrote: >>> +/// Get a shared reference to the parameter value. >>> +// Note: When sysfs access to parameters are enabled, we have to pass &

Re: [PATCH v14 3/7] rust: introduce module_param module

2025-07-04 Thread Andreas Hindborg
"Danilo Krummrich" writes: > On 7/2/25 3:18 PM, Andreas Hindborg wrote: >> +/// Get a shared reference to the parameter value. >> +// Note: When sysfs access to parameters are enabled, we have to pass >> in a >> +// held lock guard

Re: [PATCH v14 1/7] rust: sync: add `OnceLock`

2025-07-03 Thread Andreas Hindborg
"Wren Turkal" writes: > On 7/2/25 6:18 AM, Andreas Hindborg wrote: [...] >> +pub struct OnceLock { >> +init: Atomic, >> +value: Opaque, >> +} > > This type looks very much like the Once type in rust's stdlib. I am > wondering if the

Re: [PATCH v14 1/7] rust: sync: add `OnceLock`

2025-07-03 Thread Andreas Hindborg
"Benno Lossin" writes: > On Thu Jul 3, 2025 at 11:03 AM CEST, Andreas Hindborg wrote: >> "Benno Lossin" writes: >>> On Wed Jul 2, 2025 at 3:18 PM CEST, Andreas Hindborg wrote: [...] >>>> +Some(unsafe { &*self.value.

Re: [PATCH v14 1/7] rust: sync: add `OnceLock`

2025-07-03 Thread Andreas Hindborg
"Benno Lossin" writes: > On Wed Jul 2, 2025 at 3:18 PM CEST, Andreas Hindborg wrote: >> Introduce the `OnceLock` type, a container that can only be written once. >> The container uses an internal atomic to synchronize writes to the internal >> value. >&g

Re: [PATCH v14 1/7] rust: sync: add `OnceLock`

2025-07-03 Thread Andreas Hindborg
"Alice Ryhl" writes: > On Wed, Jul 2, 2025 at 3:54 PM Andreas Hindborg wrote: >> >> "Alice Ryhl" writes: >> >> > On Wed, Jul 2, 2025 at 3:19 PM Andreas Hindborg >> > wrote: >> >> >> >> Introduce the `Onc

Re: [PATCH v14 1/7] rust: sync: add `OnceLock`

2025-07-02 Thread Andreas Hindborg
"Alice Ryhl" writes: > On Wed, Jul 2, 2025 at 3:19 PM Andreas Hindborg wrote: >> >> Introduce the `OnceLock` type, a container that can only be written once. >> The container uses an internal atomic to synchronize writes to the internal >> value. >> &

[PATCH v14 0/7] rust: extend `module!` macro with integer parameter support

2025-07-02 Thread Andreas Hindborg
/tree/bc22545f38d74473cfef3e9fd65432733435b79f [1] Signed-off-by: Andreas Hindborg --- Note: This series now depends on the atomics series [1]. [1] https://lore.kernel.org/all/20250618164934.19817-1-boqun.f...@gmail.com Changes in v14: - Remove unnecessary `crate::` prefix from `module_param

[PATCH v14 2/7] rust: str: add radix prefixed integer parsing functions

2025-07-02 Thread Andreas Hindborg
-off-by: Andreas Hindborg --- rust/kernel/str.rs | 2 + rust/kernel/str/parse_int.rs | 148 +++ 2 files changed, 150 insertions(+) diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs index a927db8e079c..2b6c8b4a0ae4 100644 --- a/rust/kernel

[PATCH v14 1/7] rust: sync: add `OnceLock`

2025-07-02 Thread Andreas Hindborg
Introduce the `OnceLock` type, a container that can only be written once. The container uses an internal atomic to synchronize writes to the internal value. Signed-off-by: Andreas Hindborg --- rust/kernel/sync.rs | 1 + rust/kernel/sync/once_lock.rs | 104

[PATCH v14 5/7] rust: module: update the module macro with module parameter support

2025-07-02 Thread Andreas Hindborg
Allow module parameters to be declared in the rust `module!` macro. Signed-off-by: Andreas Hindborg --- rust/macros/helpers.rs | 25 +++ rust/macros/lib.rs | 31 + rust/macros/module.rs | 177 ++--- 3 files changed, 223 insertions

[PATCH v14 6/7] rust: samples: add a module parameter to the rust_minimal sample

2025-07-02 Thread Andreas Hindborg
Showcase the rust module parameter support by adding a module parameter to the `rust_minimal` sample. Reviewed-by: Benno Lossin Signed-off-by: Andreas Hindborg --- samples/rust/rust_minimal.rs | 10 ++ 1 file changed, 10 insertions(+) diff --git a/samples/rust/rust_minimal.rs b

[PATCH v14 7/7] modules: add rust modules files to MAINTAINERS

2025-07-02 Thread Andreas Hindborg
The module subsystem people agreed to maintain rust support for modules [1]. Thus, add entries for relevant files to modules entry in MAINTAINERS. Link: https://lore.kernel.org/all/0d9e596a-5316-4e00-862b-fd77552ae...@suse.com/ [1] Acked-by: Daniel Gomez Signed-off-by: Andreas Hindborg

[PATCH v14 4/7] rust: module: use a reference in macros::module::module

2025-07-02 Thread Andreas Hindborg
Signed-off-by: Andreas Hindborg --- rust/macros/module.rs | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/rust/macros/module.rs b/rust/macros/module.rs index 2ddd2eeb2852..1a867a1e787e 100644 --- a/rust/macros/module.rs +++ b/rust/macros/module.rs @@ -179,26

[PATCH v14 3/7] rust: introduce module_param module

2025-07-02 Thread Andreas Hindborg
Add types and traits for interfacing the C moduleparam API. Signed-off-by: Andreas Hindborg --- rust/kernel/lib.rs | 1 + rust/kernel/module_param.rs | 191 2 files changed, 192 insertions(+) diff --git a/rust/kernel/lib.rs b/rust/kernel

Re: [PATCH v13 2/6] rust: introduce module_param module

2025-07-02 Thread Andreas Hindborg
"Benno Lossin" writes: > On Tue Jul 1, 2025 at 4:14 PM CEST, Andreas Hindborg wrote: >> "Benno Lossin" writes: >>> On Tue Jul 1, 2025 at 10:43 AM CEST, Andreas Hindborg wrote: >>>> No, I am OK for now with configfs. >>>> >>

Re: [PATCH v13 2/6] rust: introduce module_param module

2025-07-02 Thread Andreas Hindborg
). > > Yeah we would add internal synchronization and could keep the API the > same (except removing unsafe of course). That is true. But I am not going to add an unsafe block to a driver just to read module parameters. If we cannot reach agreement on merging this with the `copy` access method, I would rather wait on a locking version. Best regards, Andreas Hindborg

Re: [PATCH v13 2/6] rust: introduce module_param module

2025-07-02 Thread Andreas Hindborg
> users, too. Again, I do not think it is reasonable to mark this function unsafe. > This is all assuming that we will not have many users of this added > right away (in a cycle or two), i.e. assuming it will be easy to > change callers later on (if only to remove the `unsafe {}`). rnull will use this the cycle after it is merged. Best regards, Andreas Hindborg

Re: [PATCH v13 2/6] rust: introduce module_param module

2025-07-01 Thread Andreas Hindborg
"Benno Lossin" writes: > On Tue Jul 1, 2025 at 10:43 AM CEST, Andreas Hindborg wrote: >> "Benno Lossin" writes: >>> On Mon Jun 30, 2025 at 3:15 PM CEST, Andreas Hindborg wrote: >>>> "Benno Lossin" writes: >>>>> On Mon

Re: [PATCH v13 2/6] rust: introduce module_param module

2025-07-01 Thread Andreas Hindborg
"Benno Lossin" writes: > On Mon Jun 30, 2025 at 3:15 PM CEST, Andreas Hindborg wrote: >> "Benno Lossin" writes: >>> On Mon Jun 30, 2025 at 1:18 PM CEST, Andreas Hindborg wrote: >>>> "Benno Lossin" writes: >>>>> (no

Re: [PATCH v13 2/6] rust: introduce module_param module

2025-06-30 Thread Andreas Hindborg
"Benno Lossin" writes: > On Mon Jun 30, 2025 at 1:18 PM CEST, Andreas Hindborg wrote: >> "Benno Lossin" writes: >>> On Fri Jun 27, 2025 at 9:57 AM CEST, Andreas Hindborg wrote: >>>> Andreas Hindborg writes: >>>>> "Benno

Re: [PATCH v13 5/6] rust: samples: add a module parameter to the rust_minimal sample

2025-06-30 Thread Andreas Hindborg
"Danilo Krummrich" writes: > (Sorry for being late on this one, just a minor nit below.) > > On 6/12/25 3:40 PM, Andreas Hindborg wrote: >> struct RustMinimal { >> @@ -20,6 +26,10 @@ impl kernel::Module for RustMinimal { >> fn init(_m

Re: [PATCH v13 2/6] rust: introduce module_param module

2025-06-30 Thread Andreas Hindborg
"Benno Lossin" writes: > On Fri Jun 27, 2025 at 9:57 AM CEST, Andreas Hindborg wrote: >> Andreas Hindborg writes: >>> "Benno Lossin" writes: >>>> That's good to know, then let's try to go for something simple. >>>> &g

Re: [PATCH v13 2/6] rust: introduce module_param module

2025-06-27 Thread Andreas Hindborg
Andreas Hindborg writes: > "Benno Lossin" writes: > >> On Mon Jun 23, 2025 at 4:31 PM CEST, Andreas Hindborg wrote: >>> "Benno Lossin" writes: >>> >>>> On Mon Jun 23, 2025 at 11:44 AM CEST, Andreas Hindborg wrote: >>>>

Re: [PATCH v13 2/6] rust: introduce module_param module

2025-06-24 Thread Andreas Hindborg
"Benno Lossin" writes: > On Mon Jun 23, 2025 at 4:31 PM CEST, Andreas Hindborg wrote: >> "Benno Lossin" writes: >> >>> On Mon Jun 23, 2025 at 11:44 AM CEST, Andreas Hindborg wrote: >>>> "Benno Lossin" writes: >>>> &g

Re: [PATCH v13 2/6] rust: introduce module_param module

2025-06-23 Thread Andreas Hindborg
"Benno Lossin" writes: > On Mon Jun 23, 2025 at 11:44 AM CEST, Andreas Hindborg wrote: >> "Benno Lossin" writes: >> >>> On Fri Jun 20, 2025 at 1:29 PM CEST, Andreas Hindborg wrote: >>>> "Benno Lossin" writes: >>>&g

Re: [PATCH v13 2/6] rust: introduce module_param module

2025-06-23 Thread Andreas Hindborg
"Benno Lossin" writes: > On Fri Jun 20, 2025 at 1:29 PM CEST, Andreas Hindborg wrote: >> "Benno Lossin" writes: >>> On Thu Jun 12, 2025 at 3:40 PM CEST, Andreas Hindborg wrote: >>>> +/// A wrapper for kernel parameters. >>>> +/// >

Re: [PATCH v13 2/6] rust: introduce module_param module

2025-06-23 Thread Andreas Hindborg
"Benno Lossin" writes: > On Fri Jun 20, 2025 at 1:29 PM CEST, Andreas Hindborg wrote: >> "Benno Lossin" writes: >>> On Thu Jun 12, 2025 at 3:40 PM CEST, Andreas Hindborg wrote: >>>> +/// A wrapper for kernel parameters. >>>> +/// >

Re: [PATCH v13 2/6] rust: introduce module_param module

2025-06-20 Thread Andreas Hindborg
Andreas Hindborg writes: > "Benno Lossin" writes: > >> On Thu Jun 12, 2025 at 3:40 PM CEST, Andreas Hindborg wrote: >>> +/// A wrapper for kernel parameters. >>> +/// >>> +/// This type is instantiated by the [`module!`] macro when module >

Re: [PATCH v13 2/6] rust: introduce module_param module

2025-06-20 Thread Andreas Hindborg
"Benno Lossin" writes: > On Thu Jun 19, 2025 at 2:20 PM CEST, Andreas Hindborg wrote: >> "Benno Lossin" writes: >>> On Thu Jun 12, 2025 at 3:40 PM CEST, Andreas Hindborg wrote: [...] >>>> +crate::error::from_result(|| { >&

Re: [PATCH v13 2/6] rust: introduce module_param module

2025-06-20 Thread Andreas Hindborg
"Benno Lossin" writes: > On Thu Jun 12, 2025 at 3:40 PM CEST, Andreas Hindborg wrote: >> +/// A wrapper for kernel parameters. >> +/// >> +/// This type is instantiated by the [`module!`] macro when module >> parameters are >> +/// defined. You

Re: [PATCH v13 1/6] rust: str: add radix prefixed integer parsing functions

2025-06-19 Thread Andreas Hindborg
"Benno Lossin" writes: > On Thu Jun 19, 2025 at 1:12 PM CEST, Andreas Hindborg wrote: >> I'm having a difficult time parsing. Are you suggesting that we guard >> against implementations of `TryInto` that misbehave? > > Let me try a different explana

Re: [PATCH v13 4/6] rust: module: update the module macro with module parameter support

2025-06-19 Thread Andreas Hindborg
"Benno Lossin" writes: > On Thu Jun 12, 2025 at 3:40 PM CEST, Andreas Hindborg wrote: >> + >> +fn emit_params(&mut self, info: &ModuleInfo) { >> +let Some(params) = &info.params else { >> +return; >> +}; >

Re: [PATCH v13 2/6] rust: introduce module_param module

2025-06-19 Thread Andreas Hindborg
"Benno Lossin" writes: > On Thu Jun 12, 2025 at 3:40 PM CEST, Andreas Hindborg wrote: >> Add types and traits for interfacing the C moduleparam API. >> >> Signed-off-by: Andreas Hindborg >> --- >> rust/kernel/lib.rs |

Re: [PATCH v13 1/6] rust: str: add radix prefixed integer parsing functions

2025-06-19 Thread Andreas Hindborg
"Benno Lossin" writes: > On Thu Jun 12, 2025 at 3:40 PM CEST, Andreas Hindborg wrote: >> +pub trait ParseInt: private::FromStrRadix + TryFrom { >> +/// Parse a string according to the description in [`Self`]. >> +fn from_str(src: &BStr) ->

[PATCH v13 3/6] rust: module: use a reference in macros::module::module

2025-06-12 Thread Andreas Hindborg
When we add parameter support to the module macro, we want to be able to pass a reference to `ModuleInfo` to a helper function. That is not possible when we move out of the local `modinfo`. So change the function to access the local via reference rather than value. Signed-off-by: Andreas Hindborg

[PATCH v13 4/6] rust: module: update the module macro with module parameter support

2025-06-12 Thread Andreas Hindborg
Allow module parameters to be declared in the rust `module!` macro. Signed-off-by: Andreas Hindborg --- rust/macros/helpers.rs | 25 +++ rust/macros/lib.rs | 31 + rust/macros/module.rs | 175 ++--- 3 files changed, 221 insertions

[PATCH v13 1/6] rust: str: add radix prefixed integer parsing functions

2025-06-12 Thread Andreas Hindborg
Add the trait `ParseInt` for parsing string representations of integers where the string representations are optionally prefixed by a radix specifier. Implement the trait for the primitive integer types. Tested-by: Daniel Gomez Reviewed-by: Greg Kroah-Hartman Signed-off-by: Andreas Hindborg

[PATCH v13 2/6] rust: introduce module_param module

2025-06-12 Thread Andreas Hindborg
Add types and traits for interfacing the C moduleparam API. Signed-off-by: Andreas Hindborg --- rust/kernel/lib.rs | 1 + rust/kernel/module_param.rs | 201 2 files changed, 202 insertions(+) diff --git a/rust/kernel/lib.rs b/rust/kernel

[PATCH v13 5/6] rust: samples: add a module parameter to the rust_minimal sample

2025-06-12 Thread Andreas Hindborg
Showcase the rust module parameter support by adding a module parameter to the `rust_minimal` sample. Signed-off-by: Andreas Hindborg --- samples/rust/rust_minimal.rs | 10 ++ 1 file changed, 10 insertions(+) diff --git a/samples/rust/rust_minimal.rs b/samples/rust/rust_minimal.rs

[PATCH v13 6/6] modules: add rust modules files to MAINTAINERS

2025-06-12 Thread Andreas Hindborg
The module subsystem people agreed to maintain rust support for modules [1]. Thus, add entries for relevant files to modules entry in MAINTAINERS. Link: https://lore.kernel.org/all/0d9e596a-5316-4e00-862b-fd77552ae...@suse.com/ [1] Acked-by: Daniel Gomez Signed-off-by: Andreas Hindborg

[PATCH v13 0/6] rust: extend `module!` macro with integer parameter support

2025-06-12 Thread Andreas Hindborg
/tree/bc22545f38d74473cfef3e9fd65432733435b79f [1] Signed-off-by: Andreas Hindborg --- Changes in v13: - remove absolute path for `ffi` types. - Split patch 2 into 4 separate patches. - Overhaul safety framework for `set_param`. - Remove generated docs for `kernel_param_ops`. - Move `parse_int` to

Re: [PATCH v12 2/3] rust: add parameter support to the `module!` macro

2025-06-12 Thread Andreas Hindborg
"Benno Lossin" writes: > On Wed Jun 11, 2025 at 12:31 PM CEST, Andreas Hindborg wrote: >> "Benno Lossin" writes: >>> On Tue May 6, 2025 at 3:02 PM CEST, Andreas Hindborg wrote: >>>> diff --git a/rust/macros/helpers.rs b/rust/macros/helpe

Re: [PATCH v12 2/3] rust: add parameter support to the `module!` macro

2025-06-11 Thread Andreas Hindborg
"Miguel Ojeda" writes: > On Wed, Jun 11, 2025 at 2:24 PM Andreas Hindborg > wrote: >> >> So either we need to `#[allow(missing_docs)]` or just add the line back. >> What do you prefer? > > Do you mean if you remove the `concat!` too, right? Yes, all

Re: [PATCH v12 2/3] rust: add parameter support to the `module!` macro

2025-06-11 Thread Andreas Hindborg
Andreas Hindborg writes: > "Benno Lossin" writes: > >> On Tue May 6, 2025 at 3:02 PM CEST, Andreas Hindborg wrote: >>> Add support for module parameters to the `module!` macro. Implement read >>> only support for integer types without `sysfs` suppo

Re: [PATCH v12 2/3] rust: add parameter support to the `module!` macro

2025-06-11 Thread Andreas Hindborg
"Benno Lossin" writes: > On Tue May 6, 2025 at 3:02 PM CEST, Andreas Hindborg wrote: >> Add support for module parameters to the `module!` macro. Implement read >> only support for integer types without `sysfs` support. >> >> Acked-by: Petr Pavlu # from mod

Re: [PATCH v12 1/3] rust: str: add radix prefixed integer parsing functions

2025-05-07 Thread Andreas Hindborg
"Benno Lossin" writes: > On Tue May 6, 2025 at 3:02 PM CEST, Andreas Hindborg wrote: >> diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs >> index 878111cb77bc..174e70397305 100644 >> --- a/rust/kernel/str.rs >> +++ b/rust/kernel/str.rs >

[PATCH v12 3/3] modules: add rust modules files to MAINTAINERS

2025-05-06 Thread Andreas Hindborg
The module subsystem people agreed to maintain rust support for modules [1]. Thus, add entries for relevant files to modules entry in MAINTAINERS. Link: https://lore.kernel.org/all/0d9e596a-5316-4e00-862b-fd77552ae...@suse.com/ [1] Acked-by: Daniel Gomez Signed-off-by: Andreas Hindborg

[PATCH v12 1/3] rust: str: add radix prefixed integer parsing functions

2025-05-06 Thread Andreas Hindborg
Add the trait `ParseInt` for parsing string representations of integers where the string representations are optionally prefixed by a radix specifier. Implement the trait for the primitive integer types. Tested-by: Daniel Gomez Reviewed-by: Greg Kroah-Hartman Signed-off-by: Andreas Hindborg

[PATCH v12 0/3] rust: extend `module!` macro with integer parameter support

2025-05-06 Thread Andreas Hindborg
/tree/bc22545f38d74473cfef3e9fd65432733435b79f [1] Signed-off-by: Andreas Hindborg --- Changes in v12: - Assign through pointer rather than using `core::ptr::replace`. - Prevent a potential use-after-free during module teardown. - Link to v11: https://lore.kernel.org/r/20250502-module-params-v3-v11

[PATCH v12 2/3] rust: add parameter support to the `module!` macro

2025-05-06 Thread Andreas Hindborg
Add support for module parameters to the `module!` macro. Implement read only support for integer types without `sysfs` support. Acked-by: Petr Pavlu # from modules perspective Tested-by: Daniel Gomez Reviewed-by: Greg Kroah-Hartman Signed-off-by: Andreas Hindborg --- rust/kernel/lib.rs

Re: [PATCH v11 2/3] rust: add parameter support to the `module!` macro

2025-05-06 Thread Andreas Hindborg
"Alice Ryhl" writes: > On Mon, May 05, 2025 at 11:55:33AM +0200, Andreas Hindborg wrote: >> "Alice Ryhl" writes: >> >> > On Fri, May 02, 2025 at 02:16:35PM +0200, Andreas Hindborg wrote: >> > It would be a use-after-free to >> > a

Re: [PATCH v11 2/3] rust: add parameter support to the `module!` macro

2025-05-05 Thread Andreas Hindborg
"Alice Ryhl" writes: > On Fri, May 02, 2025 at 02:16:35PM +0200, Andreas Hindborg wrote: >> Add support for module parameters to the `module!` macro. Implement read >> only support for integer types without `sysfs` support. >> >> Acked-by: Petr Pavlu #

[PATCH v11 0/3] rust: extend `module!` macro with integer parameter support

2025-05-02 Thread Andreas Hindborg
/tree/bc22545f38d74473cfef3e9fd65432733435b79f [1] Signed-off-by: Andreas Hindborg --- Changes in v11: - Apply a few nits from Miguel. - Link to v10: https://lore.kernel.org/r/20250501-module-params-v3-v10-0-4da485d34...@kernel.org Changes in v10: - Apply fixups from Miguel: - Add integer type

[PATCH v11 3/3] modules: add rust modules files to MAINTAINERS

2025-05-02 Thread Andreas Hindborg
The module subsystem people agreed to maintain rust support for modules [1]. Thus, add entries for relevant files to modules entry in MAINTAINERS. Link: https://lore.kernel.org/all/0d9e596a-5316-4e00-862b-fd77552ae...@suse.com/ [1] Acked-by: Daniel Gomez Signed-off-by: Andreas Hindborg

[PATCH v11 1/3] rust: str: add radix prefixed integer parsing functions

2025-05-02 Thread Andreas Hindborg
Add the trait `ParseInt` for parsing string representations of integers where the string representations are optionally prefixed by a radix specifier. Implement the trait for the primitive integer types. Tested-by: Daniel Almeida Reviewed-by: Daniel Almeida Signed-off-by: Andreas Hindborg

[PATCH v11 2/3] rust: add parameter support to the `module!` macro

2025-05-02 Thread Andreas Hindborg
Add support for module parameters to the `module!` macro. Implement read only support for integer types without `sysfs` support. Acked-by: Petr Pavlu # from modules perspective Tested-by: Daniel Gomez Signed-off-by: Andreas Hindborg --- rust/kernel/lib.rs | 1 + rust/kernel

Re: [PATCH v10 1/3] rust: str: add radix prefixed integer parsing functions

2025-05-02 Thread Andreas Hindborg
"Miguel Ojeda" writes: > On Thu, May 1, 2025 at 9:55 AM Andreas Hindborg wrote: >> >> +pub mod parse_int { >> + >> +use crate::prelude::*; > > Spurious newline. > >> +use crate::str::BStr; >> +use core::ops::Deref; &g

[PATCH v10 1/3] rust: str: add radix prefixed integer parsing functions

2025-05-01 Thread Andreas Hindborg
Add the trait `ParseInt` for parsing string representations of integers where the string representations are optionally prefixed by a radix specifier. Implement the trait for the primitive integer types. Tested-by: Daniel Almeida Reviewed-by: Daniel Almeida Signed-off-by: Andreas Hindborg

[PATCH v10 2/3] rust: add parameter support to the `module!` macro

2025-05-01 Thread Andreas Hindborg
Add support for module parameters to the `module!` macro. Implement read only support for integer types without `sysfs` support. Acked-by: Petr Pavlu # from modules perspective Tested-by: Daniel Gomez Signed-off-by: Andreas Hindborg --- rust/kernel/lib.rs | 1 + rust/kernel

[PATCH v10 3/3] modules: add rust modules files to MAINTAINERS

2025-05-01 Thread Andreas Hindborg
The module subsystem people agreed to maintain rust support for modules [1]. Thus, add entries for relevant files to modules entry in MAINTAINERS. Link: https://lore.kernel.org/all/0d9e596a-5316-4e00-862b-fd77552ae...@suse.com/ [1] Acked-by: Daniel Gomez Signed-off-by: Andreas Hindborg

[PATCH v10 0/3] rust: extend `module!` macro with integer parameter support

2025-05-01 Thread Andreas Hindborg
/tree/bc22545f38d74473cfef3e9fd65432733435b79f [1] Signed-off-by: Andreas Hindborg --- Changes in v10: - Apply fixups from Miguel: - Add integer type suffixes to `assert!` in tests. - Fix links to docs.kernel.org. - Applyy markdown and intra-doc links where possible. - Change to `///` for

Re: [PATCH v9 0/3] rust: extend `module!` macro with integer parameter support

2025-04-30 Thread Andreas Hindborg
"Petr Pavlu" writes: > On 3/21/25 10:17, Andreas Hindborg wrote: >> Extend the `module!` macro with support module parameters. Also add some >> string >> to integer parsing functions and updates `BStr` with a method to strip a >> string >> prefix

Re: [PATCH v8 5/7] rust: str: add radix prefixed integer parsing functions

2025-04-04 Thread Andreas Hindborg
"Miguel Ojeda" writes: > On Thu, Feb 27, 2025 at 3:39 PM Andreas Hindborg > wrote: >> >> +// SAFETY: We checked that `val` will fit in `Self` >> above. >> +let val: Self = unsafe { >> val.try_into().unwrap

  1   2   >