Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp9547324rwr; Thu, 11 May 2023 17:14:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7wbOpPKbD7LOtMIVpFV7RdinvxgSPEpLAICzLXK67Dbb29HY/fWsFf6R6hJHfaAaUnkNqN X-Received: by 2002:a17:902:c1cd:b0:1ab:18ea:f922 with SMTP id c13-20020a170902c1cd00b001ab18eaf922mr23433842plc.52.1683850439862; Thu, 11 May 2023 17:13:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683850439; cv=none; d=google.com; s=arc-20160816; b=B/QJCSSSDThHlkz59ycZx9Sv6v89Q9q7UwRDBWWH7aJ1vrQ8xwQuIpdZXcV5KCi5dZ Y++3ULXMsGo82P/hKBkA9yJ5p+gDyD7+0Ihjqf8XthKdGAV74sGQNy4mRtDpEl6JFSnB Xx39P4mU/wG/USN4yZBy6cbKKZ19CvBJUnKZq/ZBxjrin5B9S0jNemvu6cz0bECGajwS g6h1Q4pPvAhXv/zkaPoBvCKJwDx0IekkB3I6eBYd+fadaDlq88vqQal2p8VAt0uRFq6F MDg2Mogm3Agf/0iGG1vah3r+rr0t0bSm3OExpqLwjhMUbz1bizGZTPR19PGOjvxZO32H TW4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=VWYVMicQIGCwGUbuMq24kkfpiIJJVDGbM9ZlLCUcgg4=; b=yF7Eno440AyLNdfdWk7QupTVNCma9DoCsujfUYjP+JElOpWrWoPyxk+ldWOKjjkyYA TgL/ahTr2bCAxwkd5e8QuTfNQNuTCeWMc86Wj08sIgxSAMV9uXjbSi4hNCzWWjZnpL/a YYG7ICUep2PCmvFPlHvAdhu6MNi2i1joFxstE02B4LkL92JejqozBBejnRXCA6Ah9jH/ gJZzhcqn1S/E1nkU+bG2Awm5066f83eSN94pq9WM5YT+ZePHmgO/9QSNZqkPP22cS6qo /GSwHQ4UvOnkYXSIK2aztAvZ53OmTaorBVmcIAv3udeaDovSZ2PWA2HjHiW+/bubGGB+ MQNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Y6GFuCB4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gc3-20020a17090b310300b0024e33c63ed5si21229665pjb.15.2023.05.11.17.13.45; Thu, 11 May 2023 17:13:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Y6GFuCB4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S239497AbjEKXqn (ORCPT + 99 others); Thu, 11 May 2023 19:46:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238915AbjEKXql (ORCPT ); Thu, 11 May 2023 19:46:41 -0400 Received: from mail-qv1-xf33.google.com (mail-qv1-xf33.google.com [IPv6:2607:f8b0:4864:20::f33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0069530C3; Thu, 11 May 2023 16:46:40 -0700 (PDT) Received: by mail-qv1-xf33.google.com with SMTP id 6a1803df08f44-61aecee26feso42403156d6.2; Thu, 11 May 2023 16:46:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683848800; x=1686440800; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=VWYVMicQIGCwGUbuMq24kkfpiIJJVDGbM9ZlLCUcgg4=; b=Y6GFuCB4A8uAl4TFv4+ubLWysOkiBqCPJXiQ3cU1Upx49ayKrsVkjbgq1Ysk3nstYB kB83K/DsfBX+e91d10rv7GVyJ5GIPNh/uiIqgFPazkTz1nIjZMffH/ZhyaTkDZL8U99Q LuEBz/ETHCr4jzTVwJdHGHEnM7rDjox83vNioTt+bAT4etacgFaEyXcf8HEy4o5kP5RX 9fjkBIW0tmUwvF1L6QlroyOk0EP5lebT953AFZkZV0jbnqouSWCWZKYK6SlZhw5/QiOc 6n/qd6ckO0rEjc9hQVqlZteq2mR4iDF6iTqC8fOVBcBhwbxmsz5KvX8K17ElVJehFpr7 UfMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683848800; x=1686440800; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=VWYVMicQIGCwGUbuMq24kkfpiIJJVDGbM9ZlLCUcgg4=; b=RrN5LFF2M9fmmzB1CuSVj4zUjF5EpHNuJ/uKAH3UVQ9peEUZ6wg67+a6/j5YjaGXTC 6tmhUUrxy1gPRAtjhajI3HuaTt/wulcDfWVQKXUHR3iRtLBlSVZiz4RaHcxLi+6Gq724 KCsMWep+leL/5zNi9qnJVY6KECqKSVEKFLf2WJPs6P6U/vMpLnirupKWZR57YSbdmqoh fNysF9L7eIVyltcGtK6H1/PRScbLqY29a9iCIOrNpJsuXMYS6SMsCmurCHxMhq+NHTCj FU5qzFcn+CYJW7d+oToISohFHOXTPiKpwvBx0cUjCgDgNHZRsR3EN78/G1seJZ3iBDtC F9WA== X-Gm-Message-State: AC+VfDxo4CtaZVH8CFh2y9lyijMzDfjwf+bC3SwnK73LzV1B2qKPlIv9 IhcKs3DspHHktnn1QYA1jA== X-Received: by 2002:ad4:5aa1:0:b0:61b:5d38:b736 with SMTP id u1-20020ad45aa1000000b0061b5d38b736mr36766219qvg.35.1683848800018; Thu, 11 May 2023 16:46:40 -0700 (PDT) Received: from C02FL77VMD6R.googleapis.com ([2600:1700:d860:12b0:8d4a:f604:7849:d619]) by smtp.gmail.com with ESMTPSA id w18-20020a0cb552000000b006216ff88b27sm416141qvd.79.2023.05.11.16.46.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 May 2023 16:46:39 -0700 (PDT) Date: Thu, 11 May 2023 16:46:33 -0700 From: Peilin Ye To: Jakub Kicinski Cc: Jiri Pirko , Daniel Borkmann , "David S. Miller" , Eric Dumazet , Paolo Abeni , Jamal Hadi Salim , Cong Wang , Peilin Ye , John Fastabend , Vlad Buslov , Pedro Tammela , Hillf Danton , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Cong Wang Subject: Re: [PATCH net 6/6] net/sched: qdisc_destroy() old ingress and clsact Qdiscs before grafting Message-ID: References: <20230508183324.020f3ec7@kernel.org> <20230510161559.2767b27a@kernel.org> <20230511162023.3651970b@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230511162023.3651970b@kernel.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 11, 2023 at 04:20:23PM -0700, Jakub Kicinski wrote: > > But I see your point, thanks for the suggestion! I'll try ->init() and > > create v2. > > ->init() may be too early, aren't there any error points which could > prevent the Qdisc from binding after ->init() was called? You're right, it's in qdisc_create(), argh... On Thu, May 11, 2023 at 04:20:23PM -0700, Jakub Kicinski wrote: > > > > Looking at the code, I think there is no guarantee that (1st) cannot > > > > happen after (2nd), although unlikely? Can RTNL-lockless RTM_NEWTFILTER > > > > handlers get preempted? > > > > > > Right, we need qdisc_graft(B) to update the appropriate dev pointer > > > to point to b1. With that the ordering should not matter. Probably > > > using the ->attach() callback? > > > > ->attach() is later than dev_graft_qdisc(). We should get ready for > > concurrent filter requests (i.e. have dev pointer pointing to b1) before > > grafting (publishing) B. > > I thought even for "unlocked" filter operations the start of it is > under the lock, but the lock gets dropped after qdisc/block are found. > I could be misremembering, I haven't looked at the code. No, f.e. RTM_NEWTFILTER is registered as RTNL_FLAG_DOIT_UNLOCKED, so tc_new_tfilter() starts and calls __tcf_qdisc_find() without RTNL mutex, at least in latest code. Thinking, Peilin Ye