Re: [PATCH 03/13] rust: lock: introduce `Mutex`
From: Boqun Feng
Date: Thu Mar 30 2023 - 14:48:03 EST
On Thu, Mar 30, 2023 at 03:01:08PM +0200, Peter Zijlstra wrote:
> On Thu, Mar 30, 2023 at 01:39:44AM -0300, Wedson Almeida Filho wrote:
> > From: Wedson Almeida Filho <walmeida@xxxxxxxxxxxxx>
> >
> > This is the `struct mutex` lock backend and allows Rust code to use the
> > kernel mutex idiomatically.
>
> What, if anything, are the plans to support the various lockdep
> annotations? Idem for the spinlock thing in the other patch I suppose.
FWIW:
* At the init stage, SpinLock and Mutex in Rust use initializers
that are aware of the lockdep, so everything (lockdep_map and
lock_class) is all set up.
* At acquire or release time, Rust locks just use ffi to call C
functions that have lockdep annotations in them, so lockdep
should just work.
In fact, I shared some same worry as you, so I already work on adding
lockdep selftests for Rust lock APIs, will send them shortly, although
they are just draft.
Regards,
Boqun