Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp276539pxb; Wed, 4 Nov 2020 22:44:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJyn2zV+R1/Bl0vD9rlWtzkKpv8Pb6xWUysf18CcAH0GUlACG73GMmmzZI+Hi8pGpezt7ep2 X-Received: by 2002:aa7:c90d:: with SMTP id b13mr1171382edt.136.1604558647688; Wed, 04 Nov 2020 22:44:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604558647; cv=none; d=google.com; s=arc-20160816; b=KYY81DuUdYqUD/9KuI2yNxUgrV8PkJgcc/PIcY+N1P6HYI/LI3TJQ2C1YOedgqRjZb 6urYN/jMbKD+PTB/zt2PRPq61NeeJB5SscGNM2P5tSbKwoBR3St/R32wVx4kU5alo7/s mM93V6IivRl6kCRBRCnxDJspU3lj93dRZherBpqQqhoQOQBHxvAFqOLNIsneMudR12QY VdphLW/rO5rHwFfJzx6bPMYcJemsWTkCw3CUE6BYE2lnN/Q4d1Lon5kjV6O3v9RNcAHw qQD5BAF+NRP9azrs4gw4yWTYKfjumXbmi/FFY31dkOzdEQz1tMqvH/PzGwncFK2oMUUw UsLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=IupEHrlMndOpAK9bLJ6rC5Zn+K48VzgF4ox+uVHo+0g=; b=ltXqbuJWXs2zNTHqA6O/qlCyrvEe+2br4Z7/ZrKt7yPuKnLhDzVHiRsOFvY53IY6uD yqTdj9hDgesALjybSenq31VGpTVlbXViryzenPygU6PKjBgWjMptxk+D986UHrS/Bh5R XMAXv/VK9D6A5+IbxciCFyFlqIk3Vgg22anfx4Nhdz/AU+i+ewht0tSsUIqttTTbSkDL cl07dE/JHMqxAaK8Fc2DAKtexBcmv5eQ5ek0lL4pgM9kErpsQ1gfIDQlF4rnxnkE0c/r eqFDBRReocLzc41DHgQM8jJiXip2Kgb/3xwwik5yWn2gCp6/Gcm7ip7/3kMjnMJjEeEF jsoQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d20si504748eds.29.2020.11.04.22.43.45; Wed, 04 Nov 2020 22:44:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731403AbgKEGXO (ORCPT + 99 others); Thu, 5 Nov 2020 01:23:14 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:7460 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730127AbgKEGXO (ORCPT ); Thu, 5 Nov 2020 01:23:14 -0500 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4CRYNn0K7PzhgV9; Thu, 5 Nov 2020 14:23:05 +0800 (CST) Received: from [10.74.191.121] (10.74.191.121) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Thu, 5 Nov 2020 14:22:56 +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:22:55 +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:04, 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() There is no skb in the dqisc now. > net_tx_action() > -> sch_direct_xmit() So when CPU1 calls net_tx_action(), there is no skb to send and no skb to be requeued too. > -> dev_requeue_skb() > some_qdisc_is_busy() > // waiting for TX action on CPU1 > // now some packets are requeued >