From: Frederic Weisbecker <frederic@kernel.org>
To: Tejun Heo <tj@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: Wed, 18 Oct 2023 14:13:50 +0200 [thread overview]
Message-ID: <ZS_L_pWMNVYLka-K@localhost.localdomain> (raw)
In-Reply-To: <ZS-rCIejToOlJcqm@slm.duckdns.org>
Le Tue, Oct 17, 2023 at 11:53:12PM -1000, Tejun Heo a écrit :
> 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.
No problem, thanks a lot!
>
> Thanks.
>
> --
> tejun
prev parent reply other threads:[~2023-10-18 12:13 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
2023-10-18 12:13 ` Frederic Weisbecker [this message]
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_L_pWMNVYLka-K@localhost.localdomain \
--to=frederic@kernel.org \
--cc=jiangshanlai@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=tj@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.