From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 840CDC00A89 for ; Thu, 5 Nov 2020 06:33:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 257232071A for ; Thu, 5 Nov 2020 06:33:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730458AbgKEGdQ (ORCPT ); Thu, 5 Nov 2020 01:33:16 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:7592 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730361AbgKEGdM (ORCPT ); Thu, 5 Nov 2020 01:33:12 -0500 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CRYc72dk8zLv0V; Thu, 5 Nov 2020 14:32:55 +0800 (CST) Received: from [10.74.191.121] (10.74.191.121) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.487.0; Thu, 5 Nov 2020 14:32:52 +0800 Subject: Re: [PATCH v2 net] net: sch_generic: aviod concurrent reset and enqueue op for lockless qdisc To: Cong Wang CC: Jamal Hadi Salim , Jiri Pirko , "David Miller" , Jakub Kicinski , "Linux Kernel Network Developers" , LKML , , John Fastabend , Eric Dumazet References: <1599562954-87257-1-git-send-email-linyunsheng@huawei.com> <830f85b5-ef29-c68e-c982-de20ac880bd9@huawei.com> <1f8ebcde-f5ff-43df-960e-3661706e8d04@huawei.com> <5472023c-b50b-0cb3-4cb6-7bbea42d3612@huawei.com> From: Yunsheng Lin Message-ID: Date: Thu, 5 Nov 2020 14:32:52 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.74.191.121] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/11/5 14:16, Cong Wang wrote: > On Wed, Nov 4, 2020 at 10:04 PM Cong Wang wrote: >> >> On Mon, Nov 2, 2020 at 11:24 PM Yunsheng Lin 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. Yes, maybe it is safe to remove qdisc_reset() now? or issue a warning if there are still skb in the qdisc. > > Thanks. > . >