Re: lockdep: incorrect deadlock warning with two GPIO expanders

From: Peter Zijlstra
Date: Mon Sep 12 2016 - 11:34:07 EST


On Mon, Sep 12, 2016 at 05:16:14PM +0200, Bartosz Golaszewski wrote:

> >> - - - - -
> >> ------- --------- Bus segment 1 | |
> >> | | | |--------------- Devices
> >> | | SCL/SDA | | | |
> >> | Linux |-----------| I2C MUX | - - - - -
> >> | | | | | Bus segment 2
> >> | | | | |-------------------
> >> ------- | --------- |
> >> | | - - - - -
> >> ------------ | MUX GPIO | |
> >> | | | Devices
> >> | GPIO | | | |
> >> | Expander 1 |---- - - - - -
> >> | | |
> >> ------------ | SCL/SDA
> >> |
> >> ------------
> >> | |
> >> | GPIO |
> >> | Expander 2 |
> >> | |
> >> ------------

> > The tricky part, and here I have absolutely no clue what so ever, is
> > being able to tell at pca953x_probe() time that this is so.
> >
>
> AFAIK there is no clean way to tell that a GPIO is used by an I2C
> multiplexer at probe time. Linus, Alexandre could you confirm?

You cannot inspect the device tree while probing?

> It uses the fact that the two expanders we have are of different type
> (pca9534 and pca9535). The id pointer points to per-chip device info
> residing in .data which makes it suitable for mutex key.
>
> I don't think such hack is suitable for mainline though.

Right, that works by accident rather than anything else :-)