From: Zheyu Ma <zheyuma97@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: GR-Linux-NIC-Dev@marvell.com, kuba@kernel.org,
netdev@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net/qla3xxx: fix schedule while atomic in ql_sem_spinlock
Date: Thu, 20 May 2021 20:13:45 +0800 [thread overview]
Message-ID: <CAMhUBjkCdP-jfnKwAwdCR78tMqgHTPW6qVssE6T66=NrWznkJQ@mail.gmail.com> (raw)
In-Reply-To: <20210519.122605.1971627339402718160.davem@davemloft.net>
On Thu, May 20, 2021 at 3:26 AM David Miller <davem@davemloft.net> wrote:
>
> From: Zheyu Ma <zheyuma97@gmail.com>
> Date: Wed, 19 May 2021 06:49:14 +0000
>
> > When calling the 'ql_sem_spinlock', the driver has already acquired the
> > spin lock, so the driver should not call 'ssleep' in atomic context.
> >
> > This bug can be fixed by unlocking before calling 'ssleep'.
> ...
> > diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c
> > index 214e347097a7..af7c142a066f 100644
> > --- a/drivers/net/ethernet/qlogic/qla3xxx.c
> > +++ b/drivers/net/ethernet/qlogic/qla3xxx.c
> > @@ -114,7 +114,9 @@ static int ql_sem_spinlock(struct ql3_adapter *qdev,
> > value = readl(&port_regs->CommonRegs.semaphoreReg);
> > if ((value & (sem_mask >> 16)) == sem_bits)
> > return 0;
> > + spin_unlock_irq(&qdev->hw_lock);
> > ssleep(1);
> > + spin_lock_irq(&qdev->hw_lock);
> > } while (--seconds);
> > return -1;
> > }
>
> Are you sure dropping the lock like this dos not introduce a race condition?
>
> Thank you.
Thanks for your comment, it is indeed inappropriate to release the
lock here, I will resend the second version of the patch.
Zheyu Ma
prev parent reply other threads:[~2021-05-20 12:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-19 6:49 [PATCH] net/qla3xxx: fix schedule while atomic in ql_sem_spinlock Zheyu Ma
2021-05-19 19:26 ` David Miller
2021-05-20 12:13 ` Zheyu Ma [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='CAMhUBjkCdP-jfnKwAwdCR78tMqgHTPW6qVssE6T66=NrWznkJQ@mail.gmail.com' \
--to=zheyuma97@gmail.com \
--cc=GR-Linux-NIC-Dev@marvell.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.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 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 read-only IMAP folder(s) and NNTP newsgroup(s).