Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp275417pxb; Wed, 4 Nov 2020 22:41:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJxOMK0QBSTibNGRZ3sz/7j/9PELcD0m90JZ0ON7FesSWhpXZ56R4CBb/FjJtYmQOS9o1yVN X-Received: by 2002:a50:b746:: with SMTP id g64mr1133921ede.380.1604558474211; Wed, 04 Nov 2020 22:41:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604558474; cv=none; d=google.com; s=arc-20160816; b=Yx/bo1IDXcI0rAIzYatpu0Wn9HxCEp3TSH5MF+h8NAR3bFLXs4brb3qoRF4DVPYkUm USpTO7tzM8OtP6y0non5ChAeCD623Lp4EA/99CLRRoYj2pyzCJnCjRI8dlUUWLL7eqrd YXp9B8Lb9LnVCEoPIPTnCPaptE2HjOwSzBh33HkmBWWUd83lHDIkqNquPAaw3N620IQJ ArIbDtNsVEhow2Zj0kXmobdH0lsg+pcIxdPWvQSD78FtOHI0wZ3iPVrohPULtKixWh+h icWu4wcvUe5s8aUie2mk00pnCGbQbWcdriNhehfcFZUCG/+PoNRQAagbyeWMnsyT8lEB g1cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=TmCofzCj9lKvR+P/ENMeSaUEMVenaNbJ49Oabt188RM=; b=GKWIkjR8hxhpZ/VXJVBldHDERspGTGhc1Yfwuc2aiu5/QlAJ2Squ0kGILdsrHeqHFz dnGoWtIcVpFP8q+HG7rbDjRcaqoO4nNtYrVvw1mU339A5LptMDziknmgpCgClalRvPYM W6p4JVuxes7WPhNvlxURdzXcXBEFFnOZpzC7ej0GPHVrtlnL31eV7J1PnIVBNeWoO793 /hjl5hcyNVOgG21sKFbaeVGQzPu9/eSrpZgxSt+pLmHkjRzFxXxn47j97+9ZM261wreu kQMnES/j6jFuFINQwpyLujg6kphyhPqGYVVhCi8NMWuvgru4njltLfoq9I2LhMhUl3my hb6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U0fpqSgG; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k12si463053edj.266.2020.11.04.22.40.51; Wed, 04 Nov 2020 22:41:14 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U0fpqSgG; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730878AbgKEGFd (ORCPT + 99 others); Thu, 5 Nov 2020 01:05:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729731AbgKEGEu (ORCPT ); Thu, 5 Nov 2020 01:04:50 -0500 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DDA2C0613CF; Wed, 4 Nov 2020 22:04:50 -0800 (PST) Received: by mail-io1-xd43.google.com with SMTP id o11so617475ioo.11; Wed, 04 Nov 2020 22:04:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TmCofzCj9lKvR+P/ENMeSaUEMVenaNbJ49Oabt188RM=; b=U0fpqSgGPJgRzVH6h5D3dFF6/dEJaAv6oxkug5V+SBkABtbEyjBuEdZsfUSy98+PQF u1bWsn2zbm5OkGQ4PN86FXC4YQFqsY6v0h1jjAYIt+rKhAcmAyopVQsiyqVc8XOnS65n 99YFqCyYhQ8l0R0/+JQ/lBFf47OudWWNMC9jq6QmJ365MUZT0pOuTKPBvpk79U7kTTE0 Wui/fbVmPF8GhljduRk1Bgzg0hj3woJxZIKhHU/CUrrx2DKEDx5wmI1ek1sAcu2cfBWC jcGAiuK9SRzAYSX6S2LB3gZFJbL7xNqtwfS9OvrpQsXmbbzlYbJ1YxIRu9nt58hnspnE CkmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TmCofzCj9lKvR+P/ENMeSaUEMVenaNbJ49Oabt188RM=; b=MIQh4rlKMuCByf30eQ7Ghjf6DovqwAh2LGRNrFrqME1dtVPNHtLTJ1l7r8HVa4sR1/ 7DXZX43jMKbb8qbXs4bAuRZj2A7/9tXPAbVnZy56+C5c28M8Otdo5NmX08WOA+ffr4Xa JLp97XJ2/3OaIOeDpxEh4A1vv7BelOEhhG6uvBb0kYMPwbrROK4tnZ/QFhVtwY2S9e/G 4snOvXP3Q3MiCjfXNkH22Gti8D/203h0PFKwFrNU//Yj5mkJkOQIiH0e5mTGZJVkocIN rT4cbcAAXaFdNKuTeLzNGtSQ08fYLU1RMZoP5dhYkCTNzUb7SCTMin9Dt9bu88m5BqOA Pf0w== X-Gm-Message-State: AOAM5323KicAn1Pmb69W3o7mlELz0EFl8GoYgD6c8zJrTTXIr9tVKM2M AO1OsmoeriUJUWSOCkT5N5gh8Gcrq5x4c1dT9mU= X-Received: by 2002:a05:6638:d7:: with SMTP id w23mr882665jao.131.1604556289475; Wed, 04 Nov 2020 22:04:49 -0800 (PST) MIME-Version: 1.0 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> In-Reply-To: <5472023c-b50b-0cb3-4cb6-7bbea42d3612@huawei.com> From: Cong Wang Date: Wed, 4 Nov 2020 22:04:38 -0800 Message-ID: Subject: Re: [PATCH v2 net] net: sch_generic: aviod concurrent reset and enqueue op for lockless qdisc To: Yunsheng Lin Cc: Jamal Hadi Salim , Jiri Pirko , David Miller , Jakub Kicinski , Linux Kernel Network Developers , LKML , linuxarm@huawei.com, John Fastabend , Eric Dumazet Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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