Re: [PATCH v2 net] net: sch_generic: aviod concurrent reset and enqueue op for lockless qdisc
From: Cong Wang
Date: Thu Nov 05 2020 - 01:16:41 EST
On Wed, Nov 4, 2020 at 10:04 PM Cong Wang <xiyou.wangcong@xxxxxxxxx> wrote:
>
> On Mon, Nov 2, 2020 at 11:24 PM Yunsheng Lin <linyunsheng@xxxxxxxxxx> wrote:
> > >> From my understanding, we can do anything about the old qdisc (including
> > >> destorying the old qdisc) after some_qdisc_is_busy() return false.
> > >
> > > But the current code does the reset _before_ some_qdisc_is_busy(). ;)
> >
> > If lock is taken when doing reset, it does not matter if the reset is
> > before some_qdisc_is_busy(), right?
>
> Why not? How about the following scenario?
>
> CPU0: CPU1:
> dev_reset_queue()
> net_tx_action()
> -> sch_direct_xmit()
> -> dev_requeue_skb()
> some_qdisc_is_busy()
> // waiting for TX action on CPU1
> // now some packets are requeued
Never mind, the skb_bad_txq is also cleared by dev_reset_queue().
TX action after resetting should get NULL.
Thanks.