Re: [PATCH RFC] drivers/core: Replace lockdep_set_novalidate_class() with unique class keys
From: Alan Stern
Date: Mon Feb 13 2023 - 10:25:16 EST
On Sun, Feb 12, 2023 at 09:21:14PM -0500, Kent Overstreet wrote:
> On Sun, Feb 12, 2023 at 08:23:34PM -0500, Alan Stern wrote:
> > I really don't think that's a good idea here. When you've got a bus
> > containing multiple devices, typically all those device structures are
> > created by the same line of code. So knowing the source code location
> > won't tell you _which_ device structure is involved in the locking
> > cycle or what driver it's using.
>
> Yeah, I was thinking about this more and realized it'd be insufficient.
>
> > By contrast, knowing the device name
> > would.
> >
> > Furthermore, to the extent that the device's name identifies what kind
> > of device it is, the name would tell you what where the structure was
> > created and which driver it is using.
>
> OTOH, with the device name, it seems like you'll additionally need the
> full device topology to be able to do anything with lockdep splats, no?
Not necessarily. Knowing the name already tells you something about
where the device fits into the full tree. And if necessary, you can
probably glean the necessary information from the kernel log.
Besides, you often don't need the full device topology. For instance,
if the problem is that a driver is flushing a work queue while holding a
lock needed by an item on the queue, mostly you just need to know what
driver and where the flush occurs -- and that information is already
provided by lockdep.
> What if we just added a way to set a comparison function for a lockdep
> class? I'm looking at the lockdep code now, and I think I could do that
> for you.
I don't know what a lockdep class comparison function does (or would
do). Nor how having one would help.
Alan Stern