Patch "wifi: wilc1000: do not realloc workqueue everytime an interface is added" has been added to the 6.8-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    wifi: wilc1000: do not realloc workqueue everytime an interface is added

to the 6.8-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     wifi-wilc1000-do-not-realloc-workqueue-everytime-an-.patch
and it can be found in the queue-6.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 7cae1ac568dbe27578b97d25bdb59bd4a08e1570
Author: Ajay Singh <ajay.kathat@xxxxxxxxxxxxx>
Date:   Mon Jan 15 15:56:32 2024 +0100

    wifi: wilc1000: do not realloc workqueue everytime an interface is added
    
    [ 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 <ajay.kathat@xxxxxxxxxxxxx>
    Co-developed-by: Alexis Lothoré <alexis.lothore@xxxxxxxxxxx>
    Signed-off-by: Alexis Lothoré <alexis.lothore@xxxxxxxxxxx>
    Signed-off-by: Kalle Valo <kvalo@xxxxxxxxxx>
    Link: https://msgid.link/20240115-wilc_1000_fixes-v1-3-54d29463a738@xxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

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);
 }




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux