linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steffen Klassert <steffen.klassert@secunet.com>
To: Daniel Jordan <daniel.m.jordan@oracle.com>
Cc: <eadavis@sina.com>, <linux-crypto@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<syzbot+bc05445bc14148d51915@syzkaller.appspotmail.com>,
	<syzkaller-bugs@googlegroups.com>
Subject: Re: [PATCH] padata: fix lockdep warning in padata serialization
Date: Tue, 20 Sep 2022 07:54:43 +0200	[thread overview]
Message-ID: <20220920055443.GI2950045@gauss3.secunet.de> (raw)
In-Reply-To: <20220920014711.bvreurf4ex44w6oj@oracle.com>

On Mon, Sep 19, 2022 at 09:47:11PM -0400, Daniel Jordan wrote:
> On Tue, Sep 20, 2022 at 08:39:08AM +0800, eadavis@sina.com wrote:
> > From: Edward Adam Davis <eadavis@sina.com>
> > 
> > On Mon, 19 Sep 2022 11:12:48 -0400, Daniel Jordan wrote:
> > > Hi Edward,
> > > 
> > > On Mon, Sep 19, 2022 at 09:05:55AM +0800, eadavis@sina.com wrote:
> > > > From: Edward Adam Davis <eadavis@sina.com>
> > > > 
> > > > Parallelized object serialization uses spin_unlock for unlocking a spin lock
> > > > that was previously locked with spin_lock.
> > > 
> > > There's nothing unusual about that, though?
> > > 
> > > > This caused the following lockdep warning about an inconsistent lock
> > > > state:
> > > > 
> > > >         inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.
> > > 
> > > Neither HARDIRQ-ON-W nor IN-HARDIRQ-W appear in the syzbot report, did
> > > you mean SOFTIRQ-ON-W and IN-SOFTIRQ-W?
> > Yes, I want say: inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
> > > 
> > > > We must use spin_lock_irqsave, because it is possible to trigger tipc 
> > > > from an irq handler.
> > > 
> > > A softirq handler, not a hardirq handler.  I'd suggest using
> > > spin_lock_bh() instead of _irqsave in your patch.
> > I think _irqsave better than _bh, it can save the irq context, but _bh not, 
> > and in tipc call trace contain SOFTIRQ-ON-W and IN-SOFTIRQ-W.
> 
> _irqsave saving the context is about handling nested hardirq disables.
> It's not needed here since we don't need to care about disabling
> hardirq.
> 
> _bh is for disabling softirq, a different context from hardirq.  We want
> _bh here since the deadlock happens when a CPU takes the lock in both
> task and softirq context.  padata uses _bh lock variants because it can
> be called in softirq context but not hardirq.  Let's be consistent and
> do it in this case too.

padata_do_serial is called with BHs off, so using spin_lock_bh should not
fix anything here. I guess the problem is that we call padata_find_next
after we enabled the BHs in padata_reorder.

  reply	other threads:[~2022-09-20  6:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-18 19:43 [syzbot] inconsistent lock state in padata_do_serial (2) syzbot
     [not found] ` <20220919010555.130609-1-eadavis@sina.com>
2022-09-19 15:12   ` [PATCH] padata: fix lockdep warning in padata serialization Daniel Jordan
2022-09-19 15:27     ` Daniel Jordan
     [not found]       ` <20220920012508.403159-1-eadavis@sina.com>
2022-09-20  1:48         ` [PATCH v2] padata: fix lockdep warning Daniel Jordan
     [not found]     ` <20220920003908.391835-1-eadavis@sina.com>
2022-09-20  1:47       ` [PATCH] padata: fix lockdep warning in padata serialization Daniel Jordan
2022-09-20  5:54         ` Steffen Klassert [this message]
2022-09-20 14:10           ` Daniel Jordan
2022-09-21  7:36             ` Steffen Klassert
2022-09-21 18:51               ` Daniel Jordan
2022-09-22 10:55                 ` Steffen Klassert
2022-09-23  2:07                   ` Daniel Jordan

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=20220920055443.GI2950045@gauss3.secunet.de \
    --to=steffen.klassert@secunet.com \
    --cc=daniel.m.jordan@oracle.com \
    --cc=eadavis@sina.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+bc05445bc14148d51915@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.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;
as well as URLs for NNTP newsgroup(s).