Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp9511807rwr; Thu, 11 May 2023 16:33:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6dZPbzCzwS92Zvvf9vHrNdIIqZnqI4ROrbPoo7oVwvnjeja+B6KuhsCYCuXOhE+CNVH7e/ X-Received: by 2002:a05:6a00:1496:b0:643:857d:879a with SMTP id v22-20020a056a00149600b00643857d879amr33432959pfu.24.1683848011258; Thu, 11 May 2023 16:33:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683848011; cv=none; d=google.com; s=arc-20160816; b=Bw24bGb9ctMawgDWJaassmiZ8aJSoqdxKSDIFADt0jbP6jEDyKfHrlNo8EazCnKXH2 G0YgioTiG8IBUJunX1klsucEyrWJbFgx04+Muq2ZpCYbIQ/kT2dfNBjGwWdmifY4NbUL pYmS8cwdh+Ghb6dJM2QzF1UKvlNGFT3oIG30W9QlH7smoQvXkl7fuKCEDUFBjTBqfOUu VtZdUhwSurICXPSz8sIIS7lou5aXKdhOXkmqEdO5eNLH1v6OwcN7I5M15p2GkHe9vEAA N0i3TI0rusFKDVkdj7QcDielX8/ZP/ehAqHLcusPwAOHWR+9CccsArkKZ5ITkMtFb9rd +QXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=tjTYgFGvXK/WOZNWPZXqcPxmbunzSegONZv0Fe4tU4w=; b=YZHmDup2RzdLMv6CRQoJKmRqFAa3ljzdEY466gvOIPEoIvmuqj05aHzC50kQeqYRPs VLtdzJPh9G8hQonV0bfBcOSzBnxunkbqmAYh4W5Py2S8JmftAfUnJy/Bna44ogPuWzHk BqKBng1JM5/OB/wtNUw2eoM95B1D6JF7iAgooZxdjflFp4Hlow8Roqrx9XkZdTNrbpEy ebxFgsjCekK+oVK7ob7T6r76ilqmM9yT0koBteT/zra7IFNm+jkwHAD8CFoQkrngIt3l KmKD1KPuxqqR1d1zGpbTFLCDw22okYsgZqFBGIXMb2doI3MPA4nR2Jj1oUU/ZO9bX9qY KwoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FLaFHom8; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i30-20020a63585e000000b0052856cec948si7975542pgm.879.2023.05.11.16.33.18; Thu, 11 May 2023 16:33:31 -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=@kernel.org header.s=k20201202 header.b=FLaFHom8; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239521AbjEKXUd (ORCPT + 99 others); Thu, 11 May 2023 19:20:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239311AbjEKXUb (ORCPT ); Thu, 11 May 2023 19:20:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65A345BBD for ; Thu, 11 May 2023 16:20:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E62AD65229 for ; Thu, 11 May 2023 23:20:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5E9AC433EF; Thu, 11 May 2023 23:20:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683847225; bh=heb/Ae+vtqZAI/LR/adpb91zjfMyByllNRGWtN+x6Us=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=FLaFHom8eejodz/0W9plf6HpJILhurJIeBRhNxSwBfBXInmfaBQucQfvWVEJfAw30 1znJdGNjJD8USba4FGByWD5jWXaiGeBeFm2Q4P5fszb09ojRbX5wKmgitKlDlHZRmu bV7t6gjofHMYRChisOWaPXZeNTwAlAfRZgHXhGgxAFt1xAhzIj6KDJe1oazhmCcN05 nZ86GrdBnn7U8aWfvxR7ovUP7rxigDBkNFzXjMzqHGJwC/dAi4zlu6F/D/ca0Kyl+S 9O4ekKRL207Hj0mzYBbV6WCTtD0YBalKBwxkG1nJ5/u8SQqfhYqVuI7QvEeq1rudsm KdXgP24DPqbEQ== Date: Thu, 11 May 2023 16:20:23 -0700 From: Jakub Kicinski To: Peilin Ye , Jiri Pirko , Daniel Borkmann Cc: "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: <20230511162023.3651970b@kernel.org> In-Reply-To: References: <20230508183324.020f3ec7@kernel.org> <20230510161559.2767b27a@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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, 11 May 2023 13:40:10 -0700 Peilin Ye wrote: > On Wed, May 10, 2023 at 04:15:59PM -0700, Jakub Kicinski wrote: > > My thinking was to make sure that dev->miniq_* pointers always point > > to one of the miniqs of the currently attached qdisc. Right now, on > > a quick look, those pointers are not initialized during initial graft, > > only when first filter is added, and may be cleared when filters are > > removed. But I don't think that's strictly required, miniq with no > > filters should be fine. > > Ah, I see, thanks for explaining, I didn't think of that. Looking at > sch_handle_ingress() BTW, currently mini Qdisc stats aren't being updated > (mini_qdisc_bstats_cpu_update()) if there's no filters, is this intended? > Should I keep this behavior by: > > diff --git a/net/core/dev.c b/net/core/dev.c > index 735096d42c1d..9016481377e0 100644 > --- a/net/core/dev.c > +++ b/net/core/dev.c > @@ -5116,7 +5116,7 @@ sch_handle_ingress(struct sk_buff *skb, struct packet_type **pt_prev, int *ret, > * that are not configured with an ingress qdisc will bail > * out here. > */ > - if (!miniq) > + if (!miniq || !miniq->filter_list) > return skb; > > if (*pt_prev) { Good question, maybe Jiri or Daniel can answer? > On Wed, May 10, 2023 at 04:15:59PM -0700, Jakub Kicinski wrote: > > On Wed, 10 May 2023 13:11:19 -0700 Peilin Ye 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. > Also currently qdisc_graft() doesn't call > ->attach() for ingress and clsact Qdiscs. > > 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?