mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] padata: fix lockdep warning in padata_find_next()
@ 2026-11-02 15:53 Tristan Madani
  2026-11-02 16:26 ` Tristan Madani
  2026-11-03 11:36 ` Bradley Morgan
  0 siblings, 2 replies; 3+ messages in thread
From: Tristan Madani @ 2026-11-02 15:53 UTC (permalink / raw)
  To: steffen.klassert, daniel.m.jordan
  Cc: herbert, linux-crypto, linux-kernel, stable, Tristan Madani

padata_find_next() acquires reorder->lock while the caller
padata_reorder() already holds squeue->serial.lock. Both locks are of
type struct padata_list and thus share the same lockdep class, which
triggers a false positive recursive locking warning even though the two
instances always protect different data.

Annotate the inner lock with spin_lock_nested() to tell lockdep about
the valid nesting.

Fixes: 16295bec6398 ("padata: Generic parallelization/serialization interface")
Cc: stable@vger.kernel.org
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
 kernel/padata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/padata.c b/kernel/padata.c
index 0d3ea1b68b1f7..2f769ba7dfa99 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);
 	if (list_empty(&reorder->list))
 		goto notfound;
 
-- 
2.47.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] padata: fix lockdep warning in padata_find_next()
  2026-11-02 15:53 [PATCH] padata: fix lockdep warning in padata_find_next() Tristan Madani
@ 2026-11-02 16:26 ` Tristan Madani
  2026-11-03 11:36 ` Bradley Morgan
  1 sibling, 0 replies; 3+ messages in thread
From: Tristan Madani @ 2026-11-02 16:26 UTC (permalink / raw)
  To: herbert, linux-crypto, linux-kernel, sashiko-bot,
	steffen.klassert, daniel.m.jordan

On Mon, 02 Nov 2026, sashiko-bot@kernel.org wrote:
> [Medium] padata: redundant spin_lock_nested() in padata_find_next() splits lock class

You are right. Commit af3852cda347 ("padata: remove __padata_list_init()")
already resolved this by giving squeue->serial.lock and reorder->lock
separate lock_class_key via separate spin_lock_init() call sites.

The spin_lock_nested() annotation is redundant and would incorrectly split
the subclass.

Please drop this patch.

Thanks,
Tristan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] padata: fix lockdep warning in padata_find_next()
  2026-11-02 15:53 [PATCH] padata: fix lockdep warning in padata_find_next() Tristan Madani
  2026-11-02 16:26 ` Tristan Madani
@ 2026-11-03 11:36 ` Bradley Morgan
  1 sibling, 0 replies; 3+ messages in thread
From: Bradley Morgan @ 2026-11-03 11:36 UTC (permalink / raw)
  To: tristmd
  Cc: daniel.m.jordan, herbert, linux-crypto, linux-kernel, stable,
	steffen.klassert, tristan

On 2 November 2026 15:53:53 GMT, Tristan Madani <tristmd@gmail.com> wrote:
>padata_find_next() acquires reorder->lock while the caller
>padata_reorder() already holds squeue->serial.lock. Both locks are of
>type struct padata_list and thus share the same lockdep class, which
>triggers a false positive recursive locking warning even though the two
>instances always protect different data.
>
>Annotate the inner lock with spin_lock_nested() to tell lockdep about
>the valid nesting.
>
>Fixes: 16295bec6398 ("padata: Generic parallelization/serialization interface")
>Cc: stable@vger.kernel.org
>Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
>---
> kernel/padata.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/kernel/padata.c b/kernel/padata.c
>index 0d3ea1b68b1f7..2f769ba7dfa99 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);

I'll bite.

Reviewed-by: Bradley Morgan <brads@mainlining.org>


> 	if (list_empty(&reorder->list))
> 		goto notfound;
> 
>

--- Thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-03 11:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-02 15:53 [PATCH] padata: fix lockdep warning in padata_find_next() Tristan Madani
2026-11-02 16:26 ` Tristan Madani
2026-11-03 11:36 ` Bradley Morgan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®