Skip to content

Commit 932f19d

Browse files
Prashant Sreedharandavem330
Prashant Sreedharan
authored andcommitted
tg3: Release tp->lock before invoking synchronize_irq()
synchronize_irq() can sleep waiting, for pending IRQ handlers so driver should release the tp->lock spin lock before invoking synchronize_irq() Reported-by: Peter Hurley <[email protected]> Tested-by: Peter Hurley <[email protected]> Signed-off-by: Prashant Sreedharan <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent db84bf4 commit 932f19d

File tree

1 file changed

+12
-0
lines changed
  • drivers/net/ethernet/broadcom

1 file changed

+12
-0
lines changed

drivers/net/ethernet/broadcom/tg3.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7413,6 +7413,8 @@ static inline void tg3_netif_start(struct tg3 *tp)
74137413
}
74147414

74157415
static void tg3_irq_quiesce(struct tg3 *tp)
7416+
__releases(tp->lock)
7417+
__acquires(tp->lock)
74167418
{
74177419
int i;
74187420

@@ -7421,8 +7423,12 @@ static void tg3_irq_quiesce(struct tg3 *tp)
74217423
tp->irq_sync = 1;
74227424
smp_mb();
74237425

7426+
spin_unlock_bh(&tp->lock);
7427+
74247428
for (i = 0; i < tp->irq_cnt; i++)
74257429
synchronize_irq(tp->napi[i].irq_vec);
7430+
7431+
spin_lock_bh(&tp->lock);
74267432
}
74277433

74287434
/* Fully shutdown all tg3 driver activity elsewhere in the system.
@@ -9018,6 +9024,8 @@ static void tg3_restore_clk(struct tg3 *tp)
90189024

90199025
/* tp->lock is held. */
90209026
static int tg3_chip_reset(struct tg3 *tp)
9027+
__releases(tp->lock)
9028+
__acquires(tp->lock)
90219029
{
90229030
u32 val;
90239031
void (*write_op)(struct tg3 *, u32, u32);
@@ -9073,9 +9081,13 @@ static int tg3_chip_reset(struct tg3 *tp)
90739081
}
90749082
smp_mb();
90759083

9084+
tg3_full_unlock(tp);
9085+
90769086
for (i = 0; i < tp->irq_cnt; i++)
90779087
synchronize_irq(tp->napi[i].irq_vec);
90789088

9089+
tg3_full_lock(tp, 0);
9090+
90799091
if (tg3_asic_rev(tp) == ASIC_REV_57780) {
90809092
val = tr32(TG3_PCIE_LNKCTL) & ~TG3_PCIE_LNKCTL_L1_PLL_PD_EN;
90819093
tw32(TG3_PCIE_LNKCTL, val | TG3_PCIE_LNKCTL_L1_PLL_PD_DIS);

0 commit comments

Comments
 (0)