[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMhUBjkCdP-jfnKwAwdCR78tMqgHTPW6qVssE6T66=NrWznkJQ@mail.gmail.com>
Date: Thu, 20 May 2021 20:13:45 +0800
From: Zheyu Ma <zheyuma97@...il.com>
To: David Miller <davem@...emloft.net>
Cc: GR-Linux-NIC-Dev@...vell.com, kuba@...nel.org,
netdev@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net/qla3xxx: fix schedule while atomic in ql_sem_spinlock
On Thu, May 20, 2021 at 3:26 AM David Miller <davem@...emloft.net> wrote:
>
> From: Zheyu Ma <zheyuma97@...il.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
Powered by blists - more mailing lists