Message ID | 20231221085109.2830794-3-yi.fang.gan@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-8026-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp275775dyi; Thu, 21 Dec 2023 00:56:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IEGGjDJpG2JOrnGhdYY/pPQZB9bhK99Wbdk1z1MYLcZXLPh6maBhBCeWKjq+qbat3yVGG0i X-Received: by 2002:a05:6214:d4f:b0:67f:889a:a9a3 with SMTP id 15-20020a0562140d4f00b0067f889aa9a3mr160146qvr.82.1703148966794; Thu, 21 Dec 2023 00:56:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703148966; cv=none; d=google.com; s=arc-20160816; b=HUO6sF4ITvi8H/I0KRMG5awGSFk7ANDDpUUJB97b3vGr4EqhkwPc/1kN/PAZeh80Zy FDs9HXd9NGDweaBHxe+GbPjRzg+lM5YX0MLqdGg10iNwe05IYtrjU8U9jhjYX8CLbnil C0MEORja8Z0TM02HTD2nGwtUagTNqjMc1gsTtt0yIQ2P3LlFE68xbHCUeMrUFviWAO8G C8ixjFtZlKWyQhg3NxvQrBszdPGsokYtnDBtQJLysg0wzHjCe5F/VFfrZj9MKwl+1htu QNIhF1eYclpqNPCL/eIR8VWHCVApZyTaT6rk3iggci9fxWs/+ojB6/Tv9v7wsyq/NBYu OT9A== ARC-Message-Signature: i=1; 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 :date:subject:cc:to:from:dkim-signature; bh=WtNeJHaG2+u6itwvw6SQ1Nweil/QWpwKG7cjZG9twDI=; fh=JhCqbF4gKBTnfq5pCBXWHsT+mGI+wlxAlh9egES2Iko=; b=VYz+/8Nx+Ct5IfGoy7S47MIAPcqDQp7ZaFLj5httcBdnFfZC1FJLJLW/gWoZpzJBqn Ylha63A5x2FA5gTX+mg+ZxhzYKLH+iPnJ9Cb95MB+etsanREYZ8hnTfPl0lDOBcGuI3M mzGzIxtSssu7+pTYG2eAZw7abrx+4PKop5kzVj9X5AqUnjW8fzWUOGhrbhv2N0WD2jWv L423opcfK76NpGxZpGCr6BLdZZrU4Zswet8J67+lS/Me34XHUi64lnVPBXbwxreffIEy eI2GQj1NJLizACZjqaD/l2pr3N7MYkSFKVlpqZufllGqn6nClh3Sn84cZN8p8AwU90zC fgaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=d7SM2IT5; spf=pass (google.com: domain of linux-kernel+bounces-8026-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8026-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v9-20020a0c8e09000000b0067f57e10b34si1631361qvb.595.2023.12.21.00.56.06 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 00:56:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8026-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=d7SM2IT5; spf=pass (google.com: domain of linux-kernel+bounces-8026-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8026-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 9296C1C21A73 for <ouuuleilei@gmail.com>; Thu, 21 Dec 2023 08:56:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D166640C1E; Thu, 21 Dec 2023 08:54:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="d7SM2IT5" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (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 CF568405D0; Thu, 21 Dec 2023 08:54:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703148888; x=1734684888; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1JsXbGf0ei8NX9i8T+iRqjYzH4+nfdAl4Vq6Pu5B8C0=; b=d7SM2IT5KxNyNvF0TewpWFy/x+/l5VzHs+oE5p7bXyoj9lvXOdsSTOBj 6VWW4HlrAubmKtQWolHFUUYxpBn8bGgm4ghq5SQsKuKkNbgmqB4b7ecs0 GNxweNqr/O6+OHed1/H/SsDyAyK6sM7vXxCkYzI6aAbxt0qwH8mcXV63m bQvGUBYAhz2GKhKXqRvKGUA5PpkiIA/+HFBOOn+AMlYZB3KjaCynb84qe gZmApuM6Y17qcFMe96Z9yyrCIIVg6NG5JiYI+hbEHN/OdPvw+FlaJCvtn NXCsndYvWiUZrNG5QRY7B0fj0NEqZK/0LccMmWsrUNz7z6Fm1z8sDTlQD w==; X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="2793718" X-IronPort-AV: E=Sophos;i="6.04,293,1695711600"; d="scan'208";a="2793718" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Dec 2023 00:54:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="842568348" X-IronPort-AV: E=Sophos;i="6.04,293,1695711600"; d="scan'208";a="842568348" Received: from ssid-ilbpg3-teeminta.png.intel.com (HELO localhost.localdomain) ([10.88.227.74]) by fmsmga008.fm.intel.com with ESMTP; 21 Dec 2023 00:54:41 -0800 From: "Gan, Yi Fang" <yi.fang.gan@intel.com> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Andrew Halaney <ahalaney@redhat.com>, Javier Martinez Canillas <javierm@redhat.com>, John Stultz <jstultz@google.com>, "Rafael J . Wysocki" <rafael@kernel.org>, Gan Yi Fang <yi.fang.gan@intel.com>, Jens Axboe <axboe@kernel.dk>, Russell King <linux@armlinux.org.uk>, Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>, "David S . Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, =?utf-8?q?Marek_Beh=C3=BAn?= <kabel@kernel.org>, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Looi Hong Aun <hong.aun.looi@intel.com>, Voon Weifeng <weifeng.voon@intel.com>, Song Yoong Siang <yoong.siang.song@intel.com>, Lai Peter Jun Ann <peter.jun.ann.lai@intel.com>, Choong Yong Liang <yong.liang.choong@intel.com> Subject: [PATCH net v2 2/2] net: phylink: Add module_exit_stub() Date: Thu, 21 Dec 2023 16:51:09 +0800 Message-Id: <20231221085109.2830794-3-yi.fang.gan@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231221085109.2830794-1-yi.fang.gan@intel.com> References: <20231221085109.2830794-1-yi.fang.gan@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785881131096415289 X-GMAIL-MSGID: 1785881131096415289 |
Series |
Fix phylink unloadable issue
|
|
Commit Message
Gan, Yi Fang
Dec. 21, 2023, 8:51 a.m. UTC
In delete_module(), if mod->init callback is defined but mod->exit
callback is not defined, it will assume the module cannot be removed
and return EBUSY. The module_exit() is missing from current phylink
module drive causing failure while unloading it.
Add module_exit_stub() in phylink for the module to be unloadable.
Fixes: eca68a3c7d05 ("net: phylink: pass supported host PHY interface modes to phylib for SFP's PHYs")
Cc: <stable@vger.kernel.org> # 6.1+
Signed-off-by: Gan, Yi Fang <yi.fang.gan@intel.com>
---
drivers/net/phy/phylink.c | 1 +
1 file changed, 1 insertion(+)
Comments
On Thu, Dec 21, 2023 at 04:51:09PM +0800, Gan, Yi Fang wrote: > In delete_module(), if mod->init callback is defined but mod->exit > callback is not defined, it will assume the module cannot be removed > and return EBUSY. The module_exit() is missing from current phylink > module drive causing failure while unloading it. You are missing justification it is actually safe to remove phylink. Maybe Russell King deliberately did not implement module_exit() because it can explode in interesting ways if it was? Andrew
Hi Andrew, The function phylink_init() is introduced by others. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-6.6.y&id=eca68a3c7d05b38b4e728cead0c49718f2bc1d5a The module_exit() is added by referring to https://elixir.bootlin.com/linux/latest/source/kernel/module/main.c#L738. Since the macro function is rejected, I will send a V3. Let's see if Rusell King has any comment. Thanks. Best Regards, Gan Yi Fang > -----Original Message----- > From: Andrew Lunn <andrew@lunn.ch> > Sent: Thursday, December 21, 2023 5:23 PM > To: Gan, Yi Fang <yi.fang.gan@intel.com> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>; Andrew Halaney > <ahalaney@redhat.com>; Javier Martinez Canillas <javierm@redhat.com>; John > Stultz <jstultz@google.com>; Rafael J . Wysocki <rafael@kernel.org>; Jens Axboe > <axboe@kernel.dk>; Russell King <linux@armlinux.org.uk>; Heiner Kallweit > <hkallweit1@gmail.com>; David S . Miller <davem@davemloft.net>; Eric > Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo > Abeni <pabeni@redhat.com>; Marek BehĂșn <kabel@kernel.org>; > netdev@vger.kernel.org; linux-stm32@st-md-mailman.stormreply.com; linux- > arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Looi, Hong Aun > <hong.aun.looi@intel.com>; Voon, Weifeng <weifeng.voon@intel.com>; Song, > Yoong Siang <yoong.siang.song@intel.com>; Lai, Peter Jun Ann > <peter.jun.ann.lai@intel.com>; Choong, Yong Liang > <yong.liang.choong@intel.com> > Subject: Re: [PATCH net v2 2/2] net: phylink: Add module_exit_stub() > > On Thu, Dec 21, 2023 at 04:51:09PM +0800, Gan, Yi Fang wrote: > > In delete_module(), if mod->init callback is defined but mod->exit > > callback is not defined, it will assume the module cannot be removed > > and return EBUSY. The module_exit() is missing from current phylink > > module drive causing failure while unloading it. > > You are missing justification it is actually safe to remove phylink. Maybe Russell > King deliberately did not implement > module_exit() because it can explode in interesting ways if it was? > > Andrew
On Thu, Jan 04, 2024 at 09:45:47AM +0000, Gan, Yi Fang wrote: > Hi Andrew, > > The function phylink_init() is introduced by others. > https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-6.6.y&id=eca68a3c7d05b38b4e728cead0c49718f2bc1d5a > The module_exit() is added by referring to > https://elixir.bootlin.com/linux/latest/source/kernel/module/main.c#L738. > Since the macro function is rejected, I will send a V3. > Let's see if Rusell King has any comment. Thanks. Please don't top post when using linux kernel mailing lists. > > You are missing justification it is actually safe to remove phylink. Maybe Russell > > King deliberately did not implement > > module_exit() because it can explode in interesting ways if it was? You still need to explain why it is safe to implement it. Andrew
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 25c19496a336..823c9b43cd92 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -3725,6 +3725,7 @@ static int __init phylink_init(void) } module_init(phylink_init); +module_exit_stub(phylink); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("phylink models the MAC to optional PHY connection");