* [PATCH net] tg3: Hold tp->lock before calling tg3_halt() from tg3_init_one()
@ 2015-02-12 1:26 Junichi Nomura
2015-02-12 1:40 ` Prashant Sreedharan
2015-02-12 3:51 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Junichi Nomura @ 2015-02-12 1:26 UTC (permalink / raw)
To: prashant@broadcom.com, mchan@broadcom.com; +Cc: netdev@vger.kernel.org
tg3_init_one() calls tg3_halt() without tp->lock despite its assumption
and causes deadlock.
If lockdep is enabled, a warning like this shows up before the stall:
[ BUG: bad unlock balance detected! ]
3.19.0test #3 Tainted: G E
-------------------------------------
insmod/369 is trying to release lock (&(&tp->lock)->rlock) at:
[<ffffffffa02d5a1d>] tg3_chip_reset+0x14d/0x780 [tg3]
but there are no more locks to release!
tg3_init_one() doesn't call tg3_halt() under normal situation but
during kexec kdump I hit this problem.
Fixes: 932f19de ("tg3: Release tp->lock before invoking synchronize_irq()")
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
---
drivers/net/ethernet/broadcom/tg3.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 615a6db..23a019c 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -17855,8 +17855,10 @@ static int tg3_init_one(struct pci_dev *pdev,
*/
if ((tr32(HOSTCC_MODE) & HOSTCC_MODE_ENABLE) ||
(tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) {
+ tg3_full_lock(tp, 0);
tw32(MEMARB_MODE, MEMARB_MODE_ENABLE);
tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
+ tg3_full_unlock(tp);
}
err = tg3_test_dma(tp);
--
1.9.3
--
Jun'ichi Nomura, NEC Corporation
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] tg3: Hold tp->lock before calling tg3_halt() from tg3_init_one()
2015-02-12 1:26 [PATCH net] tg3: Hold tp->lock before calling tg3_halt() from tg3_init_one() Junichi Nomura
@ 2015-02-12 1:40 ` Prashant Sreedharan
2015-02-12 3:51 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Prashant Sreedharan @ 2015-02-12 1:40 UTC (permalink / raw)
To: Junichi Nomura; +Cc: mchan@broadcom.com, netdev@vger.kernel.org
On Thu, 2015-02-12 at 01:26 +0000, Junichi Nomura wrote:
> tg3_init_one() calls tg3_halt() without tp->lock despite its assumption
> and causes deadlock.
> If lockdep is enabled, a warning like this shows up before the stall:
>
> [ BUG: bad unlock balance detected! ]
> 3.19.0test #3 Tainted: G E
> -------------------------------------
> insmod/369 is trying to release lock (&(&tp->lock)->rlock) at:
> [<ffffffffa02d5a1d>] tg3_chip_reset+0x14d/0x780 [tg3]
> but there are no more locks to release!
>
> tg3_init_one() doesn't call tg3_halt() under normal situation but
> during kexec kdump I hit this problem.
>
> Fixes: 932f19de ("tg3: Release tp->lock before invoking synchronize_irq()")
> Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
> ---
> drivers/net/ethernet/broadcom/tg3.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> index 615a6db..23a019c 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -17855,8 +17855,10 @@ static int tg3_init_one(struct pci_dev *pdev,
> */
> if ((tr32(HOSTCC_MODE) & HOSTCC_MODE_ENABLE) ||
> (tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) {
> + tg3_full_lock(tp, 0);
> tw32(MEMARB_MODE, MEMARB_MODE_ENABLE);
> tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
> + tg3_full_unlock(tp);
> }
>
> err = tg3_test_dma(tp);
> --
> 1.9.3
Acked-by: Prashant Sreedharan <prashant@broadcom.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] tg3: Hold tp->lock before calling tg3_halt() from tg3_init_one()
2015-02-12 1:26 [PATCH net] tg3: Hold tp->lock before calling tg3_halt() from tg3_init_one() Junichi Nomura
2015-02-12 1:40 ` Prashant Sreedharan
@ 2015-02-12 3:51 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-02-12 3:51 UTC (permalink / raw)
To: j-nomura; +Cc: prashant, mchan, netdev
From: Junichi Nomura <j-nomura@ce.jp.nec.com>
Date: Thu, 12 Feb 2015 01:26:24 +0000
> tg3_init_one() calls tg3_halt() without tp->lock despite its assumption
> and causes deadlock.
> If lockdep is enabled, a warning like this shows up before the stall:
>
> [ BUG: bad unlock balance detected! ]
> 3.19.0test #3 Tainted: G E
> -------------------------------------
> insmod/369 is trying to release lock (&(&tp->lock)->rlock) at:
> [<ffffffffa02d5a1d>] tg3_chip_reset+0x14d/0x780 [tg3]
> but there are no more locks to release!
>
> tg3_init_one() doesn't call tg3_halt() under normal situation but
> during kexec kdump I hit this problem.
>
> Fixes: 932f19de ("tg3: Release tp->lock before invoking synchronize_irq()")
> Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-02-12 3:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-12 1:26 [PATCH net] tg3: Hold tp->lock before calling tg3_halt() from tg3_init_one() Junichi Nomura
2015-02-12 1:40 ` Prashant Sreedharan
2015-02-12 3:51 ` David Miller
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).