Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5729917rwl; Thu, 29 Dec 2022 01:51:54 -0800 (PST) X-Google-Smtp-Source: AMrXdXsGVSe+ezYgVp0bSiTaW1v6qPaOwltfgLoDOXnNK7bn58hnLBrparwBnk43pKLRUi6Gij+G X-Received: by 2002:a17:906:144a:b0:78d:f455:b4d5 with SMTP id q10-20020a170906144a00b0078df455b4d5mr24291750ejc.60.1672307514291; Thu, 29 Dec 2022 01:51:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672307514; cv=none; d=google.com; s=arc-20160816; b=uuw/PkeUGS2C9S4LUlTPbnH+HiZhqSLgrjMpE05M00n7qSPp5Rd8q955DhwAgr2ho1 I+uhZdGB5FC2btKa3hZItDDs3uSDENYcSlncYuTzvdppvjCtLEUd/R7QItgzKOPpGH2C DAb/aC7Bu7L0HjBZdxQsnx1F+MLOGhE7P7VH190WwDNbZ1Y2QPair/xlfrNeW/u7QULM YInSm13uj/Z4DWPvPqkfYfuuKCw55gmdMlrYw4VpDyxA9DM9zN54WO/N6hr149LiqqSn DkyORC3fAjoMaeTDhCTkyFEchWawqlfW8nZvQZlHgoKF+DgXd8nFHHCfv1Kqgox1kTd6 cLxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:authenticated-by; bh=vwhonD86CaViNfX0fcetPIM9ylKejXRv705YVYu+mFg=; b=VtL/jydVMqkI90w9FfEdGQxGl513y5dpPllFY5YZ9yvwX9h3ZY9wi6fUjcY9bsQP/L CLJeq17KPWL+IG7WHUqPARG81WlzBbfsC4OC+y3hTy2oezITWnbozAMBeEckL7LBXg2e EO6UVhzFtEr7/THDaanKnJcxjUg28qLvD9er5yAzFH8/LZJMOgPSpgbFD4Kj/JQJ7w9Q Aqs1jDI5yJ/wRQifnjvdwGXqBvCu54pgqg1GNYkbXZIVYy/sXTHjDprlwkYDCrNxRuGn 6KDrU8dkIR8PGRdEjKSSgzm8rmDmaMpT1EGPFOpVrNAESn8lHzt4svZq9L6hJF3eiKhQ nTEg== 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 go31-20020a1709070d9f00b00783b75ec298si16313424ejc.395.2022.12.29.01.51.38; Thu, 29 Dec 2022 01:51:54 -0800 (PST) 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 S233228AbiL2Jmq convert rfc822-to-8bit (ORCPT + 67 others); Thu, 29 Dec 2022 04:42:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233238AbiL2Jkm (ORCPT ); Thu, 29 Dec 2022 04:40:42 -0500 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1069B13E87; Thu, 29 Dec 2022 01:39:30 -0800 (PST) Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 2BT9cJvcD025967, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36506.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/2.81/5.90) with ESMTPS id 2BT9cJvcD025967 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=FAIL); Thu, 29 Dec 2022 17:38:19 +0800 Received: from RTEXMBS06.realtek.com.tw (172.21.6.99) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.9; Thu, 29 Dec 2022 17:39:13 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXMBS06.realtek.com.tw (172.21.6.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 29 Dec 2022 17:39:13 +0800 Received: from RTEXMBS04.realtek.com.tw ([fe80::15b5:fc4b:72f3:424b]) by RTEXMBS04.realtek.com.tw ([fe80::15b5:fc4b:72f3:424b%5]) with mapi id 15.01.2375.007; Thu, 29 Dec 2022 17:39:12 +0800 From: Ping-Ke Shih To: Martin Blumenstingl , "linux-wireless@vger.kernel.org" CC: "tony0620emma@gmail.com" , "kvalo@kernel.org" , "tehuang@realtek.com" , "s.hauer@pengutronix.de" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH 3/4] rtw88: Use rtw_iterate_vifs() for rtw_vif_watch_dog_iter() Thread-Topic: [PATCH 3/4] rtw88: Use rtw_iterate_vifs() for rtw_vif_watch_dog_iter() Thread-Index: AQHZGsFuW51/TQC8pEWo3pJmY9ZMxK6EnUMA Date: Thu, 29 Dec 2022 09:39:12 +0000 Message-ID: References: <20221228133547.633797-1-martin.blumenstingl@googlemail.com> <20221228133547.633797-4-martin.blumenstingl@googlemail.com> In-Reply-To: <20221228133547.633797-4-martin.blumenstingl@googlemail.com> Accept-Language: en-US, zh-TW Content-Language: zh-TW X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.21.69.188] x-kse-serverinfo: RTEXMBS06.realtek.com.tw, 9 x-kse-attachmentfiltering-interceptor-info: no applicable attachment filtering rules found x-kse-antivirus-interceptor-info: scan successful x-kse-antivirus-info: =?us-ascii?Q?Clean,_bases:_2022/12/29_=3F=3F_07:25:00?= x-kse-bulkmessagesfiltering-scan-result: protection disabled Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS 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 > -----Original Message----- > From: Martin Blumenstingl > Sent: Wednesday, December 28, 2022 9:36 PM > To: linux-wireless@vger.kernel.org > Cc: tony0620emma@gmail.com; kvalo@kernel.org; Ping-Ke Shih ; tehuang@realtek.com; > s.hauer@pengutronix.de; netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Martin Blumenstingl > > Subject: [PATCH 3/4] rtw88: Use rtw_iterate_vifs() for rtw_vif_watch_dog_iter() > > USB and (upcoming) SDIO support may sleep in the read/write handlers. > Make rtw_watch_dog_work() use rtw_iterate_vifs() to prevent "scheduling > while atomic" or "Voluntary context switch within RCU read-side > critical section!" warnings when accessing the registers using an SDIO > card (which is where this issue has been spotted in the real world but > it also affects USB cards). > > Fixes: 78d5bf925f30 ("wifi: rtw88: iterate over vif/sta list non-atomically") > Suggested-by: Ping-Ke Shih > Signed-off-by: Martin Blumenstingl Reviewed-by: Ping-Ke Shih > --- > drivers/net/wireless/realtek/rtw88/main.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c > index 888427cf3bdf..b2e78737bd5d 100644 > --- a/drivers/net/wireless/realtek/rtw88/main.c > +++ b/drivers/net/wireless/realtek/rtw88/main.c > @@ -241,8 +241,10 @@ static void rtw_watch_dog_work(struct work_struct *work) > rtw_phy_dynamic_mechanism(rtwdev); > > data.rtwdev = rtwdev; > - /* use atomic version to avoid taking local->iflist_mtx mutex */ > - rtw_iterate_vifs_atomic(rtwdev, rtw_vif_watch_dog_iter, &data); > + /* rtw_iterate_vifs internally uses an atomic iterator which is needed > + * to avoid taking local->iflist_mtx mutex > + */ > + rtw_iterate_vifs(rtwdev, rtw_vif_watch_dog_iter, &data); > > /* fw supports only one station associated to enter lps, if there are > * more than two stations associated to the AP, then we can not enter > -- > 2.39.0