Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4508937rwd; Tue, 30 May 2023 06:28:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6YqXh9PTjZViObfqA5lquTBky+5hjism19cq5Ltd5EiexOlOcgTiWkfm2wNNvztEhrCEE1 X-Received: by 2002:a05:6a21:2c98:b0:10f:c81d:f18a with SMTP id ua24-20020a056a212c9800b0010fc81df18amr1936743pzb.49.1685453294257; Tue, 30 May 2023 06:28:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685453294; cv=none; d=google.com; s=arc-20160816; b=SnngzbJSqhDq/fnxuebAUTtJbcEIVgD4cY9gr/d2kFO8zkFlTXf7GvJDbFhihhDpMO vWhQKKMKC2CyTqWVsoktMmxRsTeOSb3zGspzx6ncCzU5kGJcYgIOGFoiIcxkPMcV6q8S 6eS4yl9xkwJ6l3iqCbaDFtyw2GwZG+CEhjwsBjntziMGQQonu8lwoorXorPkxo06KGFv fwvHt+r0A/0rAYczOjY+I2GExuwN+spIHqdDWhP/Fuvo0eeITc/NcG97b+qP5KSpN+T2 W41NyOyWw1zz851OnFHufM+vOiEpp2yQEZQAGJVaeUYwcL9hQ88BXuDq62ltr38yn7Zx yL8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :authorized-sender; bh=Z2BKv1RIPPctdkS715rI2U6dpMM/3OoFpGVvbv0w1v4=; b=y/CLOn7GHaFImwha0wpLmnrXPFtX3czmeNve8PsQDg/siCsEPbjcie91Tf6YcSLbHR 7VYkBqlIVrv4HYV/c9t/YvPkMggOtop4QFaurCkq7Lm84OldIlxWL6rN/jQRDTiQaI9Z tgZnfbbw3sAHTQy7wMLlOmKpaUcCwX4Lfx7gxTgCw4KOeb8a+mvhPVsjA1FwUYXshEf4 bqal97TObOtiEiw27gxoLJBexd1A0+nC6+78HSeLZ2skeJOCxljE6wkqyzTEGgXzfmQC fku1drj4HryGf+7tSnQCKKHQfNbMkYd8f03UXc5n8DQ17A5Ht1IRY7ASNn8y500Rv0wo 2ILQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l2-20020a622502000000b0064d421691a6si1727920pfl.245.2023.05.30.06.28.02; Tue, 30 May 2023 06:28:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232556AbjE3NJh (ORCPT + 63 others); Tue, 30 May 2023 09:09:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232042AbjE3NJf (ORCPT ); Tue, 30 May 2023 09:09:35 -0400 Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55B89EA for ; Tue, 30 May 2023 06:09:21 -0700 (PDT) X-Halon-ID: 2ee03f63-feeb-11ed-b7d6-cf458ee68324 Authorized-sender: petter@technux.se Received: from localhost.localdomain (user33.85-195-12.netatonce.net [85.195.12.33]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPSA id 2ee03f63-feeb-11ed-b7d6-cf458ee68324; Tue, 30 May 2023 15:09:18 +0200 (CEST) From: petter@technux.se To: kvalo@kernel.org Cc: Larry.Finger@lwfinger.net, andreas@fatal.se, iam@valdikss.org.ru, kernel@pengutronix.de, linux-wireless@vger.kernel.org, linux@ulli-kroll.de, petter.mabacker@esab.se, petter@technux.se, pkshih@realtek.com, s.hauer@pengutronix.de Subject: Re: [PATCH] wifi: rtw88: usb: Make work queues high prio Date: Tue, 30 May 2023 15:09:17 +0200 Message-Id: <20230530130917.2716182-1-petter@technux.se> X-Mailer: git-send-email 2.39.2 In-Reply-To: <87zg5mjeu4.fsf@kernel.org> References: <87zg5mjeu4.fsf@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org petter@technux.se writes: >> From: Petter Mabacker >> >> The rtw8822cu driver have problem to handle high rx or tx rates compared >> with high load (such as high I/O) on slower systems, such as for example >> i.MX6 SoloX and similar platforms. >> >> The problems are more frequent when having the access point close to the >> device. On slower systems it's often enough to download a large file, >> combined with generating I/O load to trigger: >> >> [ 374.763424] rtw_8822cu 1-1.2:1.2: failed to get tx report from firmware >> [ 377.771790] rtw_8822cu 1-1.2:1.2: failed to send h2c command >> [ 407.813460] rtw_8822cu 1-1.2:1.2: firmware failed to report density after scan >> [ 414.965826] rtw_8822cu 1-1.2:1.2: failed to send h2c command >> [ 444.993462] rtw_8822cu 1-1.2:1.2: firmware failed to report density after scan >> [ 452.144551] rtw_8822cu 1-1.2:1.2: failed to send h2c command >> [ 482.183445] rtw_8822cu 1-1.2:1.2: firmware failed to report density after scan >> [ 489.426263] rtw_8822cu 1-1.2:1.2: failed to send h2c command >> >> Another way is to simply perform a wifi rescan. >> >> Benchmarking shows that setting a high prio workqueue for tx/rx will >> significally improve things. Also compared alloc_workqueue with >> alloc_ordered_workqueue, but even thou the later seems to slightly >> improve things it's still quite easy to reproduce the above issues. So >> that leads to the decision to go for alloc_workqueue. >> >> Thanks to Ping-Ke Shih that came up with the idea >> of exploring tweaking of the work queue's within a similar discussion. >> >> Fixes: a82dfd33d1237 ("wifi: rtw88: Add common USB chip support") >> Signed-off-by: Petter Mabacker >> --- >> drivers/net/wireless/realtek/rtw88/usb.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/net/wireless/realtek/rtw88/usb.c b/drivers/net/wireless/realtek/rtw88/usb.c >> index 44a5fafb9905..bfe0845528ec 100644 >> --- a/drivers/net/wireless/realtek/rtw88/usb.c >> +++ b/drivers/net/wireless/realtek/rtw88/usb.c >> @@ -716,7 +716,7 @@ static int rtw_usb_init_rx(struct rtw_dev *rtwdev) >> struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); >> int i; >> >> - rtwusb->rxwq = create_singlethread_workqueue("rtw88_usb: rx wq"); >> + rtwusb->rxwq = alloc_workqueue("rtw88_usb: rx wq", WQ_UNBOUND | WQ_HIGHPRI, 0); >> if (!rtwusb->rxwq) { >> rtw_err(rtwdev, "failed to create RX work queue\n"); >> return -ENOMEM; >> @@ -750,7 +750,7 @@ static int rtw_usb_init_tx(struct rtw_dev *rtwdev) >> struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); >> int i; >> >> - rtwusb->txwq = create_singlethread_workqueue("rtw88_usb: tx wq"); >> + rtwusb->txwq = alloc_workqueue("rtw88_usb: tx wq", WQ_UNBOUND | WQ_HIGHPRI, 0); >> if (!rtwusb->txwq) { >> rtw_err(rtwdev, "failed to create TX work queue\n"); >> return -ENOMEM; >Should this workqueue be ordered or not? Please check Tejun's patchset >about using ordered queues: >https://lore.kernel.org/lkml/20230421025046.4008499-1-tj@kernel.org/ Thanks for pointing out this interesting patchset. As described in the commit msg, I did play around with alloc_ordered_workqueue. But at least on the slower systems I tested it on (i.MX6 SoloX and BCM2835) it worked a bit better, but I was still able to reproduce the above mention issue. So I tried to instead use alloc_workqueue and set max_active=0 and that seems to be enough to make things a lot more stable. However after reading Tejun's patchet I'm very intersted of feedback if you or someone else have comments about using alloc_workqueue with max_active=0 , or if this can give some other issues? It seems to work fine for me when running it also on a i.MX8 multicore system. > >-- >https://patchwork.kernel.org/project/linux-wireless/list/ > >https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches