From: angkery <angkery@163.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org,
drt@linux.ibm.com, ljp@linux.ibm.com, sukadev@linux.ibm.com,
davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
Junlin Yang <yangjunlin@yulong.com>
Subject: Re: [PATCH] ibmvnic: remove excessive irqsave
Date: Fri, 5 Mar 2021 15:03:25 +0800 [thread overview]
Message-ID: <20210305150325.0000286b.angkery@163.com> (raw)
In-Reply-To: <67215668-0850-a0f3-06e1-49db590b8fcc@csgroup.eu>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=GB18030, Size: 2197 bytes --]
On Fri, 5 Mar 2021 06:49:14 +0100
Christophe Leroy <christophe.leroy@csgroup.eu> wrote:
> Le 05/03/2021 ¨¤ 02:43, angkery a ¨¦crit02:
> > From: Junlin Yang <yangjunlin@yulong.com>
> >
> > ibmvnic_remove locks multiple spinlocks while disabling interrupts:
> > spin_lock_irqsave(&adapter->state_lock, flags);
> > spin_lock_irqsave(&adapter->rwi_lock, flags);
> >
> > there is no need for the second irqsave,since interrupts are
> > disabled at that point, so remove the second irqsave:
>
> The probl¨¨me is not that there is no need. The problem is a lot more
> serious: As reported by coccinella, the second _irqsave() overwrites
> the value saved in 'flags' by the first _irqsave, therefore when the
> second _irqrestore comes, the value in 'flags' is not valid, the
> value saved by the first _irqsave has been lost. This likely leads to
> IRQs remaining disabled, which is _THE_ problem really.
>
Thank you for explaining the real problem.
I will update the commit information with your description.
> > spin_lock_irqsave(&adapter->state_lock, flags);
> > spin_lock(&adapter->rwi_lock);
> >
> > Generated by: ./scripts/coccinelle/locks/flags.cocci
> > ./drivers/net/ethernet/ibm/ibmvnic.c:5413:1-18:
> > ERROR: nested lock+irqsave that reuses flags from line 5404.
> >
> > Signed-off-by: Junlin Yang <yangjunlin@yulong.com>
> > ---
> > drivers/net/ethernet/ibm/ibmvnic.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/ibm/ibmvnic.c
> > b/drivers/net/ethernet/ibm/ibmvnic.c index 2464c8a..a52668d 100644
> > --- a/drivers/net/ethernet/ibm/ibmvnic.c
> > +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> > @@ -5408,9 +5408,9 @@ static void ibmvnic_remove(struct vio_dev
> > *dev)
> > * after setting state, so __ibmvnic_reset() which is
> > called
> > * from the flush_work() below, can make progress.
> > */
> > - spin_lock_irqsave(&adapter->rwi_lock, flags);
> > + spin_lock(&adapter->rwi_lock);
> > adapter->state = VNIC_REMOVING;
> > - spin_unlock_irqrestore(&adapter->rwi_lock, flags);
> > + spin_unlock(&adapter->rwi_lock);
> >
> > spin_unlock_irqrestore(&adapter->state_lock, flags);
> >
> >
prev parent reply other threads:[~2021-03-05 7:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-05 1:43 [PATCH] ibmvnic: remove excessive irqsave angkery
2021-03-05 4:19 ` Sukadev Bhattiprolu
2021-03-05 5:49 ` Christophe Leroy
2021-03-05 6:04 ` Lijun Pan
2021-03-05 7:03 ` angkery [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=20210305150325.0000286b.angkery@163.com \
--to=angkery@163.com \
--cc=benh@kernel.crashing.org \
--cc=christophe.leroy@csgroup.eu \
--cc=davem@davemloft.net \
--cc=drt@linux.ibm.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=ljp@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=netdev@vger.kernel.org \
--cc=paulus@samba.org \
--cc=sukadev@linux.ibm.com \
--cc=yangjunlin@yulong.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).