From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0878FC74A5B for ; Thu, 16 Mar 2023 21:54:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229794AbjCPVyX (ORCPT ); Thu, 16 Mar 2023 17:54:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229534AbjCPVyW (ORCPT ); Thu, 16 Mar 2023 17:54:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A0DB24122; Thu, 16 Mar 2023 14:54:21 -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 A38C162080; Thu, 16 Mar 2023 21:54:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A31B0C433D2; Thu, 16 Mar 2023 21:54:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679003660; bh=K3UNssMD1oUQCyet+zxbfyXr1tNNX+nNPwdj1dW2wbQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=BLpr2MZzMQJxSYQuhS4yEzbUEjJq6+sIHwcE4XaPUsYQylOVHUJwPjAQ/11lKhPTe LwdTc9AN4W9GNSa4VxpAvRURDtdkhO6lUVDeS36Tx2a/FM0Oe7BJXf3T5uxlwzK50G HUMj/2AeZvtJFQasX4HaA9pr2EhPlqC/mTtCu++KztwmGSmWgRyScDO9B7FjZG9Myu sOcP9vkIitIc7z+H3LGS+2rd0zcZHSL2qx3vvEpoEduLoTw8R7rkd7tOSCa5N5qHWI itt8Mpyd7dXJ5adDoIET+9j/a7J+FGJv54GEknIj4EMq3I4YEVH3VMrmkioxfUjg7B 73E2VBe260y5Q== Date: Thu, 16 Mar 2023 14:54:18 -0700 From: Jakub Kicinski To: Lorenzo Bianconi Cc: Tariq Toukan , davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, tariqt@nvidia.com, bpf@vger.kernel.org Subject: Re: [PATCH net] net: xdp: don't call notifiers during driver init Message-ID: <20230316145418.3af738c3@kernel.org> In-Reply-To: References: <20230316002903.492497-1-kuba@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, 16 Mar 2023 12:03:57 +0100 Lorenzo Bianconi wrote: > > I maybe need to dig deeper, but, it looks strange to still > > call_netdevice_notifiers in cases > NETREG_REGISTERED. > > > > Isn't it problematic to call it with NETREG_UNREGISTERED ? > > > > For comparison, netif_set_real_num_tx_queues has this ASSERT_RTNL() only > > under dev->reg_state == NETREG_REGISTERED || dev->reg_state == > > NETREG_UNREGISTERING. > > does it make sense to run call_netdevice_notifiers() in xdp_set_features_flag() > just if dev->reg_state is NETREG_REGISTERED? I was thinking - we'll adjust it if someone complains, but indeed the detection is somewhat weak, a call on a dead device but under rtnl_lock won't warn. Let me just copy what the queue helpers do, exactly, then. > Moreover, looking at the code it seems netdev code can run with dev->reg_state > set to NETREG_UNREGISTERED and without holding RTNL lock, right? You mean - part of unregistration is done without rtnl lock held?