Re: [PATCH] net/qla3xxx: fix schedule while atomic in ql_sem_spinlock
From: Zheyu Ma <hidden>
Date: 2021-05-20 12:50:19
Also in:
lkml
On Thu, May 20, 2021 at 3:26 AM David Miller [off-list ref] wrote:
From: Zheyu Ma <redacted> Date: Wed, 19 May 2021 06:49:14 +0000quoted
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'....quoted
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