在 2023/11/22 下午5:29, Yinjun Zhang 写道:
On Mon, 20 Nov 2023 20:37:34 +0800, Heng Qi wrote:
<...>
@@ -2179,6 +2220,7 @@ static void virtnet_disable_queue_pair(struct 
virtnet_info *vi, int qp_index)
        virtnet_napi_tx_disable(&vi->sq[qp_index].napi);
        napi_disable(&vi->rq[qp_index].napi);
        xdp_rxq_info_unreg(&vi->rq[qp_index].xdp_rxq);
+       cancel_work_sync(&vi->rq[qp_index].dim.work);
I'm not sure, but please check if here may cause deadlock:
  rtnl_lock held ->
  .ndo_stop ->
  virtnet_disable_queue_pair() ->
  cancel_work_sync() ->
  virtnet_rx_dim_work() ->
  rtnl_lock()

Good catch!

I tried using cancel_work() which solves the problem. Additionally I tested the scenario of ctrl cmd/.remove/.ndo_stop()/dim_work when there is a lot of concurrency,
and this can work very well.

Thanks!


  }
static int virtnet_enable_queue_pair(struct virtnet_info *vi, int qp_index)
<...>


Reply via email to