Re: [Patch 0/2] sysfs: fix s_active lockdep warning

From: Alan Stern
Date: Thu Feb 04 2010 - 13:37:10 EST


On Thu, 4 Feb 2010, Peter Zijlstra wrote:

> > This doesn't address the fact that we really have multiple device trees
> > (for example, class devices are handled separately from normal
> > devices). With the above patch installed, I still get lockdep
> > violations farther on during boot:
>
> <snip lockdep splat>
>
> Hmm, so you have multiple interacting trees? I had understood you only
> had a single device tree.

The real situation is kind of complicated, and I'm not familiar with
all the details. But it's certainly true that a driver will want to
work with (and lock!) multiple struct device's that don't have a
parent-child relation in the tree. The simplest example is regular
devices together with class devices, and another might be PCI devices
together with their "shadow" ACPI devices.

> So how many trees are there, is that fixed?
> Does the device know what tree it is going to end up in?

The driver generally knows, but AFAIK that information is not passed
back to the driver core. At least, not directly -- you might say that
it could be deduced from the parent pointer, assuming the core already
knows all about the parent.

> If yes, then you can extend the setup_mutex_depth() function to pick a
> different class stack for each tree.

Maybe this could be done. But for now perhaps a compromise is in
order. We could make the switch from semaphores to mutexes while
avoiding lockdep issues by assigning the device mutexes to a
"don't-verify" class. Is there such a thing, or could it be added?

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/