From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id 7F34A3B29E for ; Fri, 21 Apr 2023 00:29:49 -0400 (EDT) Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-2f58125b957so1141016f8f.3 for ; Thu, 20 Apr 2023 21:29:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682051387; x=1684643387; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=LWgixr8spTIdwfyD+e65YRtbmoq5NXG9XUfOHNyNVuY=; b=p1X/EwW7HcuuFvzbtJ83VcU2dInPd/Jn8a/B0k/tPevajGEOX8JF6uE+9WZ1AwE6LC 155ekoNeB8IYjqxc6at0KFBbqdsGnPi2aolFNjAomdUxr9FoQwFDa0E5rc45pnS9+2JV xBInzAybC23hAR/hpYZNFh14IiduaHqYHl3/ncedwiNmqwssYORwxkwA5WH1NVCvN5Mu jBivgXlcfV6NoyaIuQjcUYQwsP5Zdp1KNn3iRXj87ontE4lqiqCXg8llqZWbPQAX/j9u aZPSJ52tsfEYzeoJ1jwMBlUvphJcSOs5zNWfgBbmqfDOJ2+VezgLvnBmPomY4YnIzfhR jDlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682051387; x=1684643387; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LWgixr8spTIdwfyD+e65YRtbmoq5NXG9XUfOHNyNVuY=; b=NL085GcTEKr1kjcM9H81aAV9/Rcu4iuNdX2TL51O+kw8NC9S4P2mfLuscXTihREr28 2g3C8TNSyi7T7moehEZ9kTLzftWmQ24bEXx8RW+kacmDpFn1fh5xPbpdZDvMQUfNqYCZ ikqKMJLeIJTTitaqouGj3fbWUeBIaEJwrbIcsFkjHXS/ZferV6kf+KShlF+fdaRbyIw3 KFPY7sQ6618o0GB2mDosbYyN8+dZHasj2F86VP/muqunO9a3FGXcYJEMI3qOLjbQlQ85 JiIf73g7l/uPAOa7hjMjeexdyj4PpZ1Rm6PtoIgD0CZoascYtZ8cSqg2ZNbU4/xm9x4o G/TQ== X-Gm-Message-State: AAQBX9fF9kptPoAw/bzvzDhz3QEuS8vFGLhq0b1YrnLFl3O+J+9kZZ2x himbO+oP+ytUpifOxCVJNSBUlJtfIrsqFJEtX+N9LKWP X-Google-Smtp-Source: AKy350YbGxm1Xtqm+nWjxTNytwltMjAGPeTLEn7CkKCv5Qac+goubJH/FK8hwJkx01HYn0+0NE8d4ZSkuMuICSq4gOM= X-Received: by 2002:adf:ce83:0:b0:2f9:fae3:2312 with SMTP id r3-20020adfce83000000b002f9fae32312mr651966wrn.13.1682051387447; Thu, 20 Apr 2023 21:29:47 -0700 (PDT) MIME-Version: 1.0 References: <20230421025046.4008499-1-tj@kernel.org> <20230421025046.4008499-10-tj@kernel.org> In-Reply-To: <20230421025046.4008499-10-tj@kernel.org> From: Dave Taht Date: Thu, 20 Apr 2023 23:29:35 -0500 Message-ID: To: Make-Wifi-fast Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: [Make-wifi-fast] Fwd: [PATCH 09/22] wifi: iwlwifi: Use alloc_ordered_workqueue() to create ordered workqueues X-BeenThere: make-wifi-fast@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Apr 2023 04:29:49 -0000 ---------- Forwarded message --------- From: Tejun Heo Date: Thu, Apr 20, 2023 at 10:35=E2=80=AFPM Subject: [PATCH 09/22] wifi: iwlwifi: Use alloc_ordered_workqueue() to create ordered workqueues To: Cc: , , Tejun Heo , Kalle Valo , David S. Miller , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Gregory Greenman , Johannes Berg , Avraham Stern , Kees Cook , Mordechay Goodstein , Haim, Dreyfuss , , BACKGROUND =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 queuein= g 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=3D=3D1. This originally was an implementation side-effect which= was broken by 4c16bd327c74 ("workqueue: restore WQ_UNBOUND/max_active=3D=3D1 to= be ordered"). Because there were users that depended on the ordered execution, 5c0338c68706 ("workqueue: restore WQ_UNBOUND/max_active=3D=3D1 to be ordere= d") made workqueue allocation path to implicitly promote UNBOUND workqueues w/ @max_active=3D=3D1 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, thi= s isn't a state we wanna be in forever. This patch series audits all callsites that create an UNBOUND workqueue w/ @max_active=3D=3D1 and converts them to alloc_ordered_workqueue() as necess= ary. WHAT TO LOOK FOR =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 Cc: Kalle Valo Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: Gregory Greenman Cc: Johannes Berg Cc: Avraham Stern Cc: Kees Cook Cc: Mordechay Goodstein Cc: "Haim, Dreyfuss" Cc: linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org --- drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c index 0a9af1ad1f20..cd17b601b172 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c @@ -3576,8 +3576,8 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, init_waitqueue_head(&trans_pcie->fw_reset_waitq); init_waitqueue_head(&trans_pcie->imr_waitq); - trans_pcie->rba.alloc_wq =3D alloc_workqueue("rb_allocator", - WQ_HIGHPRI | WQ_UNBOUND,= 1); + trans_pcie->rba.alloc_wq =3D alloc_ordered_workqueue("rb_allocator"= , + WQ_HIGHPRI); if (!trans_pcie->rba.alloc_wq) { ret =3D -ENOMEM; goto out_free_trans; -- 2.40.0 --=20 AMA March 31: https://www.broadband.io/c/broadband-grant-events/dave-taht Dave T=C3=A4ht CEO, TekLibre, LLC