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 477F41D63EB for ; Tue, 7 Jan 2025 21:09:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736284148; cv=none; b=uxXZuVL5kVn72fd/R9A4TGrsnVk/fC2tZVFkZodauDLP5fn2EnpVQyWMbc/3AR9hTVInXZ94bxvV7P/B7mD+E5xyaMl5fPA2b0Qo6mdJ/tn7GzuQPEidFPod54EYVTBW5zmjtkGW+58EZsU5Z+IKhf8nhXMb8Nen0ihp8FN4cNY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736284148; c=relaxed/simple; bh=O9yeKU+aDLkbe5Y+st1eaESauyloNDhBO/f2RKbWUkA=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IDpzhW/dGkXwVeAvb/HGxMoMY81ksyWq7a+7N77Z2NoHvIY6Y+EmJ9dMiQVfbo8sVlwb9W2+PDebfs8BR9G4SoPAlj7M3C1Gldg5h6gPICEf2k77QfNLY8YDwVCCsXp34gr0dnnDHNfRkvuZu8ZibFMP97VXXX72yz4eWRG9I44= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JyiD9dbF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JyiD9dbF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A13C6C4CED6; Tue, 7 Jan 2025 21:09:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736284147; bh=O9yeKU+aDLkbe5Y+st1eaESauyloNDhBO/f2RKbWUkA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=JyiD9dbFavrqM/Md67vj87Pyy5Nq+Mn3HtZJF+Cnclr6PLxwx4h/jSjnhrOOkO58N 1/BVgd5fPUHoBJh4VfxKypUfgRbGVtbnByrF9P13Z6wKWT3gYaSXtUQOu5+0G0Vrri eV3HOWFVyPJK9dzynjBHEGieK7kNE5hMv6UfdhX59lUuruUa11XF39ok424qNM0IiR DZeMZEVAmdfj0jkNftyhJb3Ami3oO2TR3Hz4MwlohzkKuHC1duX42bOcXMkzpqU/z1 v+i23zGLZwBPHfxbqz48Tufwv1iC6/6EXnDX4NVRMNl0FOhRXQtrRZqKRHUWtK0NT/ MNrwxVnJQ8UOg== Date: Tue, 7 Jan 2025 13:09:06 -0800 From: Jakub Kicinski To: Eric Dumazet Cc: "David S . Miller" , Paolo Abeni , netdev@vger.kernel.org, Simon Horman , eric.dumazet@gmail.com Subject: Re: [PATCH net-next 0/4] net: reduce RTNL pressure in unregister_netdevice() Message-ID: <20250107130906.098fc8d6@kernel.org> In-Reply-To: References: <20250107173838.1130187-1-edumazet@google.com> <20250107121148.7054518d@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 Tue, 7 Jan 2025 21:46:41 +0100 Eric Dumazet wrote: > > > I think we'll need: > > > > > > diff --git a/net/devlink/port.c b/net/devlink/port.c > > > index 939081a0e615..cdfa22453a55 100644 > > > --- a/net/devlink/port.c > > > +++ b/net/devlink/port.c > > > @@ -1311,6 +1311,7 @@ int devlink_port_netdevice_event(struct notifier_block *nb, > > > __devlink_port_type_set(devlink_port, devlink_port->type, > > > netdev); > > > break; > > > + case NETDEV_UNREGISTERING: > > > > Not sure I follow ? I was worried some code assumed devlink_port->netdev is safe to access under rtnl_lock. But looking closer it's only used in trivial ways, so you can ignore that. > > > case NETDEV_UNREGISTER: > > > if (devlink_net(devlink) != dev_net(netdev)) > > > return NOTIFY_OK; > > > > > > > > > There is no other way to speed things up? Use RT prio for the work? > > > Maybe WRITE_ONCE() a special handler into backlog.poll, and schedule it? > > > > > > I'm not gonna stand in your way but in general re-taking caller locks > > > in a callee is a bit ugly :( > > > > We might restrict this stuff to cleanup_net() caller only, we know the > > netns are disappearing and that no other thread can mess with them. Unless the interface has a peer in another netns. But that should be fine, interface will be de-listed. I'm slightly more concerned that some random code in the kernel assumes its stashed netdev pointer to be valid under rtnl_lock, as long as it has not seen an NETDEV_UNREGISTER event. I guess we'll find out..? :) > ie something like: > [...] LGTM!