Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2156266lqb; Mon, 27 May 2024 09:31:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVEXDtLWLd3Pt16ZBfMV+6p+Jj5ugZyfSIix5ajxy4btGlxmqVvz5vL5VSfu3nCR3zroavvi/NTZ9hLfmFPOURWVjHOgR1FUsr9Hpsuxg== X-Google-Smtp-Source: AGHT+IHTbsxmie4RpB3JVlWBWHsVXT7pNXsl+hSPOSiH/m47FkJKjLmdqvLaO0evekfNoCNuz7wx X-Received: by 2002:a17:906:40d8:b0:a59:c833:d275 with SMTP id a640c23a62f3a-a62642df815mr607809166b.30.1716827508931; Mon, 27 May 2024 09:31:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716827508; cv=pass; d=google.com; s=arc-20160816; b=qT1NcLcX/KZ05oLVm9FGsoqOOSF5YqWAhu0lMnjPYHh04O3fiMsR8p8CVOfNJl4LKD WC8f6UvUlmO4sEx9FRSBpXAi8whH3u9njNkf8O9LEdCMHXsuicFtHlyl2wCrmXcaHsud e0pxn8aPXugzGtWClwSMYAYJrKdZqQfU6Vdo3kLKjvvYGiQ3UbrcsLtr1d+SSAjJyjxz cfpPY0Bj6OU3O4fZLM/wYIQt8Cx0SkY25xY/tuMfiHimpqFwFEa9rgWjAhcOzEJWi8bV kCH2XBkGK81j143r1jix0duAPQbq6WnChbknlzwFbrTb+qNZiJUEc7q2UPea3S+ZesDU l2uA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=3byxEUyInm2nywaNfU3E+9Y8kBXgcUOp7eT3rZlZBHY=; fh=CxBs/wXU0uHfR/v3sESCCtYi35MVLw0m9T6KkN3jnIU=; b=h1zX76Y1Wu5himqxzWkF7LLNvRkJumXA22I4zeY/T2heSOff2/Px67j2trbtwHXLT7 UnAhRnQTjs1opG8Gb3la6PHkjtHe2dZs4M+82KRzCm9vOvMzuRLyjB+g2qKWmBlqT2GC io6bXaIpQwW+k+8a/mTA24NaWcG1b2sQHRBTJPoQxo+NbvwWqo0gA7sAkaYSZ6RybcXw pqHZeCGtfFErVdIG8R0SeAGMdY0sUEs4MCpSMvNz8kDe+tkti1EhgK2NFiGuTEhWYDdA hrQs2zoBfGP3tzyc+rvL9nlZCMv+kbVBS68mqi8oXlHRdZ866nkFpllkyKpQJ2tqQR/F l/mA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gxLEH86g; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-191245-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191245-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a626cc36f0dsi397142566b.320.2024.05.27.09.31.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 09:31:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-191245-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gxLEH86g; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-191245-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191245-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9E02D1F23F84 for ; Mon, 27 May 2024 16:31:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9407F155CB2; Mon, 27 May 2024 16:31:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gxLEH86g" 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 AC93A73473; Mon, 27 May 2024 16:31:01 +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=1716827461; cv=none; b=T/Uzq31ixP8j+x4V9h1x73LYNK8HIehnNAEFClY8xzZIG8hCbgcAmFlscsgQP8R8agpE6KA3Ljiz7KMeEXePIRRfToKY5KjaqqGl/R8MuBirwda0Z7bO31rBx2pVEcck5YXyrR3ijxq/16FjmWDyZAwOk6V4AJ/WIGstM9B9GRA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716827461; c=relaxed/simple; bh=wFzYxv0fxA4PHm+U+RUFutGQw4gMcFRHBJORjFR0yQE=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XBPEOEuifJknY1+ikpGbShiG8K4+dr9u58qqnuKI7lbe63eaf5xK+1eEbnDAoMfQHShoIrYOziMADuy31NhWXpKWEY/JsCYYYlWSERlQ/o1LSOmUlR9Eys7Omwr1Fn2hrxd82jW9a6hk130RxYV2qOzo+eYFdQAT5pfk1YLhMKM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gxLEH86g; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3878FC32781; Mon, 27 May 2024 16:31:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716827461; bh=wFzYxv0fxA4PHm+U+RUFutGQw4gMcFRHBJORjFR0yQE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gxLEH86gxe7ZfAK5zKlZ/j7jD2Y0eX49YH9bXtJxDjJg5jP6FjDrRKuCrhqX6jHoP 9nKNjpFKFfOmGWTLoQNuwgxsIsk3PIaej0kvKEkhtZbpKOv/fmvoil6O1QhbRo8DYI k1YIa3xSM0SMMvpYrkZXuaRNZVmoSkcqU0oeohtoNQPVP0DXYYWpz8DxvkjRJ5jSYk r9pryL0aDrWu3OeaX8ObokDTvhHWbcsNDAnwVWVr8nq6rwaDRaQQjAr+tATZ5QToqG P2UVj1e49JdccaR4g4zSZfqr4Lk+GDVudiRA72rKEv6EGw+S4VWeRQGY8+cLP/H/pq n0kCv9ZIrLVVQ== Date: Mon, 27 May 2024 09:30:59 -0700 From: Jakub Kicinski To: Ido Schimmel Cc: Danielle Ratson , "netdev@vger.kernel.org" , "davem@davemloft.net" , "edumazet@google.com" , "pabeni@redhat.com" , "corbet@lwn.net" , "linux@armlinux.org.uk" , "sdf@google.com" , "kory.maincent@bootlin.com" , "maxime.chevallier@bootlin.com" , "vladimir.oltean@nxp.com" , "przemyslaw.kitszel@intel.com" , "ahmed.zaki@intel.com" , "richardcochran@gmail.com" , "shayagr@amazon.com" , "paul.greenwalt@intel.com" , "jiri@resnulli.us" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , mlxsw , Petr Machata Subject: Re: [PATCH net-next v5 04/10] ethtool: Add flashing transceiver modules' firmware notifications ability Message-ID: <20240527093059.7e6e17ba@kernel.org> In-Reply-To: References: <20240424133023.4150624-5-danieller@nvidia.com> <20240429201130.5fad6d05@kernel.org> <20240430130302.235d612d@kernel.org> <20240501073758.3da76601@kernel.org> <20240522064519.3e980390@kernel.org> <20240522072212.7a21c84b@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, 27 May 2024 19:10:55 +0300 Ido Schimmel wrote: > On Wed, May 22, 2024 at 07:22:12AM -0700, Jakub Kicinski wrote: > > On Wed, 22 May 2024 13:56:11 +0000 Danielle Ratson wrote: =20 > > > The event should match the below: > > > event =3D=3D NETLINK_URELEASE && notify->protocol =3D=3D NETLINK_GENE= RIC > > >=20 > > > Then iterate over the list to look for work that matches the dev and = portid. > > > The socket doesn=E2=80=99t close until the work is done in that case.= =20 > >=20 > > Okay, good, yes. I think you can use one of the callbacks I mentioned > > below to achieve the same thing with less complexity than the notifier.= =20 >=20 > Danielle already has a POC with the notifier and it's not that > complicated. I wasn't aware of the netlink notifier, but we found it > when we tried to understand how other netlink families get notified > about a socket being closed. >=20 > Which advantages do you see in the sock_priv_destroy() approach? Are you > against the notifier approach? Notifier is not incorrect, but I worry it will result in more code, and basically duplication of what genl_sk_priv* does. Perhaps you managed to code it up very neatly - if so feel free to send the v6 and we can discuss further if needed? > > > > Easiest way to "notice" the socket got closed would probably be to = add some > > > > info to genl_sk_priv_*(). ->sock_priv_destroy() will get called. Bu= t you can also > > > > get a close notification in the family =20 > > > > ->unbind callback. =20 >=20 > Isn't the unbind callback only for multicast (whereas we are using > unicast)? True, should work in practice, I think. But sock_priv is much better. > > > Is there a scenario that we hit this event and won't intend to cancel= the work? =20 > >=20 > > I think it's up to us. I don't see any legit reason for user space to > > intentionally cancel the flashing. So the only option is that user space > > is either buggy or has crashed, and the socket got closed before > > flashing finished. Right? =20 >=20 > We don't think that closing the socket / killing the process mid > flashing is a legitimate scenario. We looked into it in order to avoid > sending unicast notifications to a socket that did not ask for them but > gets them because it was bound to the port ID that was used by the old > socket. >=20 > I agree that we don't need to cancel the work and can simply have the > work item stop sending notifications. User space will get an error if it > tries to flash a module that is already being flashed in the background. > WDYT? SGTM!