* [PATCH 02/13] wifi: mwifiex: Use default @max_active for workqueues [not found] <20230509015032.3768622-1-tj@kernel.org> @ 2023-05-09 1:50 ` Tejun Heo 2023-05-10 8:45 ` Kalle Valo ` (2 more replies) 2023-05-09 1:50 ` [PATCH 05/13] wifi: ath10/11/12k: Use alloc_ordered_workqueue() to create ordered workqueues Tejun Heo 1 sibling, 3 replies; 11+ messages in thread From: Tejun Heo @ 2023-05-09 1:50 UTC (permalink / raw) To: jiangshanlai Cc: linux-kernel, kernel-team, Tejun Heo, Amitkumar Karwar, Ganapathi Bhat, Sharvari Harisangam, Xinming Hu, Kalle Valo, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-wireless, netdev These workqueues only host a single work item and thus doen't need explicit concurrency limit. Let's use the default @max_active. This doesn't cost anything and clearly expresses that @max_active doesn't matter. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Amitkumar Karwar <amitkarwar@gmail.com> Cc: Ganapathi Bhat <ganapathi017@gmail.com> Cc: Sharvari Harisangam <sharvari.harisangam@nxp.com> Cc: Xinming Hu <huxinming820@gmail.com> Cc: Kalle Valo <kvalo@kernel.org> Cc: "David S. Miller" <davem@davemloft.net> Cc: Eric Dumazet <edumazet@google.com> Cc: Jakub Kicinski <kuba@kernel.org> Cc: Paolo Abeni <pabeni@redhat.com> Cc: linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 4 ++-- drivers/net/wireless/marvell/mwifiex/main.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index bcd564dc3554..5337ee4b6f10 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -3127,7 +3127,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, priv->dfs_cac_workqueue = alloc_workqueue("MWIFIEX_DFS_CAC%s", WQ_HIGHPRI | WQ_MEM_RECLAIM | - WQ_UNBOUND, 1, name); + WQ_UNBOUND, 0, name); if (!priv->dfs_cac_workqueue) { mwifiex_dbg(adapter, ERROR, "cannot alloc DFS CAC queue\n"); ret = -ENOMEM; @@ -3138,7 +3138,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, priv->dfs_chan_sw_workqueue = alloc_workqueue("MWIFIEX_DFS_CHSW%s", WQ_HIGHPRI | WQ_UNBOUND | - WQ_MEM_RECLAIM, 1, name); + WQ_MEM_RECLAIM, 0, name); if (!priv->dfs_chan_sw_workqueue) { mwifiex_dbg(adapter, ERROR, "cannot alloc DFS channel sw queue\n"); ret = -ENOMEM; diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c index ea22a08e6c08..1cd9d20cca16 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -1547,7 +1547,7 @@ mwifiex_reinit_sw(struct mwifiex_adapter *adapter) adapter->workqueue = alloc_workqueue("MWIFIEX_WORK_QUEUE", - WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_UNBOUND, 1); + WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_UNBOUND, 0); if (!adapter->workqueue) goto err_kmalloc; @@ -1557,7 +1557,7 @@ mwifiex_reinit_sw(struct mwifiex_adapter *adapter) adapter->rx_workqueue = alloc_workqueue("MWIFIEX_RX_WORK_QUEUE", WQ_HIGHPRI | WQ_MEM_RECLAIM | - WQ_UNBOUND, 1); + WQ_UNBOUND, 0); if (!adapter->rx_workqueue) goto err_kmalloc; INIT_WORK(&adapter->rx_work, mwifiex_rx_work_queue); @@ -1702,7 +1702,7 @@ mwifiex_add_card(void *card, struct completion *fw_done, adapter->workqueue = alloc_workqueue("MWIFIEX_WORK_QUEUE", - WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_UNBOUND, 1); + WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_UNBOUND, 0); if (!adapter->workqueue) goto err_kmalloc; @@ -1712,7 +1712,7 @@ mwifiex_add_card(void *card, struct completion *fw_done, adapter->rx_workqueue = alloc_workqueue("MWIFIEX_RX_WORK_QUEUE", WQ_HIGHPRI | WQ_MEM_RECLAIM | - WQ_UNBOUND, 1); + WQ_UNBOUND, 0); if (!adapter->rx_workqueue) goto err_kmalloc; -- 2.40.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 02/13] wifi: mwifiex: Use default @max_active for workqueues 2023-05-09 1:50 ` [PATCH 02/13] wifi: mwifiex: Use default @max_active for workqueues Tejun Heo @ 2023-05-10 8:45 ` Kalle Valo 2023-05-10 18:09 ` Brian Norris 2023-05-19 0:36 ` Tejun Heo 2 siblings, 0 replies; 11+ messages in thread From: Kalle Valo @ 2023-05-10 8:45 UTC (permalink / raw) To: Tejun Heo Cc: jiangshanlai, linux-kernel, kernel-team, Tejun Heo, Amitkumar Karwar, Ganapathi Bhat, Sharvari Harisangam, Xinming Hu, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-wireless, netdev Tejun Heo <tj@kernel.org> wrote: > These workqueues only host a single work item and thus doen't need explicit > concurrency limit. Let's use the default @max_active. This doesn't cost > anything and clearly expresses that @max_active doesn't matter. > > Signed-off-by: Tejun Heo <tj@kernel.org> > Cc: Amitkumar Karwar <amitkarwar@gmail.com> > Cc: Ganapathi Bhat <ganapathi017@gmail.com> > Cc: Sharvari Harisangam <sharvari.harisangam@nxp.com> > Cc: Xinming Hu <huxinming820@gmail.com> > Cc: Kalle Valo <kvalo@kernel.org> > Cc: "David S. Miller" <davem@davemloft.net> > Cc: Eric Dumazet <edumazet@google.com> > Cc: Jakub Kicinski <kuba@kernel.org> > Cc: Paolo Abeni <pabeni@redhat.com> > Cc: linux-wireless@vger.kernel.org > Cc: netdev@vger.kernel.org > Cc: linux-kernel@vger.kernel.org I didn't review the patch but I assume it's ok. Feel free to take it via your tree: Acked-by: Kalle Valo <kvalo@kernel.org> Patch set to Not Applicable. -- https://patchwork.kernel.org/project/linux-wireless/patch/20230509015032.3768622-3-tj@kernel.org/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 02/13] wifi: mwifiex: Use default @max_active for workqueues 2023-05-09 1:50 ` [PATCH 02/13] wifi: mwifiex: Use default @max_active for workqueues Tejun Heo 2023-05-10 8:45 ` Kalle Valo @ 2023-05-10 18:09 ` Brian Norris 2023-05-10 18:16 ` Tejun Heo 2023-05-19 0:36 ` Tejun Heo 2 siblings, 1 reply; 11+ messages in thread From: Brian Norris @ 2023-05-10 18:09 UTC (permalink / raw) To: Tejun Heo Cc: jiangshanlai, linux-kernel, kernel-team, Amitkumar Karwar, Ganapathi Bhat, Sharvari Harisangam, Xinming Hu, Kalle Valo, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-wireless, netdev On Mon, May 08, 2023 at 03:50:21PM -1000, Tejun Heo wrote: > These workqueues only host a single work item and thus doen't need explicit > concurrency limit. Let's use the default @max_active. This doesn't cost > anything and clearly expresses that @max_active doesn't matter. > > Signed-off-by: Tejun Heo <tj@kernel.org> > Cc: Amitkumar Karwar <amitkarwar@gmail.com> > Cc: Ganapathi Bhat <ganapathi017@gmail.com> > Cc: Sharvari Harisangam <sharvari.harisangam@nxp.com> > Cc: Xinming Hu <huxinming820@gmail.com> > Cc: Kalle Valo <kvalo@kernel.org> > Cc: "David S. Miller" <davem@davemloft.net> > Cc: Eric Dumazet <edumazet@google.com> > Cc: Jakub Kicinski <kuba@kernel.org> > Cc: Paolo Abeni <pabeni@redhat.com> > Cc: linux-wireless@vger.kernel.org > Cc: netdev@vger.kernel.org > Cc: linux-kernel@vger.kernel.org Reviewed-by: Brian Norris <briannorris@chromium.org> I'll admit, the workqueue documentation sounds a bit like "max_active == 1 + WQ_UNBOUND" is what we want ("one work item [...] active at any given time"), but that's more of my misunderstanding than anything -- each work item can only be active in a single context at any given time, so that note is talking about distinct (i.e., more than 1) work items. While I'm here: we're still debugging what's affecting WiFi performance on some of our WiFi systems, but it's possible I'll be turning some of these into struct kthread_worker instead. We can cross that bridge (including potential conflicts) if/when we come to it though. Thanks, Brian ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 02/13] wifi: mwifiex: Use default @max_active for workqueues 2023-05-10 18:09 ` Brian Norris @ 2023-05-10 18:16 ` Tejun Heo 2023-05-10 18:57 ` Brian Norris 0 siblings, 1 reply; 11+ messages in thread From: Tejun Heo @ 2023-05-10 18:16 UTC (permalink / raw) To: Brian Norris Cc: jiangshanlai, linux-kernel, kernel-team, Amitkumar Karwar, Ganapathi Bhat, Sharvari Harisangam, Xinming Hu, Kalle Valo, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-wireless, netdev Hello, On Wed, May 10, 2023 at 11:09:55AM -0700, Brian Norris wrote: > I'll admit, the workqueue documentation sounds a bit like "max_active == > 1 + WQ_UNBOUND" is what we want ("one work item [...] active at any > given time"), but that's more of my misunderstanding than anything -- > each work item can only be active in a single context at any given time, > so that note is talking about distinct (i.e., more than 1) work items. Yeah, a future patch is gonna change the semantics a bit and I'll update the doc to be clearer. > While I'm here: we're still debugging what's affecting WiFi performance > on some of our WiFi systems, but it's possible I'll be turning some of > these into struct kthread_worker instead. We can cross that bridge > (including potential conflicts) if/when we come to it though. Can you elaborate the performance problem you're seeing? I'm working on a major update for workqueue to improve its locality behavior, so if you're experiencing issues on CPUs w/ multiple L3 caches, it'd be a good test case. Thanks. -- tejun ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 02/13] wifi: mwifiex: Use default @max_active for workqueues 2023-05-10 18:16 ` Tejun Heo @ 2023-05-10 18:57 ` Brian Norris 2023-05-10 19:19 ` Tejun Heo 0 siblings, 1 reply; 11+ messages in thread From: Brian Norris @ 2023-05-10 18:57 UTC (permalink / raw) To: Tejun Heo Cc: jiangshanlai, linux-kernel, kernel-team, Amitkumar Karwar, Ganapathi Bhat, Sharvari Harisangam, Xinming Hu, Kalle Valo, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-wireless, netdev, Pin-yen Lin Hi, On Wed, May 10, 2023 at 08:16:00AM -1000, Tejun Heo wrote: > > While I'm here: we're still debugging what's affecting WiFi performance > > on some of our WiFi systems, but it's possible I'll be turning some of > > these into struct kthread_worker instead. We can cross that bridge > > (including potential conflicts) if/when we come to it though. > > Can you elaborate the performance problem you're seeing? I'm working on a > major update for workqueue to improve its locality behavior, so if you're > experiencing issues on CPUs w/ multiple L3 caches, it'd be a good test case. Sure! Test case: iperf TCP RX (i.e., hits "MWIFIEX_RX_WORK_QUEUE" a lot) at some of the higher (VHT 80 MHz) data rates. Hardware: Mediatek MT8173 2xA53 (little) + 2xA72 (big) CPU (I'm not familiar with its cache details) + Marvell SD8897 SDIO WiFi (mwifiex_sdio) We're looking at a major regression from our 4.19 kernel to a 5.15 kernel (yeah, that's downstream reality). So far, we've found that performance is: (1) much better (nearly the same as 4.19) if we add WQ_SYSFS and pin the work queue to one CPU (doesn't really matter which CPU, as long as it's not the one loaded with IRQ(?) work) (2) moderately better if we pin the CPU frequency (e.g., "performance" cpufreq governor instead of "schedutil") (3) moderately better (not quite as good as (2)) if we switch a kthread_worker and don't pin anything. We tried (2) because we saw a lot more CPU migration on kernel 5.15 (work moves across all 4 CPUs throughout the run; on kernel 4.19 it mostly switched between 2 CPUs). We tried (3) suspecting some kind of EAS issue (instead of distributing our workload onto 4 different kworkers, our work (and therefore our load calculation) is mostly confined to a single kernel thread). But it still seems like our issues are more than "just" EAS / cpufreq issues, since (2) and (3) aren't as good as (1). NB: there weren't many relevant mwifiex or MTK-SDIO changes in this range. So we're still investigating a few other areas, but it does seem like "locality" (in some sense of the word) is relevant. We'd probably be open to testing any patches you have, although it's likely we'd have the easiest time if we can port those to 5.15. We're constantly working on getting good upstream support for Chromebook chips, but ARM SoC reality is that it still varies a lot as to how much works upstream on any given system. Thanks, Brian ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 02/13] wifi: mwifiex: Use default @max_active for workqueues 2023-05-10 18:57 ` Brian Norris @ 2023-05-10 19:19 ` Tejun Heo 2023-05-10 19:50 ` Brian Norris 0 siblings, 1 reply; 11+ messages in thread From: Tejun Heo @ 2023-05-10 19:19 UTC (permalink / raw) To: Brian Norris Cc: jiangshanlai, linux-kernel, kernel-team, Amitkumar Karwar, Ganapathi Bhat, Sharvari Harisangam, Xinming Hu, Kalle Valo, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-wireless, netdev, Pin-yen Lin Hello, On Wed, May 10, 2023 at 11:57:41AM -0700, Brian Norris wrote: > Test case: iperf TCP RX (i.e., hits "MWIFIEX_RX_WORK_QUEUE" a lot) at > some of the higher (VHT 80 MHz) data rates. > > Hardware: Mediatek MT8173 2xA53 (little) + 2xA72 (big) CPU > (I'm not familiar with its cache details) > + > Marvell SD8897 SDIO WiFi (mwifiex_sdio) Yeah, we had multiple of similar cases on, what I think are, similar configurations, which is why I'm working on improving workqueue locality. > We're looking at a major regression from our 4.19 kernel to a 5.15 > kernel (yeah, that's downstream reality). So far, we've found that > performance is: That's curious. 4.19 is old but I scanned the history and there's nothing which can cause that kind of perf regression for unbound workqueues between 4.19 and 5.15. > (1) much better (nearly the same as 4.19) if we add WQ_SYSFS and pin the > work queue to one CPU (doesn't really matter which CPU, as long as it's > not the one loaded with IRQ(?) work) > > (2) moderately better if we pin the CPU frequency (e.g., "performance" > cpufreq governor instead of "schedutil") > > (3) moderately better (not quite as good as (2)) if we switch a > kthread_worker and don't pin anything. Hmm... so it's not just workqueue. > We tried (2) because we saw a lot more CPU migration on kernel 5.15 > (work moves across all 4 CPUs throughout the run; on kernel 4.19 it > mostly switched between 2 CPUs). Workqueue can contribute to this but it seems more likely that scheduling changes are also part of the story. > We tried (3) suspecting some kind of EAS issue (instead of distributing > our workload onto 4 different kworkers, our work (and therefore our load > calculation) is mostly confined to a single kernel thread). But it still > seems like our issues are more than "just" EAS / cpufreq issues, since > (2) and (3) aren't as good as (1). > > NB: there weren't many relevant mwifiex or MTK-SDIO changes in this > range. > > So we're still investigating a few other areas, but it does seem like > "locality" (in some sense of the word) is relevant. We'd probably be > open to testing any patches you have, although it's likely we'd have the > easiest time if we can port those to 5.15. We're constantly working on > getting good upstream support for Chromebook chips, but ARM SoC reality > is that it still varies a lot as to how much works upstream on any given > system. I should be able to post the patchset later today or tomorrow. It comes with sysfs knobs to control affinity scopes and strictness, so hopefully you should be able to find the configuration that works without too much difficulty. Thanks. -- tejun ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 02/13] wifi: mwifiex: Use default @max_active for workqueues 2023-05-10 19:19 ` Tejun Heo @ 2023-05-10 19:50 ` Brian Norris 0 siblings, 0 replies; 11+ messages in thread From: Brian Norris @ 2023-05-10 19:50 UTC (permalink / raw) To: Tejun Heo Cc: jiangshanlai, linux-kernel, kernel-team, Amitkumar Karwar, Ganapathi Bhat, Sharvari Harisangam, Xinming Hu, Kalle Valo, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-wireless, netdev, Pin-yen Lin On Wed, May 10, 2023 at 09:19:20AM -1000, Tejun Heo wrote: > On Wed, May 10, 2023 at 11:57:41AM -0700, Brian Norris wrote: > > (1) much better (nearly the same as 4.19) if we add WQ_SYSFS and pin the > > work queue to one CPU (doesn't really matter which CPU, as long as it's > > not the one loaded with IRQ(?) work) > > > > (2) moderately better if we pin the CPU frequency (e.g., "performance" > > cpufreq governor instead of "schedutil") > > > > (3) moderately better (not quite as good as (2)) if we switch a > > kthread_worker and don't pin anything. > > Hmm... so it's not just workqueue. Right. And not just cpufreq either. > > We tried (2) because we saw a lot more CPU migration on kernel 5.15 > > (work moves across all 4 CPUs throughout the run; on kernel 4.19 it > > mostly switched between 2 CPUs). > > Workqueue can contribute to this but it seems more likely that scheduling > changes are also part of the story. Yeah, that's one theory. And in that vein, that's one reason we might consider switching to a kthread_worker anyway, even if that doesn't solve all the regression -- because schedutil relies on per-entity load calculations to make decisions, and workqueues don't help the scheduler understand that load when spread across N CPUs (workers). A dedicated kthread would better represent our workload to the scheduler. (Threaded NAPI -- mwifiex doesn't support NAPI -- takes a similar approach, as it has its own thread per NAPI context.) > > We tried (3) suspecting some kind of EAS issue (instead of distributing > > our workload onto 4 different kworkers, our work (and therefore our load > > calculation) is mostly confined to a single kernel thread). But it still > > seems like our issues are more than "just" EAS / cpufreq issues, since > > (2) and (3) aren't as good as (1). > > > > NB: there weren't many relevant mwifiex or MTK-SDIO changes in this > > range. > > > > So we're still investigating a few other areas, but it does seem like > > "locality" (in some sense of the word) is relevant. We'd probably be > > open to testing any patches you have, although it's likely we'd have the > > easiest time if we can port those to 5.15. We're constantly working on > > getting good upstream support for Chromebook chips, but ARM SoC reality > > is that it still varies a lot as to how much works upstream on any given > > system. > > I should be able to post the patchset later today or tomorrow. It comes with > sysfs knobs to control affinity scopes and strictness, so hopefully you > should be able to find the configuration that works without too much > difficulty. Great! Brian ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 02/13] wifi: mwifiex: Use default @max_active for workqueues 2023-05-09 1:50 ` [PATCH 02/13] wifi: mwifiex: Use default @max_active for workqueues Tejun Heo 2023-05-10 8:45 ` Kalle Valo 2023-05-10 18:09 ` Brian Norris @ 2023-05-19 0:36 ` Tejun Heo 2 siblings, 0 replies; 11+ messages in thread From: Tejun Heo @ 2023-05-19 0:36 UTC (permalink / raw) To: jiangshanlai Cc: linux-kernel, kernel-team, Amitkumar Karwar, Ganapathi Bhat, Sharvari Harisangam, Xinming Hu, Kalle Valo, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-wireless, netdev On Mon, May 08, 2023 at 03:50:21PM -1000, Tejun Heo wrote: > These workqueues only host a single work item and thus doen't need explicit > concurrency limit. Let's use the default @max_active. This doesn't cost > anything and clearly expresses that @max_active doesn't matter. Applied to wq/for-6.5-cleanup-ordered. Thanks. -- tejun ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 05/13] wifi: ath10/11/12k: Use alloc_ordered_workqueue() to create ordered workqueues [not found] <20230509015032.3768622-1-tj@kernel.org> 2023-05-09 1:50 ` [PATCH 02/13] wifi: mwifiex: Use default @max_active for workqueues Tejun Heo @ 2023-05-09 1:50 ` Tejun Heo 2023-05-10 8:41 ` Kalle Valo 2023-05-19 0:41 ` Tejun Heo 1 sibling, 2 replies; 11+ messages in thread From: Tejun Heo @ 2023-05-09 1:50 UTC (permalink / raw) To: jiangshanlai Cc: linux-kernel, kernel-team, Tejun Heo, Kalle Valo, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-wireless, netdev BACKGROUND ========== When multiple work items are queued to a workqueue, their execution order doesn't match the queueing order. They may get executed in any order and simultaneously. When fully serialized execution - one by one in the queueing order - is needed, an ordered workqueue should be used which can be created with alloc_ordered_workqueue(). However, alloc_ordered_workqueue() was a later addition. Before it, an ordered workqueue could be obtained by creating an UNBOUND workqueue with @max_active==1. This originally was an implementation side-effect which was broken by 4c16bd327c74 ("workqueue: restore WQ_UNBOUND/max_active==1 to be ordered"). Because there were users that depended on the ordered execution, 5c0338c68706 ("workqueue: restore WQ_UNBOUND/max_active==1 to be ordered") made workqueue allocation path to implicitly promote UNBOUND workqueues w/ @max_active==1 to ordered workqueues. While this has worked okay, overloading the UNBOUND allocation interface this way creates other issues. It's difficult to tell whether a given workqueue actually needs to be ordered and users that legitimately want a min concurrency level wq unexpectedly gets an ordered one instead. With planned UNBOUND workqueue updates to improve execution locality and more prevalence of chiplet designs which can benefit from such improvements, this isn't a state we wanna be in forever. This patch series audits all callsites that create an UNBOUND workqueue w/ @max_active==1 and converts them to alloc_ordered_workqueue() as necessary. WHAT TO LOOK FOR ================ The conversions are from alloc_workqueue(WQ_UNBOUND | flags, 1, args..) to alloc_ordered_workqueue(flags, args...) which don't cause any functional changes. If you know that fully ordered execution is not ncessary, please let me know. I'll drop the conversion and instead add a comment noting the fact to reduce confusion while conversion is in progress. If you aren't fully sure, it's completely fine to let the conversion through. The behavior will stay exactly the same and we can always reconsider later. As there are follow-up workqueue core changes, I'd really appreciate if the patch can be routed through the workqueue tree w/ your acks. Thanks. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Kalle Valo <kvalo@kernel.org> Cc: "David S. Miller" <davem@davemloft.net> Cc: Eric Dumazet <edumazet@google.com> Cc: Jakub Kicinski <kuba@kernel.org> Cc: Paolo Abeni <pabeni@redhat.com> Cc: linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org --- drivers/net/wireless/ath/ath10k/qmi.c | 3 +-- drivers/net/wireless/ath/ath11k/qmi.c | 3 +-- drivers/net/wireless/ath/ath12k/qmi.c | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/qmi.c b/drivers/net/wireless/ath/ath10k/qmi.c index 038c5903c0dc..52c1a3de8da6 100644 --- a/drivers/net/wireless/ath/ath10k/qmi.c +++ b/drivers/net/wireless/ath/ath10k/qmi.c @@ -1082,8 +1082,7 @@ int ath10k_qmi_init(struct ath10k *ar, u32 msa_size) if (ret) goto err; - qmi->event_wq = alloc_workqueue("ath10k_qmi_driver_event", - WQ_UNBOUND, 1); + qmi->event_wq = alloc_ordered_workqueue("ath10k_qmi_driver_event", 0); if (!qmi->event_wq) { ath10k_err(ar, "failed to allocate workqueue\n"); ret = -EFAULT; diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c index ab923e24b0a9..26b252e62909 100644 --- a/drivers/net/wireless/ath/ath11k/qmi.c +++ b/drivers/net/wireless/ath/ath11k/qmi.c @@ -3256,8 +3256,7 @@ int ath11k_qmi_init_service(struct ath11k_base *ab) return ret; } - ab->qmi.event_wq = alloc_workqueue("ath11k_qmi_driver_event", - WQ_UNBOUND, 1); + ab->qmi.event_wq = alloc_ordered_workqueue("ath11k_qmi_driver_event", 0); if (!ab->qmi.event_wq) { ath11k_err(ab, "failed to allocate workqueue\n"); return -EFAULT; diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c index 03ba245fbee9..0a7892b1a8f8 100644 --- a/drivers/net/wireless/ath/ath12k/qmi.c +++ b/drivers/net/wireless/ath/ath12k/qmi.c @@ -3056,8 +3056,7 @@ int ath12k_qmi_init_service(struct ath12k_base *ab) return ret; } - ab->qmi.event_wq = alloc_workqueue("ath12k_qmi_driver_event", - WQ_UNBOUND, 1); + ab->qmi.event_wq = alloc_ordered_workqueue("ath12k_qmi_driver_event", 0); if (!ab->qmi.event_wq) { ath12k_err(ab, "failed to allocate workqueue\n"); return -EFAULT; -- 2.40.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 05/13] wifi: ath10/11/12k: Use alloc_ordered_workqueue() to create ordered workqueues 2023-05-09 1:50 ` [PATCH 05/13] wifi: ath10/11/12k: Use alloc_ordered_workqueue() to create ordered workqueues Tejun Heo @ 2023-05-10 8:41 ` Kalle Valo 2023-05-19 0:41 ` Tejun Heo 1 sibling, 0 replies; 11+ messages in thread From: Kalle Valo @ 2023-05-10 8:41 UTC (permalink / raw) To: Tejun Heo Cc: jiangshanlai, linux-kernel, kernel-team, Tejun Heo, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-wireless, netdev Tejun Heo <tj@kernel.org> wrote: > BACKGROUND > ========== > > When multiple work items are queued to a workqueue, their execution order > doesn't match the queueing order. They may get executed in any order and > simultaneously. When fully serialized execution - one by one in the queueing > order - is needed, an ordered workqueue should be used which can be created > with alloc_ordered_workqueue(). > > However, alloc_ordered_workqueue() was a later addition. Before it, an > ordered workqueue could be obtained by creating an UNBOUND workqueue with > @max_active==1. This originally was an implementation side-effect which was > broken by 4c16bd327c74 ("workqueue: restore WQ_UNBOUND/max_active==1 to be > ordered"). Because there were users that depended on the ordered execution, > 5c0338c68706 ("workqueue: restore WQ_UNBOUND/max_active==1 to be ordered") > made workqueue allocation path to implicitly promote UNBOUND workqueues w/ > @max_active==1 to ordered workqueues. > > While this has worked okay, overloading the UNBOUND allocation interface > this way creates other issues. It's difficult to tell whether a given > workqueue actually needs to be ordered and users that legitimately want a > min concurrency level wq unexpectedly gets an ordered one instead. With > planned UNBOUND workqueue updates to improve execution locality and more > prevalence of chiplet designs which can benefit from such improvements, this > isn't a state we wanna be in forever. > > This patch series audits all callsites that create an UNBOUND workqueue w/ > @max_active==1 and converts them to alloc_ordered_workqueue() as necessary. > > WHAT TO LOOK FOR > ================ > > The conversions are from > > alloc_workqueue(WQ_UNBOUND | flags, 1, args..) > > to > > alloc_ordered_workqueue(flags, args...) > > which don't cause any functional changes. If you know that fully ordered > execution is not ncessary, please let me know. I'll drop the conversion and > instead add a comment noting the fact to reduce confusion while conversion > is in progress. > > If you aren't fully sure, it's completely fine to let the conversion > through. The behavior will stay exactly the same and we can always > reconsider later. > > As there are follow-up workqueue core changes, I'd really appreciate if the > patch can be routed through the workqueue tree w/ your acks. Thanks. > > Signed-off-by: Tejun Heo <tj@kernel.org> > Cc: Kalle Valo <kvalo@kernel.org> > Cc: "David S. Miller" <davem@davemloft.net> > Cc: Eric Dumazet <edumazet@google.com> > Cc: Jakub Kicinski <kuba@kernel.org> > Cc: Paolo Abeni <pabeni@redhat.com> > Cc: linux-wireless@vger.kernel.org > Cc: netdev@vger.kernel.org I run quick smoke tests with ath11k and ath12k, didn't see any issues. Feel free to take via the workqueue tree: Acked-by: Kalle Valo <kvalo@kernel.org> -- https://patchwork.kernel.org/project/linux-wireless/patch/20230509015032.3768622-6-tj@kernel.org/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 05/13] wifi: ath10/11/12k: Use alloc_ordered_workqueue() to create ordered workqueues 2023-05-09 1:50 ` [PATCH 05/13] wifi: ath10/11/12k: Use alloc_ordered_workqueue() to create ordered workqueues Tejun Heo 2023-05-10 8:41 ` Kalle Valo @ 2023-05-19 0:41 ` Tejun Heo 1 sibling, 0 replies; 11+ messages in thread From: Tejun Heo @ 2023-05-19 0:41 UTC (permalink / raw) To: jiangshanlai Cc: linux-kernel, kernel-team, Kalle Valo, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-wireless, netdev Applied to wq/for-6.5-cleanup-ordered. Thanks. -- tejun ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-05-19 0:41 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20230509015032.3768622-1-tj@kernel.org>
2023-05-09 1:50 ` [PATCH 02/13] wifi: mwifiex: Use default @max_active for workqueues Tejun Heo
2023-05-10 8:45 ` Kalle Valo
2023-05-10 18:09 ` Brian Norris
2023-05-10 18:16 ` Tejun Heo
2023-05-10 18:57 ` Brian Norris
2023-05-10 19:19 ` Tejun Heo
2023-05-10 19:50 ` Brian Norris
2023-05-19 0:36 ` Tejun Heo
2023-05-09 1:50 ` [PATCH 05/13] wifi: ath10/11/12k: Use alloc_ordered_workqueue() to create ordered workqueues Tejun Heo
2023-05-10 8:41 ` Kalle Valo
2023-05-19 0:41 ` Tejun Heo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).