linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] qed: Fix a sleep-in-interrupt bug in qed_int_sp_dpc
@ 2017-05-31 14:23 Jia-Ju Bai
  2017-05-31 17:59 ` Mintz, Yuval
  0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2017-05-31 14:23 UTC (permalink / raw)
  To: Yuval.Mintz, Ariel.Elior, everest-linux-l2
  Cc: netdev, linux-kernel, Jia-Ju Bai

The driver may sleep in interrupt handling, and the function call path is:
qed_int_sp_dpc (tasklet_init indicates it handles interrupt)
  qed_int_attentions
    qed_mcp_handle_events
      qed_mcp_handle_link_change
        qed_link_update
          qed_fill_link
            qed_mcp_get_media_type
              qed_ptt_acquire
                usleep_range --> may sleep

To fix it, the "usleep_range" is replaced with "udelay".

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
---
 drivers/net/ethernet/qlogic/qed/qed_hw.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_hw.c b/drivers/net/ethernet/qlogic/qed/qed_hw.c
index a05feb3..3250cc4 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_hw.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_hw.c
@@ -131,7 +131,7 @@ struct qed_ptt *qed_ptt_acquire(struct qed_hwfn *p_hwfn)
 		}
 
 		spin_unlock_bh(&p_hwfn->p_ptt_pool->lock);
-		usleep_range(1000, 2000);
+		udelay(1500);
 	}
 
 	DP_NOTICE(p_hwfn, "PTT acquire timeout - failed to allocate PTT\n");
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [PATCH] qed: Fix a sleep-in-interrupt bug in qed_int_sp_dpc
  2017-05-31 14:23 [PATCH] qed: Fix a sleep-in-interrupt bug in qed_int_sp_dpc Jia-Ju Bai
@ 2017-05-31 17:59 ` Mintz, Yuval
  0 siblings, 0 replies; 2+ messages in thread
From: Mintz, Yuval @ 2017-05-31 17:59 UTC (permalink / raw)
  To: Jia-Ju Bai; +Cc: netdev, linux-kernel

> The driver may sleep in interrupt handling, and the function call path is:
> qed_int_sp_dpc (tasklet_init indicates it handles interrupt)
>   qed_int_attentions
>     qed_mcp_handle_events
>       qed_mcp_handle_link_change
>         qed_link_update
>           qed_fill_link
>             qed_mcp_get_media_type
>               qed_ptt_acquire
>                 usleep_range --> may sleep
> 
> To fix it, the "usleep_range" is replaced with "udelay".

Thanks for pointing this out, but I believe the fix isn't the right one.

The better option would be to propagate the PTT from the outside
instead of acquiring a new one - in the call stack you've shared
qed_mcp_link_change() held a PTT entry and we could have propagated
it all the way through.

I'll try sending a fix for this in the next couple of days.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-31 18:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-31 14:23 [PATCH] qed: Fix a sleep-in-interrupt bug in qed_int_sp_dpc Jia-Ju Bai
2017-05-31 17:59 ` Mintz, Yuval

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).