From: sashiko-bot@kernel.org
To: "Tristan Madani" <tristmd@gmail.com>,
steffen.klassert@secunet.com, daniel.m.jordan@oracle.com
Cc: herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org,
"Tristan Madani" <tristan@talencesecurity.com>
Subject: Re: [PATCH] padata: fix lockdep warning in padata_find_next()
Date: Mon, 02 Nov 2026 16:00:55 +0000 [thread overview]
Message-ID: <sashiko-outbox-193718@kernel.org> (raw)
In-Reply-To: <20261102155353.1268322-1-tristan@talencesecurity.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] padata: redundant spin_lock_nested() in padata_find_next() splits lock class
--
commit d8de136037d32da1b6bd4096b78d163c014e8d23
Author: Tristan Madani <tristmd@gmail.com>
padata: fix lockdep warning in padata_find_next()
This commit replaces spin_lock() with spin_lock_nested() in
padata_find_next() to annotate acquiring reorder->lock while
padata_reorder() holds squeue->serial.lock.
> diff --git a/kernel/padata.c b/kernel/padata.c
> index 5a113c667d4cb..94d7880a001c4 100644
> --- a/kernel/padata.c
> +++ b/kernel/padata.c
> @@ -253,7 +253,7 @@ static struct padata_priv *padata_find_next(struct parallel_data *pd, int cpu,
>
> reorder = per_cpu_ptr(pd->reorder_list, cpu);
>
> - spin_lock(&reorder->lock);
> + spin_lock_nested(&reorder->lock, SINGLE_DEPTH_NESTING);
[Severity: Medium]
Is this spin_lock_nested() annotation still needed here, and does it split
reorder->lock across two lockdep subclasses?
In Linux, spin_lock_init() assigns a lock_class_key per macro expansion site
rather than per C struct type. Historically, squeue->serial.lock and
reorder->lock shared a lockdep class because both were initialized via a
common helper __padata_list_init() (and padata_find_next() was moved inside
squeue->serial.lock in commit 71203f68c774 ("padata: Fix list-related race
in padata_find_next"), rather than commit 16295bec6398).
However, commit af3852cda347 ("padata: remove __padata_list_init()") removed
that helper and initialized the two locks at separate spin_lock_init() call
sites in kernel/padata.c:
padata_init_squeues()
INIT_LIST_HEAD(&squeue->serial.list);
spin_lock_init(&squeue->serial.lock);
padata_init_reorder_list()
INIT_LIST_HEAD(&list->list);
spin_lock_init(&list->lock);
Because squeue->serial.lock and reorder->lock already have distinct lockdep
classes, acquiring reorder->lock inside squeue->serial.lock does not trigger
a recursive locking warning on current kernels.
Meanwhile, padata_do_serial() acquires the same reorder->lock at the default
subclass 0 before calling padata_reorder():
padata_do_serial()
spin_lock(&reorder->lock);
...
spin_unlock(&reorder->lock);
if (gotit)
padata_reorder(padata);
spin_lock(&squeue->serial.lock);
padata_find_next()
spin_lock_nested(&reorder->lock, SINGLE_DEPTH_NESTING);
Won't annotating reorder->lock with SINGLE_DEPTH_NESTING in
padata_find_next() while padata_do_serial() acquires it at subclass 0 cause
lockdep to track the same physical lock as two separate subclasses, hiding
lock ordering dependencies between padata_do_serial() and
padata_find_next()?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261102155353.1268322-1-tristan@talencesecurity.com?part=1
next prev parent reply other threads:[~2026-11-02 16:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 15:53 [PATCH] padata: fix lockdep warning in padata_find_next() Tristan Madani
2026-11-02 16:00 ` sashiko-bot [this message]
2026-11-02 16:26 ` Tristan Madani
2026-11-03 11:36 ` Bradley Morgan
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=sashiko-outbox-193718@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=daniel.m.jordan@oracle.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=steffen.klassert@secunet.com \
--cc=tristan@talencesecurity.com \
--cc=tristmd@gmail.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