All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Amit Sunil Dhamne <amitsd@google.com>,
	Badhri Jagan Sridharan <badhri@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, Hans de Goede <hdegoede@redhat.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] usb: roles: Fix a false positive recursive locking complaint
Date: Thu, 5 Sep 2024 08:01:25 -0700	[thread overview]
Message-ID: <bcfc0db2-d183-4e7b-b9fd-50d370cc0e9b@acm.org> (raw)
In-Reply-To: <d50e3406-1379-4eff-a8c1-9cae89659e3b@google.com>

On 9/4/24 3:34 PM, Amit Sunil Dhamne wrote:
> However, I have seen almost 30+ instances of the prior
> method 
> (https://lore.kernel.org/all/20240822223717.253433-1-amitsd@google.com/)
> of registering lockdep key, which is what I followed.

Many of these examples are for spinlocks. It would be good to have a
variant of spin_lock_init() that does not instantiate a struct
lock_class_key and instead accepts a lock_class_key pointer as argument.

> However, if that's is not the right way, it brings into question the 
> purpose
> of lockdep_set_class() considering I would always and unconditionally use
> __mutex_init()  if I want to manage the lockdep class keys myself or
> mutex_init() if I didn't.
What I'm proposing is not a new pattern. There are multiple examples
in the kernel tree of lockdep_register_key() calls followed by a
__mutex_init() call:

$ git grep -wB3 __mutex_init | grep lockdep_register_key | wc -l
5

Thanks,

Bart.

  reply	other threads:[~2024-09-05 15:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-04 20:18 [PATCH] usb: roles: Fix a false positive recursive locking complaint Bart Van Assche
2024-09-04 21:00 ` Badhri Jagan Sridharan
2024-09-04 21:15   ` Bart Van Assche
2024-09-04 22:34     ` Amit Sunil Dhamne
2024-09-05 15:01       ` Bart Van Assche [this message]
2024-09-05 18:13         ` Andy Shevchenko
2024-09-05 18:14           ` Andy Shevchenko
2024-09-05 18:22             ` Bart Van Assche
2024-09-05 19:23               ` Amit Sunil Dhamne
2024-09-05 19:24               ` Andy Shevchenko
  -- strict thread matches above, loose matches on Subject: below --
2024-09-04 20:17 Bart Van Assche
2024-09-04 20:20 ` Bart Van Assche

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=bcfc0db2-d183-4e7b-b9fd-50d370cc0e9b@acm.org \
    --to=bvanassche@acm.org \
    --cc=amitsd@google.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=badhri@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.