From: Tejun Heo <tj@kernel.org>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>,
LKML <linux-kernel@vger.kernel.org>,
"Paul E . McKenney" <paulmck@kernel.org>
Subject: Re: [PATCH] workqueue: Provide one lock class key per work_on_cpu() callsite
Date: Tue, 17 Oct 2023 23:53:12 -1000 [thread overview]
Message-ID: <ZS-rCIejToOlJcqm@slm.duckdns.org> (raw)
In-Reply-To: <20230924150702.9588-1-frederic@kernel.org>
On Sun, Sep 24, 2023 at 05:07:02PM +0200, Frederic Weisbecker wrote:
> All callers of work_on_cpu() share the same lock class key for all the
> functions queued. As a result the workqueue related locking scenario for
> a function A may be spuriously accounted as an inversion against the
> locking scenario of function B such as in the following model:
>
> long A(void *arg)
> {
> mutex_lock(&mutex);
> mutex_unlock(&mutex);
> }
>
> long B(void *arg)
> {
> }
>
> void launchA(void)
> {
> work_on_cpu(0, A, NULL);
> }
>
> void launchB(void)
> {
> mutex_lock(&mutex);
> work_on_cpu(1, B, NULL);
> mutex_unlock(&mutex);
> }
>
> launchA and launchB running concurrently have no chance to deadlock.
> However the above can be reported by lockdep as a possible locking
> inversion because the works containing A() and B() are treated as
> belonging to the same locking class.
Sorry about the delay. I missed this one. Applied to wq/for-6.7.
Thanks.
--
tejun
next prev parent reply other threads:[~2023-10-18 9:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-24 15:07 [PATCH] workqueue: Provide one lock class key per work_on_cpu() callsite Frederic Weisbecker
2023-10-13 11:49 ` Frederic Weisbecker
2023-10-18 9:53 ` Tejun Heo [this message]
2023-10-18 12:13 ` Frederic Weisbecker
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=ZS-rCIejToOlJcqm@slm.duckdns.org \
--to=tj@kernel.org \
--cc=frederic@kernel.org \
--cc=jiangshanlai@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@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