From: Amit Sunil Dhamne <amitsd@google.com>
To: Bart Van Assche <bvanassche@acm.org>,
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: Wed, 4 Sep 2024 15:34:12 -0700 [thread overview]
Message-ID: <d50e3406-1379-4eff-a8c1-9cae89659e3b@google.com> (raw)
In-Reply-To: <8feac105-fa35-4c35-bbac-5d0265761c2d@acm.org>
Hi Bart,
On 9/4/24 2:15 PM, Bart Van Assche wrote:
> On 9/4/24 2:00 PM, Badhri Jagan Sridharan wrote:
>> https://lore.kernel.org/all/ZsiYRAJST%2F2hAju1@kuha.fi.intel.com/ was
>> already accepted
>
> Thanks, I hadn't noticed this yet.
>
>> and is perhaps better than what you are suggesting as
>> it does not use the internal methods of mutex_init().
>
> Although I do not have a strong opinion about which patch is sent to
> Linus, I think my patch has multiple advantages compared to the patch
> mentioned above:
> - Cleaner. lockdep_set_class() is not used. Hence, it is not possible
> that the wrong lockdep key is used (the one assigned by
> mutex_init()).
> - The lock_class_key declaration occurs close to the sw->lock
> declaration.
> - The lockdep_register_key() call occurs close to __mutex_init() call
> that uses the registered key.
> - Needs less memory in debug kernels. The advantage of __mutex_init()
> compared to mutex_init() is that it does not allocate (static) memory
> for a lockdep key.
>
Thanks for the patch.
While I agree on (1) & (4), *may* be a good reason to reconsider.
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.
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.
Thanks,
Amit
> Thanks,
>
> Bart.
>
next prev parent reply other threads:[~2024-09-04 22:34 UTC|newest]
Thread overview: 10+ 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 [this message]
2024-09-05 15:01 ` Bart Van Assche
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
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=d50e3406-1379-4eff-a8c1-9cae89659e3b@google.com \
--to=amitsd@google.com \
--cc=andy.shevchenko@gmail.com \
--cc=badhri@google.com \
--cc=bvanassche@acm.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox