Article View: linux.kernel.netdev
Article #3305Re: [PATCH] net: intel: ice: Modernize ice_vsi_free() with scope-based guard(mutex)
From: Kohei Enju
Date: Wed, 14 Oct 2026 16:36
Date: Wed, 14 Oct 2026 16:36
46 lines
7159 bytes
7159 bytes
On 10/14 16:35, Ayush Yaduvanshi wrote:
> Signed-off-by: Ayush Yaduvanshi <ayush37735@gmail.com>
The commit message is missing, and this patch seems to be a clean-up
patch, which is discouraged in
Documentation/process/maintainer-netdev.rst. Also, this document says:
Use of ``guard()`` is discouraged within any function longer than 20 lines
> ---
> drivers/net/ethernet/intel/ice/ice_lib.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
> index 9e08db376d3d..c695df442822 100644
> --- a/drivers/net/ethernet/intel/ice/ice_lib.c
> +++ b/drivers/net/ethernet/intel/ice/ice_lib.c
> @@ -457,7 +457,7 @@ void ice_vsi_free(struct ice_vsi *vsi)
> return;
> }
>
> - mutex_lock(&pf->sw_mutex);
> + guard(mutex)(&pf->sw_mutex);
> /* updates the PF for this cleared VSI */
>
> pf->vsi[vsi->idx] = NULL;
> @@ -466,7 +466,6 @@ void ice_vsi_free(struct ice_vsi *vsi)
> ice_vsi_free_stats(vsi);
> ice_vsi_free_arrays(vsi);
> mutex_destroy(&vsi->xdp_state_lock);
> - mutex_unlock(&pf->sw_mutex);
> devm_kfree(dev, vsi);
This also extends the critical section, as devm_kfree() is now called
while holding pf->sw_mutex.
Could you please clarify why this change is necessary?
Thanks,
Kohei
> }
>
> --
> 2.53.0
>
Technical Details
Message-ID:
<as-tT0nDrchWa96T@x1>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346364-linux-kernel-netdev=dewy.ruReferences:
<20261014110552.56976-1-ayush37735@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346364-linux-kernel-netdev=dewy.ru
From: kohei@enjuk.jp (Kohei Enju)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH] net: intel: ice: Modernize ice_vsi_free() with
scope-based guard(mutex)
Date: Thu, 15 Oct 2026 01:36:35 +0900
Organization: Usenet Network
Message-ID: <as-tT0nDrchWa96T@x1>
References: <20261014110552.56976-1-ayush37735@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Injection-Info: usenet.network;
logging-data="2351800"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:SPRaqy4HqHboAr+6twDYYjGRhgU= sha256:bsEyGx6E+mGUDnv/QDvx43WV0VSY7TNDh23wKQD5prw=
sha1:Mce1amAJSjCoiZVR9a63Yiimth0= sha256:0keWka+55zulIrkpTWdLFfgsFg/4UC5xUWukKp7wivA=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id E5E53110183; Wed, 14 Oct 2026 20:41:21 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -0.749
X-Spam-Status: No, score=-0.749 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=enjuk.jp
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id 7XczaL3-WJ4a;
Wed, 14 Oct 2026 20:41:19 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-346364-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=enjuk.jp
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id 9C80211016C; Wed, 14 Oct 2026 20:41:10 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
by tor.lore.kernel.org (Postfix) with ESMTP id B10F04017F; Wed, 14 Oct 2026 17:37:33 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id EE067566C65;
Wed, 14 Oct 2026 17:36:06 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=enjuk.jp header.i=@enjuk.jp header.b="Dc+WSIlM"
X-Received: from www2881.sakura.ne.jp (www2881.sakura.ne.jp [49.212.198.91])
(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 DCAAD568521;
Wed, 14 Oct 2026 17:36:00 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=49.212.198.91
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1791999366; cv=none; b=ZmFfARmE4l5j0UNDwtw6C+YabxNOZUiyH9x2ayQOVv3lqRbdWTqjjYE8NmMe40AYnYjpmBgkbC6JNbhx1Bb6ghZdPH38zO29KZbh4VVYQl8VK8qirW7xtpjstZCucUBFw+Jg/cj5XNWseNqt9N8TagwJUBXJ6K5KUX26ssItRRg=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1791999366; c=relaxed/simple;
bh=rLQxIJWAv/seD+ddr6G6FD7bgK+FzkSzVXmYXiw6wog=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=b7FCvIGxKSUgVJ46K62j9fKb7fbzSjjoiJgc5liB8gfuZsDWL++FnSnl01+D0ej787O4rePcKkroIT1cJywEcXnQVpXGy1h6JnzDfNg+1EOib4waP1XLksmtVs3RWN6UUOyLiDYn0OeY4K1CU7bVd86hYn5ilzuiEYIhTHJ3JOU=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=enjuk.jp; spf=pass smtp.mailfrom=enjuk.jp; dkim=pass (2048-bit key) header.d=enjuk.jp header.i=@enjuk.jp header.b=Dc+WSIlM; arc=none smtp.client-ip=49.212.198.91
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=enjuk.jp
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=enjuk.jp
X-Received: from x1 (M106072126074.v4.enabler.ne.jp [106.72.126.74])
(authenticated bits=0)
by www2881.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 69EGaZFg095707
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO);
Thu, 15 Oct 2026 01:36:36 +0900 (JST)
(envelope-from kohei@enjuk.jp)
X-DKIM-Signature: a=rsa-sha256; bh=WBMVjY8YeonBZOvSdmUkR4YHsUWbR6DizhvuUowYl5c=;
c=relaxed/relaxed; d=enjuk.jp;
h=From:Message-ID:To:Subject:Date;
s=rs20251215; t=1791995796; v=1;
b=Dc+WSIlMSIFT5Of2aJUnUTIQPWZvu077QPVp2qtM2QIP66sBWEcLvv0eorAaYxqe
Ft5RV7g44YCJ2K/uPUBfUGB/1Xnqvqy705hyYe5T8gs5Ji2awUb28IDtblvwvIwy
XDhmH9iyHwdWUQM9MsPDGh7WJv3uiY7/0grkfYUV+FvOk1xCCUZSexqdaKxwwKdp
iFHRGgeFVKQCMOuJ3Ilgje5sa2Q9hbPS093JGLa7zsD7v0nFbscvHeJIhavbVt7L
1dohrheiB2vkcZVAfv/vLDCXnkxLxBrLtmPvZeQzzjikGQj80v+1TO8m+fwDDUkX
s4tmMy+NJoVQcqJmP8DdJg==
X-Cc: anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com,
intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-In-Reply-To: <20261014110552.56976-1-ayush37735@gmail.com>