public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	Ingo Molnar <mingo@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-gpio <linux-gpio@vger.kernel.org>
Subject: Re: lockdep: incorrect deadlock warning with two GPIO expanders
Date: Thu, 15 Sep 2016 16:38:34 +0200	[thread overview]
Message-ID: <20160915143834.GE5012@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <CAMpxmJWTyv=7GAN2KZH2yShG=0U6i8KaLd8dT71ROwE19EoCTQ@mail.gmail.com>

On Thu, Sep 15, 2016 at 04:08:52PM +0200, Bartosz Golaszewski wrote:
> 2016-09-15 15:39 GMT+02:00 Peter Zijlstra <peterz@infradead.org>:

> > In any case, if this fails, we can always punt and simply count the
> > total number of instances of this driver on the system and go with that.
> >
> 
> But for __mutex_init() to work with the key argument you need to know
> it at compile time, right?

You can do something like:

	mutex_init(&mutex);
	lockdep_set_subclass(&mutex, nr);

which will of course fail at runtime the moment nr >= 8, but is that
really a concern?

Equally you can do:

static struct lock_class_key my_keys[NR];

	mutex_init(&mutex);
	BUG_ON(nr > NR);
	lockdep_set_class(&mutex, my_keys + nr);

and have a bigger limit.

  reply	other threads:[~2016-09-15 14:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-12 11:51 lockdep: incorrect deadlock warning with two GPIO expanders Bartosz Golaszewski
2016-09-12 12:09 ` Peter Zijlstra
2016-09-12 15:16   ` Bartosz Golaszewski
2016-09-12 15:33     ` Peter Zijlstra
2016-09-13 12:29       ` Linus Walleij
2016-09-15  7:51         ` Peter Zijlstra
2016-09-15 12:41           ` Linus Walleij
2016-09-15 13:20             ` Bartosz Golaszewski
2016-09-15 13:39               ` Peter Zijlstra
2016-09-15 14:08                 ` Bartosz Golaszewski
2016-09-15 14:38                   ` Peter Zijlstra [this message]
2016-09-15 15:23                     ` Bartosz Golaszewski
2016-09-16 10:56                 ` Peter Zijlstra
2016-09-16 11:14                   ` Bartosz Golaszewski
2016-09-16 12:00                     ` Bartosz Golaszewski
2016-09-16 14:21             ` Bartosz Golaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160915143834.GE5012@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bgolaszewski@baylibre.com \
    --cc=gnurou@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox