[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <BD330420-E9AA-40B5-B908-71F6108DD22F@collabora.com>
Date: Tue, 21 Oct 2025 10:31:35 -0300
From: Daniel Almeida <daniel.almeida@...labora.com>
To: Onur <work@...rozkan.dev>
Cc: rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org,
lossin@...nel.org,
lyude@...hat.com,
ojeda@...nel.org,
alex.gaynor@...il.com,
boqun.feng@...il.com,
gary@...yguo.net,
a.hindborg@...nel.org,
aliceryhl@...gle.com,
tmgross@...ch.edu,
dakr@...nel.org,
peterz@...radead.org,
mingo@...hat.com,
will@...nel.org,
longman@...hat.com,
felipe_life@...e.com,
daniel@...lak.dev,
bjorn3_gh@...tonmail.com
Subject: Re: [PATCH v6 5/7] rust: ww_mutex: add context-free locking functions
> On 6 Sep 2025, at 08:20, Onur <work@...rozkan.dev> wrote:
>
> On Fri, 5 Sep 2025 16:14:59 -0300
> Daniel Almeida <daniel.almeida@...labora.com> wrote:
>
>> Hi Onur
>>
>>> On 3 Sep 2025, at 10:13, Onur Özkan <work@...rozkan.dev> wrote:
>>>
>>> Adds new `WwMutex` functions (`lock`, `lock_interruptible`,
>>> `lock_slow`, `lock_slow_interruptible` and `try_lock`) that
>>> can be used without `WwAcquireCtx`. This provides simpler API
>>> when deadlock avoidance grouping is not needed.
>>>
>>> Signed-off-by: Onur Özkan <work@...rozkan.dev>
>>> ---
>>> rust/kernel/sync/lock/ww_mutex.rs | 162
>>> ++++++++++++++++++++++-------- 1 file changed, 122 insertions(+),
>>> 40 deletions(-)
>>>
>>> diff --git a/rust/kernel/sync/lock/ww_mutex.rs
>>> b/rust/kernel/sync/lock/ww_mutex.rs index
>>> d289718d2c98..b415d6deae9b 100644 ---
>>> a/rust/kernel/sync/lock/ww_mutex.rs +++
>>> b/rust/kernel/sync/lock/ww_mutex.rs @@ -138,6 +138,75 @@ pub fn
>>> new_wound_wait(name: &'static CStr) -> impl PinInit<Self> { }
>>> }
>>>
>>> +/// Locking kinds used by [`lock_common`] to unify internal FFI
>>> locking logic.
>>
>> Can you please mention how this is not exposed to the outside world?
>>
>> It should be obvious from its private visibility, but still.
>>
>
> I would like to keep this private and force users to go through the
> public ones. This function contains the entire internal locking logic
> and its signature may need to change if we update any of the internals.
> Since it's private, we can safely make breaking changes without
> affecting external calls.
>
> The public functions on the other hand are much more stable (at worst,
> only one or two of them might need a breaking change).
>
That’s fine, what I mean is that you should mention that users aren’t
expected to use it directly.
Again, this is obvious (given that the visibility is private) but it
doesn’t hurt to explain things a bit more on the docs.
— Daniel
Powered by blists - more mailing lists