[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y+pnHb0MCbx9dDj3@hirez.programming.kicks-ass.net>
Date: Mon, 13 Feb 2023 17:36:45 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Alan Stern <stern@...land.harvard.edu>
Cc: Kent Overstreet <kent.overstreet@...ux.dev>,
Kent Overstreet <kent.overstreet@...il.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Coly Li <colyli@...e.de>,
Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
syzkaller <syzkaller@...glegroups.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Ingo Molnar <mingo@...hat.com>,
Boqun Feng <boqun.feng@...il.com>,
LKML <linux-kernel@...r.kernel.org>,
USB list <linux-usb@...r.kernel.org>,
Hillf Danton <hdanton@...a.com>
Subject: Re: [PATCH RFC] drivers/core: Replace lockdep_set_novalidate_class()
with unique class keys
On Mon, Feb 13, 2023 at 10:28:08AM -0500, Alan Stern wrote:
> On Mon, Feb 13, 2023 at 10:27:18AM +0100, Peter Zijlstra wrote:
> > On Sun, Feb 12, 2023 at 03:19:16PM -0500, Alan Stern wrote:
> >
> > > (Device names are often set after the device is initialized. Does
> > > lockdep mind if a lock_class_key's name is changed after it has been
> > > registered?)
> >
> > It does, althought I don't at the moment recall how hard it would be to
> > change that.
>
> If the names are only used for printing purposes, or other similarly
> innocuous things, it ought to be enough to set the name with
> smp_store_release() and read the name with smp_load_acquire().
The name is copied from the key to the 'class' upon registration of the
first lock that uses a particular key. Then later, when looking up the
class for subsequent usages of the same key, the string is checked, and
WARNs if they somehow not match.
Granted, this is a silly sanity check that's easily disabled. But from a
cursory look that seems to be just about it.
The only 'problem' is that it's (typically) class name that's printed,
not the key name, so if you change the key name, without also changing
the class name, reports get really confusing.
Still, that all ought to be fixable.. just a matter of typing or so :-)
Powered by blists - more mailing lists