From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90ECD29101 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> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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?