Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2557261lqp; Mon, 25 Mar 2024 02:31:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXVEhpYyAwW+o+2TVSFaySABD5ntdTa9Ogj8xsx7ACSSGsHBroKNyrHWNIgCab7EshDwBJLcmBTMbVXe8eI2k9VMs97cqGhbBIWPaxodQ== X-Google-Smtp-Source: AGHT+IGY2THTCxWNP/zs/5wGV+Mj7Q49YtRnf5hgQuMZATzug1AajDP/DDrETeSsPwxupd7WFczG X-Received: by 2002:a05:622a:5297:b0:431:301a:2fde with SMTP id dr23-20020a05622a529700b00431301a2fdemr8297880qtb.45.1711359070831; Mon, 25 Mar 2024 02:31:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711359070; cv=pass; d=google.com; s=arc-20160816; b=HzSqtwRrvnmKdKcB2xNg1pEDaf0TtmndgqFeOXuSprmueeSGMf4K3sXxYPRoeZMHkH JrIVz6ceJAYIe0gvTbvb4Gh84vdmVfOB6ug23ciU85zuwq18uYzqQiqFnCkrhXpjhqYi dT1yRf9ZpLHmAOx027juUW95uNfJwIvhGLQJp91aasdlOkkje4XBSbn3Fy1Jil2M7TEK ugtkBDrSKwgV8uMXaqZaei0czuEwSqW2VzNrr3Um5olvheGHJVDjhmoFRWEGjzUlHs0F OI4g9yoV0aoHfxFkO9tRhDN4gYjEIK69wV2rmYFB2nxA0V+2CsL3cchQQpoytfdRDqKc DsIQ== 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=CAU5FEFLldPFU3qjog3ka2wdF+5W36S7mAe7fcaPx48=; fh=JfWUvpOeeP7Md9Dp9qqmGzgAiHNGATTlTeHQJbWXJoA=; b=fkx9HKYFJ7XVrj3g6r9vB61rbu3TA+YlHa6ikCg/XtS76fC1HYRza3KALv93sbYM+8 5Wo87oD/ztNnFT/KTU0RPnKN1+ZlKWuYBXYYfE5u4Y7mfMbYp/OE58OTp/T459xfFHOs Qu6MpWe02B5PRYHF0s2A6NnfAPS16AcKCA7VBFx3r4Q3hw+UwI43pWc9/z1cAekxCDSX yJGjnSynxIfs9/mWbACeWwE8gkzlz01l8FukKTp/Cbvr+mAQ9frpfmLEfgpPwgiQSajp cbnu+FtsR6ECgKJmyw0r1VQ5dpzNmoPR0Gut88ezo+o/sI/MCClFzTsI8O/R31XNGyef ndIg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Y3X6BvFR; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115834-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115834-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 gd14-20020a05622a5c0e00b004311ea48155si5304342qtb.389.2024.03.25.02.31.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 02:31:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115834-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=Y3X6BvFR; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115834-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115834-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 845B91C31688 for ; Mon, 25 Mar 2024 09:31:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 05D4C3709E3; Mon, 25 Mar 2024 03:01:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Y3X6BvFR" 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 48D70145B1F; Sun, 24 Mar 2024 23:13:39 +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=1711322019; cv=none; b=QkbQeW0sUhjbNohCITPKSDF3j3Tk80J+DTaGdXnRIvBqUAZACERJ8XV6s9+DU18C7ZvgJRQiVpsBNL8u5518LI2uXZxLKcakBQee75HTtN1aPVJG0q9t9AUFSFGy1fTcHCeRa43NfA7PJ+vPQP+5sPQkhC2z0KAYVJK6cV3Tj88= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322019; c=relaxed/simple; bh=rM/a6NXuhaaDJxRNqFU+vOj3znGsfhW1ZP19rBQIkT4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lVHsIgoTpZZSE26Irhpc9XWEgngTPBkExjOWncxq/B09wgwUFsyiheBWe/THjLxzaXOAejTM4ylf14FRlnG9LYGi3J7vzXE2ajwj7xUhpkFGONw7/PEipx/S5uv0Sqxr9i0IHFw9DsNQRItlyBGjeoI8XZsFU1hqf/feUMY5Kfo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Y3X6BvFR; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72A5EC433F1; Sun, 24 Mar 2024 23:13:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711322019; bh=rM/a6NXuhaaDJxRNqFU+vOj3znGsfhW1ZP19rBQIkT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y3X6BvFRNma5N9snvapp1mpFsCrYaTM0KpTW2ARIUbL3fYLmN/r4lzhdXrx1w6QSm NTr0xpnskSs3TWU5Z3vwGrXBIw9RgiLI8TrhT3cYFjiozHaXJl4B9uFnGC/movicf7 WNFV8qLqHuVYqQrAC45CzxIT9H2cpmEoOfs0OvBRXLLM9agVuSMV9tczVEGB3uwuVu YrI7GKGRvaL3xeFViCnDlNPF8NosItKuE4NKZa+a38Vp5kb2amM3DAnrcJiEgboKb6 J6I2k+awl5s5tBoXhQCCAJO69JLU1TXXmIsLeSy8gPXZ/dwVotx88DbbHkig/MRnbw ytZJLP4XISpHQ== 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.1 091/451] wifi: wilc1000: do not realloc workqueue everytime an interface is added Date: Sun, 24 Mar 2024 19:06:07 -0400 Message-ID: <20240324231207.1351418-92-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-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 b545d93c6e374..2f75dc4b47975 100644 --- a/drivers/net/wireless/microchip/wilc1000/cfg80211.c +++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.c @@ -1810,15 +1810,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 e9f59de31b0b9..0e6eeeed2e086 100644 --- a/drivers/net/wireless/microchip/wilc1000/netdev.c +++ b/drivers/net/wireless/microchip/wilc1000/netdev.c @@ -977,13 +977,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); @@ -996,12 +989,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