Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp7928029rwl; Thu, 23 Mar 2023 10:18:42 -0700 (PDT) X-Google-Smtp-Source: AKy350bC0tPjzQt6FVdAjU/Xqu9yid/cHQU1snf6B2tBN1mmqC6iSYBQL3CzXEy60743B77GLWp9 X-Received: by 2002:aa7:da56:0:b0:4fd:2363:16f2 with SMTP id w22-20020aa7da56000000b004fd236316f2mr101829eds.37.1679591922677; Thu, 23 Mar 2023 10:18:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679591922; cv=none; d=google.com; s=arc-20160816; b=s8DutHsDm7MgLoBr4LGmoBVDuP/C2yRN0prTAukRGq8Gz6FIgSQIuqakd8Jq2OQxXZ vOScO7KE3QPJAYxjhZXb98n0y3dDnqMaKWi/2uNueDAtFR8TcH6kF/In9O854PpAzXdv KhglG5gbeJMynN1XL5zE6OIG6JNKkR5RAwxg7hAhx+tgUqX9p/Pri2KfTMr/emk5KrlI IVG2E7rgfSguNGmQuLa2chDkNEhTD74CdeR6clyksSEf1fKAyFAVHmvw6Q2ZzlciAon2 QM0o0Yd5ukG6A0MFlSjGpLQJMYqcU7WwjbJ3lFLfPx5WZZNaY03rtYh6tI0jGr5TW1QA ab9A== 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 :message-id:date:subject:cc:to:dkim-signature:from; bh=gH4IzOeNIpGXsxmYN89MNoNaJOkyZtueH7Y2uSFQwrQ=; b=GETAkWzbJYRs0Xq6xLBmwaBOikEiVRlIFZBeVgElBqJsJ0q5TRn7uvZKA4QmJdXTG6 8AyxYDXqGTrHlPM03GewdnVUNagqrrfGzVqpnAjqfuTjoCaQyZGrbyQr4LRVHRGpY6y1 cbQAFa+CCg2QaX37dvcx98i0ZcEYScFV5XnQ4ddonQhQYv3yY10PaWuTUiOMpr+4zl0r RomGDd2cBpxppZ/IMdEXxSdsVlrpAkuwQxi5eYQenWl1FQuxIdcG+IQFNrOpXLs8v11o EHZjn/t8NOE9BdEkrG9lU50NJtV4X3ntq6K0x5Z4LCMT+cd2JY6AoRhmirYXb4GPWZYl KK6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wetzel-home.de header.s=wetzel-home header.b=FT7RrLIC; 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=wetzel-home.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y8-20020a056402134800b005002c6f2f0asi19247507edw.124.2023.03.23.10.18.24; Thu, 23 Mar 2023 10:18:42 -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; dkim=pass header.i=@wetzel-home.de header.s=wetzel-home header.b=FT7RrLIC; 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=wetzel-home.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232416AbjCWQ6D (ORCPT + 59 others); Thu, 23 Mar 2023 12:58:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232457AbjCWQ55 (ORCPT ); Thu, 23 Mar 2023 12:57:57 -0400 Received: from ns2.wdyn.eu (ns2.wdyn.eu [IPv6:2a03:4000:40:5b2::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 87BDF1EBFF; Thu, 23 Mar 2023 09:57:50 -0700 (PDT) From: Alexander Wetzel DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wetzel-home.de; s=wetzel-home; t=1679590667; bh=b65rg+Ns9zniat0wIt6g2YkntDD1KWVkHkHtk40xSCk=; h=From:To:Cc:Subject:Date; b=FT7RrLICxvsBUjsNmMBwIsnO/PJxVYmQ+LBDrZnNPm0cDwDl3r1tVJVs0A72twOmq lFE6ZkABxP0hzpDC/3H7CRQftfCSiqvY0ZCxtUyFsjpdvlG88k/bWQM3dWS1e4ik5M 3xpGqCmLVtCGGq3UK7tgOAAx4v9ZrXicTYtYC0pg= To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Alexander Wetzel , Felix Fietkau , stable@vger.kernel.org Subject: [PATCH] wifi: ath10k: Serialize wake_tx_queue ops Date: Thu, 23 Mar 2023 17:55:27 +0100 Message-Id: <20230323165527.156414-1-alexander@wetzel-home.de> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 Serialize the ath10k implementation of the wake_tx_queue ops. ath10k_mac_op_wake_tx_queue() must not run concurrent since it's using ieee80211_txq_schedule_start(). Fixes: bb2edb733586 ("ath10k: migrate to mac80211 txq scheduling") Reported-by: Felix Fietkau Link: https://lore.kernel.org/r/519b5bb9-8899-ae7c-4eff-f3116cdfdb56@nbd.name CC: Signed-off-by: Alexander Wetzel --- The intend of this patch is to sort out an issue discovered in the discussion referred to by the Link tag. I can't test it with real HW and thus just implemented the per-ac queue lock Felix suggested. One obvious alternative to the per-ac lock would be to bring back the txqs_lock commit bb2edb733586 ("ath10k: migrate to mac80211 txq scheduling") dropped. Alexander --- drivers/net/wireless/ath/ath10k/core.c | 3 +++ drivers/net/wireless/ath/ath10k/core.h | 3 +++ drivers/net/wireless/ath/ath10k/mac.c | 6 ++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 5eb131ab916f..533ed7169e11 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -3643,6 +3643,9 @@ struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev, mutex_init(&ar->dump_mutex); spin_lock_init(&ar->data_lock); + for (int ac = 0; ac < IEEE80211_NUM_ACS; ac++) + spin_lock_init(&ar->queue_lock[ac]); + INIT_LIST_HEAD(&ar->peers); init_waitqueue_head(&ar->peer_mapping_wq); init_waitqueue_head(&ar->htt.empty_tx_wq); diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index f5de8ce8fb45..4b5239de4018 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -1170,6 +1170,9 @@ struct ath10k { /* protects shared structure data */ spinlock_t data_lock; + /* serialize wake_tx_queue calls per ac */ + spinlock_t queue_lock[IEEE80211_NUM_ACS]; + struct list_head arvifs; struct list_head peers; struct ath10k_peer *peer_map[ATH10K_MAX_NUM_PEER_IDS]; diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 7675858f069b..9c4bf2fdbc0f 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -4732,13 +4732,14 @@ static void ath10k_mac_op_wake_tx_queue(struct ieee80211_hw *hw, { struct ath10k *ar = hw->priv; int ret; - u8 ac; + u8 ac = txq->ac; ath10k_htt_tx_txq_update(hw, txq); if (ar->htt.tx_q_state.mode != HTT_TX_MODE_SWITCH_PUSH) return; - ac = txq->ac; + spin_lock_bh(&ar->queue_lock[ac]); + ieee80211_txq_schedule_start(hw, ac); txq = ieee80211_next_txq(hw, ac); if (!txq) @@ -4753,6 +4754,7 @@ static void ath10k_mac_op_wake_tx_queue(struct ieee80211_hw *hw, ath10k_htt_tx_txq_update(hw, txq); out: ieee80211_txq_schedule_end(hw, ac); + spin_unlock_bh(&ar->queue_lock[ac]); } /* Must not be called with conf_mutex held as workers can use that also. */ -- 2.40.0