Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5341287rwl; Sun, 8 Jan 2023 13:15:25 -0800 (PST) X-Google-Smtp-Source: AMrXdXuBDnQLJCFP3WBkPF7bbFljHgZNHsoyKpRm/Y9aUzYmlrprhQLuqTgKt4/MVGfI8+3cZMxZ X-Received: by 2002:a17:906:158c:b0:7c4:f752:e959 with SMTP id k12-20020a170906158c00b007c4f752e959mr50616068ejd.33.1673212525176; Sun, 08 Jan 2023 13:15:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673212525; cv=none; d=google.com; s=arc-20160816; b=GsYoeZg8X2Yy9Pe14NKebg26NSk+KAeQmzRrtNzN6syFT9WspUfgv//51SKfd3TTqj Fjng7lIRZf/8PZh0vsLqq6J3fZLx8HzENCMjIIBQmF+iaSOVEGQ1XirBRecealy4BVSz yfrYvHT9HRxNYlmu0gNKaaipjK07EJ7QwpRFDqB6tWXSz/RYo5DkwEIT/vE0lfDb9Rtm slsIHnqwrnYKFwwop3AiAC21Ae/o6jV804Im77ofV92lryx/uxDagQrBy42JOWKrpOQT VxsuPorCvu3EN86KYZGi4rPOMpA4dUczLhX1KI3PgF4j1PdL6x1GKRRBDqW7I85CZOIY +84A== 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=g+ySspNK+qn7cGndVAzvLNa0iYoPa0lwfvSj5/ykqfE=; b=D5v/UU93dJUHAPDchvrUHyNfK8TGly7x1ODOqCgVGimEnXJP2hDcpL4lC8Nnq17hrd plJkoMaLgtN19Et0dA1u8/ctIqOgH9WgDoXG7mgE4KiVGjSclS7HP18uwkvMD4kE5494 P+J0L2IxB/HJqlo1w4LlYiXyx4ldzsMchQGu6YEkyLcCs/Og4W/KN5Oawz5/T9JJvl3e FGE8+TYzmW/3YfzaS9g9bac1d4kgwAM0b78Smtqq+LnzlNUKtbCUEwUHpYgQ/BNzVfqW GFgbvDleYl7D4zMYvT5vlv8fgHGCfFgPDvBbdbRg5t23p2O5PCRZPWHuoysobTFevGtp 6Btg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20210112 header.b=aL57deV6; 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 xc11-20020a170907074b00b007c4fcbfe7eesi7543315ejb.549.2023.01.08.13.15.09; Sun, 08 Jan 2023 13:15:25 -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=aL57deV6; 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 S234178AbjAHVOE (ORCPT + 65 others); Sun, 8 Jan 2023 16:14:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236297AbjAHVNh (ORCPT ); Sun, 8 Jan 2023 16:13:37 -0500 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36F4C6561; Sun, 8 Jan 2023 13:13:36 -0800 (PST) Received: by mail-ej1-x634.google.com with SMTP id fy8so15549775ejc.13; Sun, 08 Jan 2023 13:13:36 -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=g+ySspNK+qn7cGndVAzvLNa0iYoPa0lwfvSj5/ykqfE=; b=aL57deV61/F3g3uWw0izEm1oYWQVgQWiv/vyY4wQMGCcRmid3omVIVbY59xnzsVoDH oNI04p4s9XzIeCTcl6HEArKH6IduQvJITp0QsRm02joAOSEP8vZeV6uhUHrjWc4tUv/O FMtTU2DUgOTYK+hIc7uRnoWQ7N4K4F2uZqBaOQvSM6EyZu9NLqCx2Ivv+Lj874arFBTe n4Au4U0xtXpLabNKDdrq6q95fNHDYJfGSSaU1JZ7mEy1sZfRR1ZYfcvtNMZxYgbSU6L2 Ghl7kWbSBExC3x2UpKRp8d5SknFp3L3YtMcbBUj4Sc1Edz+pDA5m/kedvSjn6o0Kvxzk VDew== 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=g+ySspNK+qn7cGndVAzvLNa0iYoPa0lwfvSj5/ykqfE=; b=wECyGPrhfQhxANR//DK4C97UUQMVIn6gkUG62ytQZU6Ycnz2fJD+qv5hEBBFvUGXxu GvB92lTrbtoW0HazMwlikk5k1wJBurT9UICEeNPGzssF66MmhayD4O+BE2TT7uLZeoTO YZ2EzZqgcOJgMed6SRlRi9eK6F6a8IkqdNQRzvmUuWyMz4Gnab7nzUa6Ldu5YmLVd5dM 0/oPGNEiXY7aKElkQ5KiPvKKnJpcgode0TzGokZ//2zX8ZUL+/P8qdeFqZjcM6JD4UG/ avD9tCWe9+pHfFNju5IM8rbWDmJ3XhBWKnpknoOdKlwSTI8ffB/GU/3I6LkaF5fzPxmQ Lu7w== X-Gm-Message-State: AFqh2koiejhBO0pWQnbghf3L/m9HrebytizSyBSlBeElRN5cRlmaOB89 iJUXxlTT65cnKW4zd/9E5vxkYIAWzn0= X-Received: by 2002:a17:907:8b90:b0:84d:207d:c00c with SMTP id tb16-20020a1709078b9000b0084d207dc00cmr8882916ejc.25.1673212414365; Sun, 08 Jan 2023 13:13:34 -0800 (PST) Received: from localhost.localdomain (dynamic-2a01-0c23-c485-2500-0000-0000-0000-0e63.c23.pool.telefonica.de. [2a01:c23:c485:2500::e63]) by smtp.googlemail.com with ESMTPSA id x25-20020a170906b09900b0080345493023sm2847997ejy.167.2023.01.08.13.13.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 13:13:33 -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 v3 2/3] wifi: rtw88: Use rtw_iterate_vifs() for rtw_vif_watch_dog_iter() Date: Sun, 8 Jan 2023 22:13:23 +0100 Message-Id: <20230108211324.442823-3-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230108211324.442823-1-martin.blumenstingl@googlemail.com> References: <20230108211324.442823-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 Tested-by: Sascha Hauer Signed-off-by: Martin Blumenstingl --- v1 -> v2: - no change v2 -> v3: - Added Ping-Ke's Reviewed-by (thank you!) - Added Sascha's Tested-by (thank you!) - added "wifi" prefix to the subject and reworded the title accordingly 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