On Wed Jul 9, 2025 at 10:12 PM CEST, Boqun Feng wrote:
> On Wed, Jul 09, 2025 at 08:22:16PM +0200, Benno Lossin wrote:
>> On Wed Jul 9, 2025 at 12:34 PM CEST, Andreas Hindborg wrote:
>> > "Benno Lossin" writes:
>> >> On Tue Jul 8, 2025 at 10:54 AM CEST, An
indborg
A couple notes on safety documentation below. Also one pretty subtle
functionality change from last version. With everything fixed:
Reviewed-by: Benno Lossin
> ---
> rust/kernel/sync.rs | 2 +
> rust/kernel/sync/set_once.rs | 122
>
On Wed Jul 9, 2025 at 12:34 PM CEST, Andreas Hindborg wrote:
> "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 Wed Jul 9, 2025 at 10:56 AM CEST, Andreas Hindborg wrote:
> "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:
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
>>> index 81e3a806e57e2..13e6bc7fa87ac 100644
>>
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
>>> wrote:
>>> >
>>> > Introduce the `SetOnce` type, a container that can only be written once.
mment fix below. (feel free to ignore the nit)
With the safety comment fixed:
Reviewed-by: Benno Lossin
> ---
> rust/kernel/sync.rs | 2 +
> rust/kernel/sync/set_once.rs | 125
> +++
> 2 files changed, 127 insertions(+)
>
>
y: Daniel Gomez
> Reviewed-by: Greg Kroah-Hartman
> Suggested-by: Benno Lossin
> Signed-off-by: Andreas Hindborg
Reviewed-by: Benno Lossin
---
Cheers,
Benno
> ---
> rust/kernel/str.rs | 2 +
> rust/kernel/str/parse_int.rs | 148
> ++
On Mon Jul 7, 2025 at 3:02 PM CEST, Miguel Ojeda wrote:
> On Wed, Jul 2, 2025 at 8:47 PM Benno Lossin wrote:
>>
>> @Miguel are you going to pick this eventually, or do you think it should
>> have a new version with the right splitting?
>
> I guess I could take i
On Fri Jul 4, 2025 at 3:51 PM CEST, Andreas Hindborg wrote:
> "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:
>&
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 sysfs
>>> +
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:
+/// Get a shared reference to the parameter value.
+// Note: When sysfs access to parameters are enabled, we
On Thu Jul 3, 2025 at 6:25 PM CEST, Andreas Hindborg wrote:
> "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:
>&
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:
>>> +///
>>> +/// # Example
>>> +///
>>> +/// ```
>>> +/// # use kerne
On Tue Jul 1, 2025 at 7:35 AM CEST, Onur Özkan wrote:
> This makes it clear that the warning is expected not just
> ignored, so we don't end up having various unnecessary
> linting rules in the codebase.
>
> Some parts of the codebase already use this approach, this
> patch just applies i
On Wed Jul 2, 2025 at 5:27 PM CEST, Alice Ryhl wrote:
> On Wed, Jul 2, 2025 at 5:07 PM Benno Lossin wrote:
>> On Wed Jul 2, 2025 at 3:18 PM CEST, Andreas Hindborg wrote:
>> > +impl OnceLock {
>> > +/// Get a copy of the contained object.
>> > +///
&
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-by: Benno Lossin
> ---
> rust/macros/helpers.rs | 25 +++
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: Benno Lossin
> ---
> rust/kernel/lib.rs | 1 +
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.
>
> Signed-off-by: Andreas Hindborg
> ---
> rust/kernel/sync.rs
On Wed Jul 2, 2025 at 10:26 AM CEST, Andreas Hindborg wrote:
> "Miguel Ojeda" writes:
>
>> On Tue, Jul 1, 2025 at 5:43 PM Benno Lossin wrote:
>>>
>>> Ultimately this is something for Miguel to decide.
>>
>> Only if you all cannot get to an agre
On Tue Jul 1, 2025 at 6:27 PM CEST, Miguel Ojeda wrote:
> On Tue, Jul 1, 2025 at 5:43 PM Benno Lossin wrote:
>>
>> Ultimately this is something for Miguel to decide.
>
> Only if you all cannot get to an agreement ;)
:)
> If Andreas wants to have it already added, then I
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.
>>>
>>> But, progress is still great. How about if we add a
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 Jun 30, 2025 at 1:18 PM CEST, Andreas Hindborg wrote:
&g
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 idea if the orderings are correct, I always have to think w
On Mon Jun 30, 2025 at 2:23 PM CEST, Danilo Krummrich wrote:
> On 6/30/25 2:18 PM, Danilo Krummrich wrote:
>> On 6/30/25 2:12 PM, Andreas Hindborg wrote:
>>> "Danilo Krummrich" writes:
>>>
(Sorry for being late on this one, just a minor nit below.)
On 6/12/25 3:40 PM, Andreas Hindbo
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 Lossin" writes:
>>>>> That's
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.
>>>
>>> I don't think that we can just use a `Mutex
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:
>>>
>>>> On Fri Jun 20, 2025 at 1:29 PM CEST, Andre
On Mon Jun 23, 2025 at 2:37 PM CEST, Miguel Ojeda wrote:
> On Mon, Jun 23, 2025 at 1:48 PM Benno Lossin wrote:
>>
>> Another way would be to use a `Once`-like type (does that exist on the C
>> side?) so a type that can be initialized once and then never changes.
>
> The
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:
>>>> On Thu Jun 12, 2025 at 3:40 PM CEST, Andreas Hindb
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.
>>> +///
>>> +/// This type is instantiated by the [`m
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 should never need to instantiate this type directly.
> +///
> +/// Note: This type
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:
>>> +
>>> +// SAFETY: C kernel handles serializing access to this type. We never
>>> access it
>&
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 explanation:
The safety requirement for implementing the `FromStrRadix`:
/// The
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;
> +};
> +
> +for param in params {
> +let ops = param_ops_path(¶m.ptype);
> +
>
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 | 1 +
> rust/kernel/module_param.rs | 201
>
> 2 file
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) -> Result {
> +match src.deref() {
> +[b'-', rest @ ..] => {
>
ess
> the local via reference rather than value.
>
> Signed-off-by: Andreas Hindborg
Reviewed-by: Benno Lossin
---
Cheers,
Benno
> ---
> rust/macros/module.rs | 20 ++--
> 1 file changed, 10 insertions(+), 10 deletions(-)
On Thu Jun 12, 2025 at 3:40 PM CEST, Andreas Hindborg wrote:
> Showcase the rust module parameter support by adding a module parameter to
> the `rust_minimal` sample.
>
> Signed-off-by: Andreas Hindborg
Reviewed-by: Benno Lossin
---
Cheers,
Benno
> ---
> samples/rust/ru
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/helpers.rs
>>> index a3ee27e29a6f..16d300ad3d3b 10
On Tue May 27, 2025 at 3:51 PM CEST, Miguel Ojeda wrote:
> On Tue, May 27, 2025 at 2:06 PM Benno Lossin wrote:
>>
>> We don't need to explicitly import it, as `c_void` is present in the
>> prelude since 3d5bef5d47c3 ("rust: add C FFI types to the prelude").
&g
tps://docs.kernel.org/dev-tools/kunit/index.html>
>
> -use core::{ffi::c_void, fmt};
> +use core::fmt;
> +use kernel::ffi::c_void;
We don't need to explicitly import it, as `c_void` is present in the
prelude since 3d5bef5d47c3 ("rust: add C FFI types to the prelude").
With the import removed:
Reviewed-by: Benno Lossin
---
Cheers,
Benno
On Wed May 7, 2025 at 11:15 AM CEST, Andreas Hindborg wrote:
> "Benno Lossin" writes:
>> On Tue May 6, 2025 at 3:02 PM CEST, Andreas Hindborg wrote:
>>> +pub trait ParseInt: private::FromStrRadix + TryFrom {
>>> +/// Parse a string a
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 modules perspective
> Tested-by: Daniel Gomez
> Reviewed-by: Greg Kroah-
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
> @@ -573,7 +573,6 @@ macro_rules! c_str {
> }
>
> #[cfg(test)]
> -#[expect(clippy::
`&` making
> it fit more naturally with other existing code.
>
> Suggested-by: Benno Lossin
> Link: https://github.com/Rust-for-Linux/linux/issues/1148
> Signed-off-by: Antonio Hickey
Reviewed-by: Benno Lossin
---
Cheers,
Benno
> ---
> rust/kernel/kunit.rs |
__RNvMNtNtCsaYBeKL739Xz_6kernel4sync3rcuNtB2_5Guard3new 16 -
>-16
> Total: Before=23385830, After=23385730, chg -0.00%
>
> Link: https://github.com/Rust-for-Linux/linux/issues/1145
> Signed-off-by: I Hsin Cheng
Reviewed-by: Benno Lossin
---
Cheers,
Benno
On 18.02.25 12:14, Andreas Hindborg wrote:
> "Gary Guo" writes:
>
>> On Tue, 11 Feb 2025 21:24:44 +0100
>> Andreas Hindborg wrote:
>>
>>> "Gary Guo" writes:
>>>
On Tue, 11 Feb 2025 16:57:36 +0100
Andreas Hindborg wrote:
> The `Index` implementation on `BStr` was lost when we
On 13.09.24 00:37, Sami Tolvanen wrote:
> Hi,
>
> On Thu, Sep 12, 2024 at 2:58 PM Benno Lossin wrote:
>>
>> On 12.09.24 22:58, Sami Tolvanen wrote:
>>> That's an interesting point. Is the problem that you cannot assign
>>> arbitrary values to the R
On 12.09.24 22:58, Sami Tolvanen wrote:
> Hi Benno,
>
> On Thu, Sep 12, 2024 at 11:08 AM Benno Lossin wrote:
>>
>> On 12.09.24 18:06, Sami Tolvanen wrote:
>>>
>>> I thought about this a bit and I wonder if we need a separate
>>> mechanism f
On 12.09.24 18:06, Sami Tolvanen wrote:
> On Wed, Sep 11, 2024 at 4:43 AM Petr Pavlu wrote:
>>
>> On 8/31/24 02:05, Sami Tolvanen wrote:
>>> On Fri, Aug 30, 2024 at 9:34 AM Miroslav Benes wrote:
yes, this is one of the approaches we use in SLES. We add kabi paddings
to some structu
On 24.08.24 23:23, Trevor Gross wrote:
> On Sat, Aug 24, 2024 at 8:16 AM Benno Lossin wrote:
>>> We shouldn't enable `const_mut_refs`. It is indeed close to
>>> stabilization, but it is still kind of churny right now and we don't
>>> want to enable th
On 23.08.24 21:17, Sami Tolvanen wrote:
> On Thu, Aug 22, 2024 at 11:53 PM Greg Kroah-Hartman
> wrote:
>>
>> On Thu, Aug 22, 2024 at 12:00:15PM +, Benno Lossin wrote:
>>>> Here's one example in the android tree where 4 64bit fields are r
On 23.08.24 01:53, Greg Kroah-Hartman wrote:
> On Thu, Aug 22, 2024 at 12:00:15PM +0000, Benno Lossin wrote:
>>> Here's one example in the android tree where 4 64bit fields are reserved
>>> for future abi changes:
>>>
>>> https://android.googlesou
On 24.08.24 13:27, Trevor Gross wrote:
> On Mon, Aug 19, 2024 at 8:35 AM Andreas Hindborg wrote:
>> From: Andreas Hindborg
>> +write!(
>> +self.param_buffer,
>> +"
>> +static mut __{name}_{param_name}_value: {param_type} =
>
On 22.08.24 09:29, Greg Kroah-Hartman wrote:
> On Thu, Aug 22, 2024 at 05:55:32AM +0000, Benno Lossin wrote:
>> On 22.08.24 01:29, Greg Kroah-Hartman wrote:
>>> On Wed, Aug 21, 2024 at 11:31:25AM +, Benno Lossin wrote:
>>>> On 20.08.24 22:03, Matthew Maurer wrote:
On 22.08.24 01:29, Greg Kroah-Hartman wrote:
> On Wed, Aug 21, 2024 at 11:31:25AM +0000, Benno Lossin wrote:
>> On 20.08.24 22:03, Matthew Maurer wrote:
>>>>> The way `KAbiReserved` is implemented is via a `union` (maybe a bit
>>>>> ironic, considering what
On 20.08.24 22:03, Matthew Maurer wrote:
>>> The way `KAbiReserved` is implemented is via a `union` (maybe a bit
>>> ironic, considering what I said in my other replies, but in this case,
>>> we would provide a safe abstraction over this `union`, thus avoiding
>>> exposing users of this type to `un
On 19.08.24 21:38, Sami Tolvanen wrote:
> Hi Benno,
>
> On Sat, Aug 17, 2024 at 01:19:55PM +0000, Benno Lossin wrote:
>>
>> For this use-case (the one in the patch), I don't really know if we want
>> to copy the approach from C. Do we even support exporting kABI
On 19.08.24 20:25, Greg Kroah-Hartman wrote:
> On Sat, Aug 17, 2024 at 01:19:55PM +0000, Benno Lossin wrote:
>> On 17.08.24 09:41, Greg Kroah-Hartman wrote:
>>> On Fri, Aug 16, 2024 at 08:50:53AM -0700, Sami Tolvanen wrote:
>>>> On Fri, Aug 16, 2024 at 12:20 AM
On 17.08.24 09:41, Greg Kroah-Hartman wrote:
> On Fri, Aug 16, 2024 at 08:50:53AM -0700, Sami Tolvanen wrote:
>> On Fri, Aug 16, 2024 at 12:20 AM Greg Kroah-Hartman
>> wrote:
>>> On Thu, Aug 15, 2024 at 05:39:20PM +, Sami Tolvanen wrote:
>>> Especially as I have no idea how you are going to do
On 15.08.24 15:11, Andreas Hindborg wrote:
> "Benno Lossin" writes:
>> On 05.08.24 12:55, Andreas Hindborg wrote:
>>> "Benno Lossin" writes:
>>>> On 02.08.24 12:27, Andreas Hindborg wrote:
>>>>> At a higher level where the bindin
On 05.08.24 12:55, Andreas Hindborg wrote:
> "Benno Lossin" writes:
>> On 02.08.24 12:27, Andreas Hindborg wrote:
>>> At a higher level where the bindings supply the parsing functions, we
>>> can decide that passing an argument without a value yields a default
On 02.08.24 11:31, Alice Ryhl wrote:
> diff --git a/rust/kernel/tracepoint.rs b/rust/kernel/tracepoint.rs
> new file mode 100644
> index ..69dafdb8bfe8
> --- /dev/null
> +++ b/rust/kernel/tracepoint.rs
> @@ -0,0 +1,49 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +// Copyright (C) 202
On 02.08.24 12:27, Andreas Hindborg wrote:
> "Benno Lossin" writes:
>> On 01.08.24 17:11, Andreas Hindborg wrote:
>>> "Benno Lossin" writes:
>>>> On 01.08.24 15:40, Andreas Hindborg wrote:
>>>>> "Benno Lossin" writ
On 01.08.24 17:11, Andreas Hindborg wrote:
> "Benno Lossin" writes:
>> On 01.08.24 15:40, Andreas Hindborg wrote:
>>> "Benno Lossin" writes:
>>>> On 01.08.24 13:29, Andreas Hindborg wrote:
>>>>> "B
On 01.08.24 15:40, Andreas Hindborg wrote:
> "Benno Lossin" writes:
>> On 01.08.24 13:29, Andreas Hindborg wrote:
>>> "Benno Lossin" writes:
>>>> On 05.07.24 13:15, Andreas Hindborg wrote:
>>>>> +
>>>>> +/// Types th
On 01.08.24 13:29, Andreas Hindborg wrote:
>
> Hi Benno,
>
> Thanks for the comments!
>
> "Benno Lossin" writes:
>
>> On 05.07.24 13:15, Andreas Hindborg wrote:
>
> [...]
>
>>> +
>>> +/// Types that can be used for module param
On 28.06.24 15:23, Alice Ryhl wrote:
> diff --git a/rust/kernel/tracepoint.rs b/rust/kernel/tracepoint.rs
> new file mode 100644
> index ..1005f09e0330
> --- /dev/null
> +++ b/rust/kernel/tracepoint.rs
> @@ -0,0 +1,47 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +// Copyright (C) 202
On 05.07.24 13:15, Andreas Hindborg wrote:
> From: Andreas Hindborg
>
> This patch includes changes required for Rust kernel modules to utilize
> module parameters. This code implements read only support for integer
> types without `sysfs` support.
>
> This code is a reduced and updated version
70 matches
Mail list logo