Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1153258rwd; Tue, 16 May 2023 12:37:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5BYp4IGEkoyPMwbBtC29EtDKvu3rIcbwnrrXV9IXlqTVHYmwOmMyz5CBOmjumGEEGMcYs/ X-Received: by 2002:a05:6a20:6a29:b0:ff:df0d:a6fb with SMTP id p41-20020a056a206a2900b000ffdf0da6fbmr33388141pzk.28.1684265822781; Tue, 16 May 2023 12:37:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684265822; cv=none; d=google.com; s=arc-20160816; b=sTDc4WwpVe/N5j36/4113LbKL3tPAO/Zf7aBjAzjvNHUfXibvbaOMebTsreGzjASzs jwx9nQAiVy2P4x0Iv2a8Hizx1dnTKhc8Q0+YH9R6vPhfE7dNkgkhsUykorzgsu+cVRMm Lka3Z4gkOr9cKw+wfHApVnVLGxxKauIF+hCbraGG533piNEzqh9w7YBD/lYk6rinOI2z jNOvh/2Wqd2/YsfPFAnu2kxEw+HI2EPtlm13D3cAbcVasB6R69uQ6snWmx7xHC8g953e MvWDnULHXoHYJ+jt6Lvb25f8AJKzt0hezTBSaFNhvTHM0vA/eS/qHf+Owveed287M57a KCxw== 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=L8BEt+bKG97CUDkJNe/hUdhxUeDXp5GdqcAzAdahD3w=; b=ML1ceT5/QNsshakL3pzoWpo3//8K0Ir2nw92eyg4lh+uubruDX1I9XBcErUCc25jFI jl0lApWEoGtjLbET/fSrNKexvwNUD0EuQHBy4Kp/S4F6sM1HlVp6LaICJeVcS/FMEbrT AI3oKqhSyAISgvj7Xq7jb6gZQr+kbTlIVnhuwI6f3f3dhlHLOj2YDpd0BUiGUaPF9P5c bYaE7XTFLb+7DkUh5zasrTE8DUsI8jAY0JKGGAWRswC/jaXFcSLq9vIzSpuhmxYw1fPG imkBxjcBVt0aXYZGb53iNNqO2kD7n6GR8+7pfOyNYGYFbI5izQvbI2Kp8skI0KtJzSU9 xroQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=APe2b3ZF; 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 m197-20020a633fce000000b0053074c54c3fsi14289761pga.868.2023.05.16.12.36.50; Tue, 16 May 2023 12:37:02 -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=APe2b3ZF; 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 S229642AbjEPTWQ (ORCPT + 99 others); Tue, 16 May 2023 15:22:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229750AbjEPTWJ (ORCPT ); Tue, 16 May 2023 15:22:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4606A1999 for ; Tue, 16 May 2023 12:22:08 -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 D7FCF63E42 for ; Tue, 16 May 2023 19:22:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2764C433D2; Tue, 16 May 2023 19:22:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684264927; bh=FN416ecFDfAW41Eioma/+kx2ZpZ+tyHBV47uheUxRXs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=APe2b3ZFrWdZM7UdAwQ0MwILSkyB25UXxJRNF8mjWhQvWun59gwUzKdUtacMyqOvC 51PW874Crl0O2LX7qSCi1yvXAg20UQJkNEiRTlHyZlrvQs2w+scYwP5w+nWAacOo7F QALfmINYvhDOuhYfQvqDYV3QYEdiwsgaP3oixzDqmzupWhnIWWTDowKddrjp8fnKlk RHs1Pmx4/5fymS87iu+6DC6yKD29gQ8NNEs4h/X3wrup0gDwVhU/a25relmFMSJthF Yd8kfHlUnWO4SzUzCmlvonqUgohJkOvmWjL6zD8o4di3iqMXbkEG8K2TSeOPvkS+I0 8QRDfaO4jnDrw== Date: Tue, 16 May 2023 12:22:05 -0700 From: Jakub Kicinski To: Vlad Buslov Cc: Peilin Ye , Jiri Pirko , Daniel Borkmann , "David S. Miller" , Eric Dumazet , Paolo Abeni , Jamal Hadi Salim , Cong Wang , Peilin Ye , John Fastabend , 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: <20230516122205.6f198c3e@kernel.org> In-Reply-To: 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-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 Mon, 15 May 2023 15:45:15 -0700 Peilin Ye wrote: > On Thu, May 11, 2023 at 05:11:23PM -0700, Peilin Ye wrote: > > > You're right, it's in qdisc_create(), argh... > > > > ->destroy() is called for all error points between ->init() and > > dev_graft_qdisc(). I'll try handling it in ->destroy(). > > Sorry for any confusion: there is no point at all undoing "setting dev > pointer to b1" in ->destroy() because datapath has already been affected. > > To summarize, grafting B mustn't fail after setting dev pointer to b1, so > ->init() is too early, because e.g. if user requested [1] to create a rate > estimator, gen_new_estimator() could fail after ->init() in > qdisc_create(). > > On the other hand, ->attach() is too late because it's later than > dev_graft_qdisc(), so concurrent filter requests might see uninitialized > dev pointer in theory. > > Please suggest; is adding another callback (or calling ->attach()) right > before dev_graft_qdisc() for ingress (clsact) Qdiscs too much for this > fix? > > [1] e.g. $ tc qdisc add dev eth0 estimator 1s 8s clsact Vlad, could you please clarify how you expect the unlocked filter operations to work when the qdisc has global state?