From nobody Fri Jun 6 16:29:37 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bDRc13y6zz5xckb; Fri, 06 Jun 2025 16:29:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bDRc11jDpz3NH3; Fri, 06 Jun 2025 16:29:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1749227377; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TUuFsL731WZxN6B8NvAkpquJ6XqTLB1q6r6fE2sU290=; b=a4NHwMd3B1vmHbkEUMecK8PeG8u3Zv5yffGi40J2jCgtzzKuRs4ZxUjgAcNc/7nigHtbFO iu5B0PW9EAkM4Tod9k0jO9ZiVLELAaST2jLWPAvRYR1qtxvBzTQ+NCHDniggMy0w1C/uy8 xMA5IgJJ4jlpk6c64K0LVnUSGWT/pVTyoBR3KV010rFRThy6hDzCIN2S7tRhFiIHXUDPCZ OUhNMsSqBLhw3kVHoVcDpQN3PhLZrV54H+aAsY6Sp7+N02Zzk5PHae13qJTdeemHzZBIga E98Tgn6JtWTS/4qbeHla4KLd/wfUwU8CybGMdZSD27xiKoNJF/zSjXaqJ7SeJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1749227377; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TUuFsL731WZxN6B8NvAkpquJ6XqTLB1q6r6fE2sU290=; b=sp4oLU7wxxgtAZk3iJnu1W5cHhOzweu5YYoJ2q7J/LPPnII7YTRPAEJkYm/6IAl8tLp3sC ppc9RKdXdQ17GvFqLKcyNUWsOY0sz1n+2EJfARoSdh3CcHT2pRxw0XqUpz4h/YQi31rsoY G84I0HjN0zwCJle/GLGaN/nyP8ar+ZNgEtFj7b26eFWPaNjC+Rln0IuWYFdikv5ReRxd46 I4/6SN1IXoUh3MwUaxJzqodTmN5Xxqotixq+p/40TUw81RHuExkxjg959lCQSHZqWLHaqw MK4iC9Ast5BthqiXJVH/3m3icRh2i3Z7JWg0LYFZPZHeg48e2nkn0lk1GiZmGA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1749227377; a=rsa-sha256; cv=none; b=CyuX+GFAtRlnF0UpUPlRnMp97XBR2dAiRo+3EhOwZcN27He8afaVmQDnTJU/7MlMa1hdzt Es/91dYRArilkFZ1nMfKb7i5oWhI4ym4CErBkIM2sIlswzIz6YdNE3VEubTrwNysac8QH0 PjwzAG/fZg74knGR5RNuYH80WjQXyZWTP0bJxoKzfFtPc5qASkxzcKbfmMUjKc4sBw5P0M EYL3gA88cOeWPuwJTAyUdQRhO6c7WD7jZPMwAVCNmTLiE8ptefAe85C/CXr/UE0UxVr21n /K0MuGCGD6H4XjGC9H27cd4DIfvfWn/i3UafwwtsOKtXlROnQ1iTdzY50wQ8/w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bDRc11GStz12Xv; Fri, 06 Jun 2025 16:29:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 556GTbcj067513; Fri, 6 Jun 2025 16:29:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 556GTbjT067510; Fri, 6 Jun 2025 16:29:37 GMT (envelope-from git) Date: Fri, 6 Jun 2025 16:29:37 GMT Message-Id: <202506061629.556GTbjT067510@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: bc24342d96aa - main - LinuxKPI: 802.11: improve queue locking List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bc24342d96aa816b448bec4d32b1f5e4a5793886 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=bc24342d96aa816b448bec4d32b1f5e4a5793886 commit bc24342d96aa816b448bec4d32b1f5e4a5793886 Author: Bjoern A. Zeeb AuthorDate: 2025-06-05 22:02:01 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-06-06 16:27:59 +0000 LinuxKPI: 802.11: improve queue locking Introduce an internal lkpi_ieee80211_wake_queues_locked() function that can be used from context holding the wiphy lock. Make linuxkpi_ieee80211_wake_queues() a wrapper with locking around this. Equally apply the wiphy lock to linuxkpi_ieee80211_wake_queue(). In lkpi_ieee80211_wake_queues() only wakeup the driver if the queue is not empty; otherwise weird sideeffects can happen with some drivers. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/src/linux_80211.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index e81c77d67001..ef53c91a201e 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -7395,6 +7395,7 @@ linuxkpi_ieee80211_tx_dequeue(struct ieee80211_hw *hw, struct lkpi_vif *lvif; struct sk_buff *skb; + IMPROVE("wiphy_lock? or assert?"); skb = NULL; ltxq = TXQ_TO_LTXQ(txq); ltxq->seen_dequeue = true; @@ -7898,8 +7899,8 @@ lkpi_ieee80211_wake_queues(struct ieee80211_hw *hw, int hwq) ltxq->stopped = false; - /* XXX-BZ see when this explodes with all the locking. taskq? */ - lkpi_80211_mo_wake_tx_queue(hw, sta->txq[tid]); + if (!skb_queue_empty(<xq->skbq)) + lkpi_80211_mo_wake_tx_queue(hw, sta->txq[tid]); } } rcu_read_unlock(); @@ -7909,8 +7910,8 @@ lkpi_ieee80211_wake_queues(struct ieee80211_hw *hw, int hwq) LKPI_80211_LHW_LVIF_UNLOCK(lhw); } -void -linuxkpi_ieee80211_wake_queues(struct ieee80211_hw *hw) +static void +lkpi_ieee80211_wake_queues_locked(struct ieee80211_hw *hw) { int i; @@ -7919,6 +7920,14 @@ linuxkpi_ieee80211_wake_queues(struct ieee80211_hw *hw) lkpi_ieee80211_wake_queues(hw, i); } +void +linuxkpi_ieee80211_wake_queues(struct ieee80211_hw *hw) +{ + wiphy_lock(hw->wiphy); + lkpi_ieee80211_wake_queues_locked(hw); + wiphy_unlock(hw->wiphy); +} + void linuxkpi_ieee80211_wake_queue(struct ieee80211_hw *hw, int qnum) { @@ -7926,7 +7935,9 @@ linuxkpi_ieee80211_wake_queue(struct ieee80211_hw *hw, int qnum) KASSERT(qnum < hw->queues, ("%s: qnum %d >= hw->queues %d, hw %p\n", __func__, qnum, hw->queues, hw)); + wiphy_lock(hw->wiphy); lkpi_ieee80211_wake_queues(hw, qnum); + wiphy_unlock(hw->wiphy); } /* This is just hardware queues. */