Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5900430rwl; Thu, 29 Dec 2022 04:51:22 -0800 (PST) X-Google-Smtp-Source: AMrXdXsg0FIwkADvH5NYyZ4JJZrusiKXrOKza+NMNKW3jkWGnfHiLmAKW8Nh4+thZVGtCn/zQx4W X-Received: by 2002:a05:6a20:6d81:b0:9d:efbf:6623 with SMTP id gl1-20020a056a206d8100b0009defbf6623mr32171233pzb.49.1672318281939; Thu, 29 Dec 2022 04:51:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672318281; cv=none; d=google.com; s=arc-20160816; b=PfHv4t9gMaf4UZW2JJpR+/4b5dA/8fqP6vXOC1guDVLc2BNvyLN1IjrcGJfmf7VjrI DU5bKxXLoSobn8tYt9thorE89Ke4GMZvtPzuVmeYQPgdlC7MqsC6f/4fyVPxNwe0wnOn 9HYmgIbwt/0/3aLzwKQm+tR1L4ix8GmDMcBzT7wJhIzaLx8BcKAdPd42v2eB4tCnIPD9 WPeJsMwF+fee21TovN05YeHmwg3fC0YdXmba9WMzAdxQGV/3hs83wYpE6PjB+8leuMM2 lzLaCAkF1lCtSYMHxd5eQziGC0dYIDmReL8cMcQKOyv++h6PWSCTEBWLOHtnKRjQkXI4 4SQg== 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=FdmvaeMNmNESXg2Bm+GivnT9MUmG0nTE7m4Nif5YY+w=; b=JIp6jTuazQUBv/fFAwd6jQte6UVc+jZz+8MTq8YZHXtVrV0kw+lBkc8N+OAnBiwyli s8MlO7q2D/jnGF0JjR3YbTQ/nAXHG0g2FBy8KGhbiZuodtuzFAetOqk4JqTtJpDYSC68 bsm/ZVPfTDlRC3yCqDstaPtS5hAdI+sq4Cu6pEGeZhe5tQ6XZffYV/k1lgXwPASYeYW3 VCbKp73MWJt68CuNewQq15rk4Wc0/X+KK7mj0w4MH5XHPkFbcTKDp6KMHlBOAQFBocYe jk+u1ACelGEqVNgf6sMTtAB1+qSTpaKJdRIlxjoa6lzP8NxtssotVS+45Co5FQv7i4v4 TfgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20210112 header.b=XyKTz13T; 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 u17-20020a63df11000000b0049b926fa4basi6489134pgg.345.2022.12.29.04.51.12; Thu, 29 Dec 2022 04:51:21 -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=XyKTz13T; 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 S233412AbiL2Muw (ORCPT + 67 others); Thu, 29 Dec 2022 07:50:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233184AbiL2MtS (ORCPT ); Thu, 29 Dec 2022 07:49:18 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F06691057B; Thu, 29 Dec 2022 04:49:16 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id c17so26517719edj.13; 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=FdmvaeMNmNESXg2Bm+GivnT9MUmG0nTE7m4Nif5YY+w=; b=XyKTz13T3nT39wJI2E8a+WhRDTPnxNtpjRpmPXYcFPRxb4Y1UemPmrXlUMMoegYBu1 PKMgpVzl+JvZ+pU3Ig5WSPs2QGh+GblNk9uYtdnnpPjIUMpSO+etz6bRV9yPMVOjJ2ip aICV9p53iaE1JBPF/3JBxlhk9grBpDEu2Mj6vxNkNWngL11EOLYDWjqN1YGefHCXBd3T TowLRu4ByOzsYDhfm2LBUnJXlRt+XQSszHIFT5qn4NWcA7zKAHTcjVTDhxkNnFvokdr5 xV2vtwBUt1IwwC6Q+TSDGyvkdg/fDqxi8FWzTfGwuccGrch4R5gF/u9D9dTK+4Kzof/B bO+A== 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=FdmvaeMNmNESXg2Bm+GivnT9MUmG0nTE7m4Nif5YY+w=; b=Qm6QSxCEr4mOsyns9TLeEnMqlgkKuA7ia3KYiNh/UUql1lLfI/3ENfpjmMsQi7G8vg ikFg/JwhhLHH4Eglgd5Hnm90abkXE4OlIagwbGvsoKrcczGwpBTaMV+RFR14bveVVRCc 93wbtdkEwrzoWIJPtuz0cviiv+qMyUaVjLh5KbEJk1r258fRdqNRdmgIkHBpWg2a4zHe viUPNJEQs9QiYBuRJt8zYbt++5MJfIY2c9TEmEEbBl47hWKu40rLBMb4Mn1/nWxZNUsN yEUO4DZyQcCB1vHpLPv31HovclAjZpH/5osU1GpDu5NgBWbjPPHL29CyMfZQSFwkcwsv pwgg== X-Gm-Message-State: AFqh2kq0hkOaLHqpukvVSxWsDEcTRelgibUgUK4rZRBPW2+eFXN+aS0t AuKFHjffxOT9RjhgjbeTXm7D2YbD+Ss= X-Received: by 2002:a05:6402:1609:b0:46a:f004:5e38 with SMTP id f9-20020a056402160900b0046af0045e38mr23718823edv.37.1672318155241; Thu, 29 Dec 2022 04:49:15 -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.14 (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 4/4] rtw88: Use non-atomic rtw_iterate_stas() in rtw_ra_mask_info_update() Date: Thu, 29 Dec 2022 13:48:45 +0100 Message-Id: <20221229124845.1155429-5-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. Use non-atomic rtw_iterate_stas() in rtw_ra_mask_info_update() because the iterator function rtw_ra_mask_info_update_iter() needs to read and write registers from within rtw_update_sta_info(). Using the non-atomic iterator ensures that we can sleep during USB and SDIO register reads and writes. This fixes "scheduling while atomic" or "Voluntary context switch within RCU read-side critical section!" warnings as seen by SDIO card users (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/mac80211.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtw88/mac80211.c b/drivers/net/wireless/realtek/rtw88/mac80211.c index 776a9a9884b5..3b92ac611d3f 100644 --- a/drivers/net/wireless/realtek/rtw88/mac80211.c +++ b/drivers/net/wireless/realtek/rtw88/mac80211.c @@ -737,7 +737,7 @@ static void rtw_ra_mask_info_update(struct rtw_dev *rtwdev, br_data.rtwdev = rtwdev; br_data.vif = vif; br_data.mask = mask; - rtw_iterate_stas_atomic(rtwdev, rtw_ra_mask_info_update_iter, &br_data); + rtw_iterate_stas(rtwdev, rtw_ra_mask_info_update_iter, &br_data); } static int rtw_ops_set_bitrate_mask(struct ieee80211_hw *hw, @@ -746,7 +746,9 @@ static int rtw_ops_set_bitrate_mask(struct ieee80211_hw *hw, { struct rtw_dev *rtwdev = hw->priv; + mutex_lock(&rtwdev->mutex); rtw_ra_mask_info_update(rtwdev, vif, mask); + mutex_unlock(&rtwdev->mutex); return 0; } -- 2.39.0