Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2362721lqp; Sun, 24 Mar 2024 15:50:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVcegPHVAv1ibOOgGrVFHtpv29vUCi9kPr+IXrVrw9f5EzmsDmGiUakB0IOkTtf/RARBTyxIKv9lH8rUzteSao8vIZa0wLLzJvC9TVbFg== X-Google-Smtp-Source: AGHT+IHDk6AIGIAR4tT5eff1u33CTWdO+7cAeJAx3xOhTMnE8iHuqJUah9r2fKSZ9Yb8SWb2rgut X-Received: by 2002:a05:622a:1495:b0:431:529b:e0cf with SMTP id t21-20020a05622a149500b00431529be0cfmr2848248qtx.1.1711320659325; Sun, 24 Mar 2024 15:50:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711320659; cv=pass; d=google.com; s=arc-20160816; b=Z7z6SAHnDGs7/vGm+gmtLWBUaA14RmAS6zwtNKMnsNw4vUngvPtp/glL13FVqQZtB8 Fk8ABQrzfvr7oa2oFfppJigJ3E7+BWNu2mZ4ljmETL4Mk7yhEhPlwuC3q2aTcWMyAWNv 0owkMDo3sF/1yh7ijM79Jgi+jwPUIdc66fo37BKd7ZeobCaaqKN/Gn9nXKc3/n6ZF8NB ORWKCIdmEws+f9hdpFRouHCHpESSrWrU3DiJUv3vGs4gCm4fGyklvt0YFGqNGqE0YfUu lD95Z0gtaN7cuDzsOPh9M625xVEqcdFNVHnR/5x0Dxwu3GS6HqHgRnC85ePBhrSIM04K bIMA== 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 :date:subject:cc:to:from:dkim-signature; bh=d53QnjDONqkI0FXeScjV/M2rdFw4JQneyBy4bgtqHAo=; fh=JfWUvpOeeP7Md9Dp9qqmGzgAiHNGATTlTeHQJbWXJoA=; b=JYH9N7qAai634bM2LOcLhQKmf8iVNks37ac1MXHLAfNtNZJ4RJy6c5A/c2aMlld5GX 12Lc62E1/Kj/tU72futlJLQpkk1J7gbonGAIg894G3vllO5qr2CdznP4C6N8jylg+RIY 8Jo6+kjkGdOQShd9kHnypq8vDnezpvDsXNj6s4U4Th3CTgORCzYL0gYZ+exGWQgEZkHI sff2F4NiTDK+/uVk/KrtirztNavs/Sori4U9cJc+WMlVJVq124dFSdO53CU8udnzzTg0 HtjYTTWCrAhSQbMJ6LP265QIpYEaz9CbHuYNNg7pxkgjxZV6SWxrk721CoiZE24gkHLN bdbw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SHUsgGf+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-112953-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112953-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id cm11-20020a05622a250b00b004313c93978dsi4421031qtb.797.2024.03.24.15.50.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 15:50:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-112953-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SHUsgGf+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-112953-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112953-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0C87F1C21254 for ; Sun, 24 Mar 2024 22:50:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B74CB85646; Sun, 24 Mar 2024 22:36:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SHUsgGf+" 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 D5AE684FC8; Sun, 24 Mar 2024 22:36:05 +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=1711319765; cv=none; b=F3nK406EobouftbNMnX643j5qzNj93NRDTYMXKbvGFtvpRsr4EyInIqIXGBwDPk0EaIgAf9QPqU0/GY7ru3ZLLJ8qGJI2IfAJRK9ePlyBfiEkE9y7m1KKgwZpSKZYurMU4CkKTH+s0Jv35dLuhw7hzTUfgeySU+zibbCIJO6xA8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711319765; c=relaxed/simple; bh=dBV3B8MJUjFevc8l59/H8W8X83MP2S5X0b+e+rWPCVg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=B2/i+3R7tS9TAUN4t5GNbXOiaJsyFmcdz9TtF/nAV8EKvlUr+wtPhQbjeTMbDheygBUH/GO0nGBO0m9o2VvWstOzt/pW0Dkr/9u34YWTi+EATKskXN9zr8H/+p7VSeb74tcAHbmCrG8awF+PlT/06nluxtd2fTZxqcmyvO30XsI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SHUsgGf+; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05FA1C433F1; Sun, 24 Mar 2024 22:36:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711319765; bh=dBV3B8MJUjFevc8l59/H8W8X83MP2S5X0b+e+rWPCVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SHUsgGf+8Tb1KirPoXQkZdq3BEQ9Qqv9MOtmQxjIwY8DH69qjl9WC0SMjM6lQufev YwoqgQuL5Ut2EnZYjvLOKmLSc4TNueDA9wv1GH4qrQtM+t7nLql2yEzkqePgEl0H1E e59chdUjYDXlgWZyqVlZjE3+whz2vkfxj9bJ3FZHS4ylRnx/SvAWbBj47WXG30MRvy LUTGrvjqLWYOJhMumssVzI//nB5DGsoCnAgZgseP8U4r+oevTIz0FNuKtN4oi+k4fI eCLzFzQWpOtWSKX0N/od+juxPqueNKfcScSVeHE5xjJRhTK8bkp6ej+zguGTGiwZTA 3sU7Nzkv2/elA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ajay Singh , =?UTF-8?q?Alexis=20Lothor=C3=A9?= , Kalle Valo , Sasha Levin Subject: [PATCH 6.8 066/715] wifi: wilc1000: do not realloc workqueue everytime an interface is added Date: Sun, 24 Mar 2024 18:24:05 -0400 Message-ID: <20240324223455.1342824-67-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@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 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Ajay Singh [ Upstream commit 328efda22af81130c2ad981c110518cb29ff2f1d ] Commit 09ed8bfc5215 ("wilc1000: Rename workqueue from "WILC_wq" to "NETDEV-wq"") moved workqueue creation in wilc_netdev_ifc_init in order to set the interface name in the workqueue name. However, while the driver needs only one workqueue, the wilc_netdev_ifc_init is called each time we add an interface over a phy, which in turns overwrite the workqueue with a new one. This can be observed with the following commands: for i in $(seq 0 10) do iw phy phy0 interface add wlan1 type managed iw dev wlan1 del done ps -eo pid,comm|grep wlan 39 kworker/R-wlan0 98 kworker/R-wlan1 102 kworker/R-wlan1 105 kworker/R-wlan1 108 kworker/R-wlan1 111 kworker/R-wlan1 114 kworker/R-wlan1 117 kworker/R-wlan1 120 kworker/R-wlan1 123 kworker/R-wlan1 126 kworker/R-wlan1 129 kworker/R-wlan1 Fix this leakage by putting back hif_workqueue allocation in wilc_cfg80211_init. Regarding the workqueue name, it is indeed relevant to set it lowercase, however it is not attached to a specific netdev, so enforcing netdev name in the name is not so relevant. Still, enrich the name with the wiphy name to make it clear which phy is using the workqueue. Fixes: 09ed8bfc5215 ("wilc1000: Rename workqueue from "WILC_wq" to "NETDEV-wq"") Signed-off-by: Ajay Singh Co-developed-by: Alexis Lothoré Signed-off-by: Alexis Lothoré Signed-off-by: Kalle Valo Link: https://msgid.link/20240115-wilc_1000_fixes-v1-3-54d29463a738@bootlin.com Signed-off-by: Sasha Levin --- drivers/net/wireless/microchip/wilc1000/cfg80211.c | 11 ++++++++++- drivers/net/wireless/microchip/wilc1000/netdev.c | 10 +--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/microchip/wilc1000/cfg80211.c b/drivers/net/wireless/microchip/wilc1000/cfg80211.c index ad2509d8c99a4..2d0474e6404e1 100644 --- a/drivers/net/wireless/microchip/wilc1000/cfg80211.c +++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.c @@ -1804,15 +1804,24 @@ int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type, INIT_LIST_HEAD(&wl->rxq_head.list); INIT_LIST_HEAD(&wl->vif_list); + wl->hif_workqueue = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, + wiphy_name(wl->wiphy)); + if (!wl->hif_workqueue) { + ret = -ENOMEM; + goto free_cfg; + } vif = wilc_netdev_ifc_init(wl, "wlan%d", WILC_STATION_MODE, NL80211_IFTYPE_STATION, false); if (IS_ERR(vif)) { ret = PTR_ERR(vif); - goto free_cfg; + goto free_hq; } return 0; +free_hq: + destroy_workqueue(wl->hif_workqueue); + free_cfg: wilc_wlan_cfg_deinit(wl); diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.c b/drivers/net/wireless/microchip/wilc1000/netdev.c index 81e8f25863f5b..6c1058e5299c7 100644 --- a/drivers/net/wireless/microchip/wilc1000/netdev.c +++ b/drivers/net/wireless/microchip/wilc1000/netdev.c @@ -989,13 +989,6 @@ struct wilc_vif *wilc_netdev_ifc_init(struct wilc *wl, const char *name, goto error; } - wl->hif_workqueue = alloc_ordered_workqueue("%s-wq", WQ_MEM_RECLAIM, - ndev->name); - if (!wl->hif_workqueue) { - ret = -ENOMEM; - goto unregister_netdev; - } - ndev->needs_free_netdev = true; vif->iftype = vif_type; vif->idx = wilc_get_available_idx(wl); @@ -1008,12 +1001,11 @@ struct wilc_vif *wilc_netdev_ifc_init(struct wilc *wl, const char *name, return vif; -unregister_netdev: +error: if (rtnl_locked) cfg80211_unregister_netdevice(ndev); else unregister_netdev(ndev); - error: free_netdev(ndev); return ERR_PTR(ret); } -- 2.43.0