Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5900092rwl; Thu, 29 Dec 2022 04:51:01 -0800 (PST) X-Google-Smtp-Source: AMrXdXsoqlJ3pKX81T+YoP14Oe1UphKHIcgtXoCqXqJ76jQkRtxG5Bckv6BAWeZnRaFLIyS/kqzJ X-Received: by 2002:a05:6a20:1a84:b0:a7:89fd:884c with SMTP id ci4-20020a056a201a8400b000a789fd884cmr32370598pzb.11.1672318261736; Thu, 29 Dec 2022 04:51:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672318261; cv=none; d=google.com; s=arc-20160816; b=BGenBCdzSt31j+qwOB+w+n2yRZXbPb0jhPT6vdMXNJELAu+aLE2lBB7YHaIdCqxmzk FKdg/ZPtjCUHzGCLASUv1KdbmGNWlAlEdNlrrWfyIRZxM2sZQHOTabikrklZiyniA//9 8lKha6CJDTr3WnX/tVrAUknYAyfN5wxnzTnu42jpr3h8D6JWpUpFQ9pvmXuIMVRx1eRf blc7G3xGqX4VQsii8a3YQTTrRhSeugV5BkxHSXO6gHzqLT0heyPjITXAhHXyI0YVGCpD JatNMFgseZSFYvBItWZLTFE6KXpdTnphlq8R3y6mkklGMwf0P0GJ0YTDyXa2LPGds1am VeBw== 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 :dkim-signature; bh=fg+vEqAErRjfJQS0/hInbwE16nRV7CNR4R99NQ21R+I=; b=JJrUW0Um+BR/kQJSdstVZu8b+jW6sNmrPPvxp82PnqZMveBS9rMSdtJAQdjn5TfCe+ pbeuCKTvGAIaw54swExlgTGG0CsVoGYPqTfiqOgBDQqeNwpchYe8ezk3cV4jA+WJzJyp UNKDESrnKcW7kMuAtCtiWS9lhR9/9t8hlXlhvoFAf4KFWbTkuF/Qad0qSU6BkQYYUquG /Bk9MHOgGycD9cow7o0xamHgmORyAGeubzCfWuXTh4heDfKmJK4LVUKq9oiRvv+EUo+p GdrfiGknZlWRuphDY4hNcLB6H2MmJF3u+x47HxBUoK4iettFIxTur/ghEO3I/WKcYnTj LrIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20210112 header.b=LBTmQnMT; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b6-20020a656686000000b0046fabcb7bacsi19627649pgw.823.2022.12.29.04.50.53; Thu, 29 Dec 2022 04:51:01 -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; dkim=pass header.i=@googlemail.com header.s=20210112 header.b=LBTmQnMT; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233404AbiL2Muv (ORCPT + 67 others); Thu, 29 Dec 2022 07:50:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233090AbiL2MtR (ORCPT ); Thu, 29 Dec 2022 07:49:17 -0500 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18AF81277B; Thu, 29 Dec 2022 04:49:16 -0800 (PST) Received: by mail-ed1-x532.google.com with SMTP id i15so26623811edf.2; Thu, 29 Dec 2022 04:49:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fg+vEqAErRjfJQS0/hInbwE16nRV7CNR4R99NQ21R+I=; b=LBTmQnMTbFUzmaX6mkw/x7IQVw3oGfTZGmV0KiQBv+9K0pNEwGXourydtFnItjyO9j o2USVnnOnMCN9JoM2ToKWa3BJrgDEbK/UzbBpsTWiYOK3efI05X5hAWOjgaijd4qEK0T M8Jsp1+6G3FwqXKFBSjJnN5M3KGT8MLq40/UKWTT2qoTKqXhfJBwxfgftZLfs8jv0orT Gec1nnqXfDKCF+RropCNwT7tTuzGkiEURVlbG1xdqRKw4+kbc0EBufjQ9YHWK3Svzv+A Mw0sHLmX/41ubzwZB17jrtlSX8dZ155SS/0TGdixS+6p8yN2TTx13m2Wb5CZCCzx+B6d TxSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fg+vEqAErRjfJQS0/hInbwE16nRV7CNR4R99NQ21R+I=; b=vIMfFYYI1kndJ1qQaEKBysNyNSl5DJ0foQkv4mD9rGjeS9q6IulcKO0LaTKzIoqWLt 3AUT4pKr1WaTDLvdM9y6LLwqCR5tX4gKL44aiq9T48Na5YXI8JZIgVqAy0F+bWCkm01n Rno3YcV40YIb4TJd6FWxm1oAjpVYdjl4yOOLu9qP1/7ISZR0pr5nVl9TEHtjuOCzEk9g bEOklNK4fapGSrYe7lFSIUIUt5ajoKQVM8mdUWgPS/6G5eDQuSouSDnfB2j6/nSAjBtB /PTPid1I5jXwwybxnoyw1urD5MCi7bSpNWzrp2HILXhEyh8CR3TV1hVNd+J+nCt2DWOa tnwQ== X-Gm-Message-State: AFqh2koM7ij6gyExYkb9r8NsKK+C2SSRWqkV2RTbYUFI9muMJr0LNd0r OCMRGZefFiSlnNnjcTtbDvPGTpo/qPU= X-Received: by 2002:a05:6402:3807:b0:47e:eb84:c598 with SMTP id es7-20020a056402380700b0047eeb84c598mr22161141edb.30.1672318154404; Thu, 29 Dec 2022 04:49:14 -0800 (PST) Received: from localhost.localdomain (dynamic-2a01-0c22-7789-6e00-0000-0000-0000-0e63.c22.pool.telefonica.de. [2a01:c22:7789:6e00::e63]) by smtp.googlemail.com with ESMTPSA id b12-20020aa7dc0c000000b0046892e493dcsm8166299edu.26.2022.12.29.04.49.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 04:49:14 -0800 (PST) From: Martin Blumenstingl To: linux-wireless@vger.kernel.org Cc: tony0620emma@gmail.com, kvalo@kernel.org, pkshih@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() Date: Thu, 29 Dec 2022 13:48:44 +0100 Message-Id: <20221229124845.1155429-4-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221229124845.1155429-1-martin.blumenstingl@googlemail.com> References: <20221229124845.1155429-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 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 Reviewed-by: Ping-Ke Shih Signed-off-by: Martin Blumenstingl --- 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