Re: [PATCH v2] locking/ww_mutex: Adjust to lockdep nest_lock requirements

2024-10-17 Thread Thomas Hellström
On Wed, 2024-10-16 at 10:12 -0700, Boqun Feng wrote: > On Wed, Oct 16, 2024 at 08:17:50AM +0200, Thomas Hellström wrote: > [...] > > > > > > So even though first_lock_dep_map is a fake lock, it has to have > > > the > > > same wait types as a real mutex. > > > > Understood. > > > > > > Does this

Re: [PATCH v2] locking/ww_mutex: Adjust to lockdep nest_lock requirements

2024-10-16 Thread Boqun Feng
On Wed, Oct 16, 2024 at 08:17:50AM +0200, Thomas Hellström wrote: [...] > > > > So even though first_lock_dep_map is a fake lock, it has to have the > > same wait types as a real mutex. > > Understood. > > > > Does this make sense? > > Yes it does. I'll update to a v3, and add a Tested-by: tag.

Re: [PATCH v2] locking/ww_mutex: Adjust to lockdep nest_lock requirements

2024-10-15 Thread Thomas Hellström
On Tue, 2024-10-15 at 11:00 -0700, Boqun Feng wrote: > On Tue, Oct 15, 2024 at 05:27:28PM +0200, Thomas Hellström wrote: > [..] > > > diff --git a/lib/locking-selftest.c b/lib/locking-selftest.c > > > index 6f6a5fc85b42..6750321e3e9a 100644 > > > --- a/lib/locking-selftest.c > > > +++ b/lib/locking

Re: [PATCH v2] locking/ww_mutex: Adjust to lockdep nest_lock requirements

2024-10-15 Thread Boqun Feng
On Tue, Oct 15, 2024 at 05:27:28PM +0200, Thomas Hellström wrote: [..] > > diff --git a/lib/locking-selftest.c b/lib/locking-selftest.c > > index 6f6a5fc85b42..6750321e3e9a 100644 > > --- a/lib/locking-selftest.c > > +++ b/lib/locking-selftest.c > > @@ -1720,8 +1720,6 @@ static void ww_test_normal(

Re: [PATCH v2] locking/ww_mutex: Adjust to lockdep nest_lock requirements

2024-10-15 Thread Thomas Hellström
On Mon, 2024-10-14 at 13:23 -0700, Boqun Feng wrote: > Hi Thomas, > > On Wed, Oct 09, 2024 at 11:20:31AM +0200, Thomas Hellström wrote: > > When using mutex_acquire_nest() with a nest_lock, lockdep refcounts > > the > > number of acquired lockdep_maps of mutexes of the same class, and > > also > >

Re: [PATCH v2] locking/ww_mutex: Adjust to lockdep nest_lock requirements

2024-10-15 Thread Thomas Hellström
Hi! On Mon, 2024-10-14 at 13:23 -0700, Boqun Feng wrote: > Hi Thomas, > > On Wed, Oct 09, 2024 at 11:20:31AM +0200, Thomas Hellström wrote: > > When using mutex_acquire_nest() with a nest_lock, lockdep refcounts > > the > > number of acquired lockdep_maps of mutexes of the same class, and > > a

Re: [PATCH v2] locking/ww_mutex: Adjust to lockdep nest_lock requirements

2024-10-14 Thread Boqun Feng
Hi Thomas, On Wed, Oct 09, 2024 at 11:20:31AM +0200, Thomas Hellström wrote: > When using mutex_acquire_nest() with a nest_lock, lockdep refcounts the > number of acquired lockdep_maps of mutexes of the same class, and also > keeps a pointer to the first acquired lockdep_map of a class. That point

Re: [PATCH v2] locking/ww_mutex: Adjust to lockdep nest_lock requirements

2024-10-09 Thread Thomas Hellström
On Wed, 2024-10-09 at 15:10 +0200, Peter Zijlstra wrote: > On Wed, Oct 09, 2024 at 11:20:31AM +0200, Thomas Hellström wrote: > > When using mutex_acquire_nest() with a nest_lock, lockdep refcounts > > the > > number of acquired lockdep_maps of mutexes of the same class, and > > also > > keeps a poi

Re: [PATCH v2] locking/ww_mutex: Adjust to lockdep nest_lock requirements

2024-10-09 Thread Peter Zijlstra
On Wed, Oct 09, 2024 at 11:20:31AM +0200, Thomas Hellström wrote: > When using mutex_acquire_nest() with a nest_lock, lockdep refcounts the > number of acquired lockdep_maps of mutexes of the same class, and also > keeps a pointer to the first acquired lockdep_map of a class. That pointer > is then

[PATCH v2] locking/ww_mutex: Adjust to lockdep nest_lock requirements

2024-10-09 Thread Thomas Hellström
When using mutex_acquire_nest() with a nest_lock, lockdep refcounts the number of acquired lockdep_maps of mutexes of the same class, and also keeps a pointer to the first acquired lockdep_map of a class. That pointer is then used for various comparison-, printing- and checking purposes, but there