From nobody Wed Jun 11 09:14:25 2025 X-Original-To: dev-commits-src-branches@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 4bHKjY56mJz60014; Wed, 11 Jun 2025 09:14:25 +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 4bHKjY2lWxz3lhL; Wed, 11 Jun 2025 09:14:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1749633265; 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=eAv7Es9zL/XJjlbetJIB6tZ370y4TBIpuVM4gwqJeP0=; b=Qf0v9Qcm8oIFDB35idPFnWXy/e1V4ZM2pdtppYbHZx0MB2bwdqmPREZqOIweTzaaSzAsGT jPiZGhvdkks59mFBq8KfnFvIAZ7OmmQLiGJlbrp0RBplKSYJizO0H27HNaD0WChT3OUXOU zCRzl/vRLB7rWHcxvxkLtUEywafC8C+wUf+D2r1ZowZW8N0w2SEXpxZCeeQT+ak5+M+Qbo cNGSnV6gktaOf4fyqlDoS3ZcJJ2tGnFGCPtYRcEk5LWsuBConTXc9CpyqeKKDYou/azEEd 8RmKCq65hC89VoqB5A5tm0XExCnW05CVgh9O7fqRl1DUBFhnU3Gk+RsdjlnxuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1749633265; 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=eAv7Es9zL/XJjlbetJIB6tZ370y4TBIpuVM4gwqJeP0=; b=F0f4aXSm38eeCL+O6jd8mp2DnWz0scko7+ZZJJ0JEjv25lzkos8xnLPUudFjIg+wcbV4L3 VS1WYnILDu1z7h+/4DEZjpS0rAhJFmSfyAbQrFfn3jsEJMD3V2I9iBeVMr4mDeNj2Rx09S vn7reHA+DA4ovrnYOOArTNf7vdK1cbDGzMdgfPgm1YHFBH/KO18/h3cwbAxr1u0wGeZEV1 FZ3bl3ZO6afY9ZdCHuf2sh0BD0TEPFQ+XrW0RgBzouZiVjFTCon/ibsvwChiI3+0L0cCC4 NwKqFusSv1EoNuc8hqoSagM8J/PidSwDPgnCbwYmcOGEJn8Kd1qndAVSb8+8LQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1749633265; a=rsa-sha256; cv=none; b=gyBLxTmX3D9nfbzEU3obA/mqcAZWR2I4CNv1xp4etspOeWsoOezu5io7QoXQ4lRzMXUpfo xuXKv9k2uR2/m2FH74dALtjODaO0vdz495eC3Z4GkR/+VX55/6dZwCDAFdpFxnxm21Zw0D VpZLi2SKU6zx2k6H7rMbLks/QAsfcQlrT7QNAII4NJtpZlFBaevm2+4WQ8WjlvxuJ81VDa l7qNxhFFjUA3BglCYzgxMGmu+yrCAYLOyDqsVCWJsmwi2viaMgR9SEivtRSNq6PQ69Xc3U 9TelDVUHjstKLkknNrTDSDk3fL0aa4B0RgCbC37TAwq4xrJDjkEvp1PEmQjnjg== 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 4bHKjY2LHZz5VN; Wed, 11 Jun 2025 09:14:25 +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 55B9EPha062277; Wed, 11 Jun 2025 09:14:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55B9EPXe062274; Wed, 11 Jun 2025 09:14:25 GMT (envelope-from git) Date: Wed, 11 Jun 2025 09:14:25 GMT Message-Id: <202506110914.55B9EPXe062274@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: b2420591ff02 - stable/14 - LinuxKPI: 802.11: improve queue locking List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/14 X-Git-Reftype: branch X-Git-Commit: b2420591ff02b9ada66ff64b2d030a5198d6ea3c Auto-Submitted: auto-generated The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=b2420591ff02b9ada66ff64b2d030a5198d6ea3c commit b2420591ff02b9ada66ff64b2d030a5198d6ea3c Author: Bjoern A. Zeeb AuthorDate: 2025-06-05 22:02:01 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-06-10 23:40:32 +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 (cherry picked from commit bc24342d96aa816b448bec4d32b1f5e4a5793886) --- 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 ba6c73b99c32..be671a2ed7a3 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; @@ -7897,8 +7898,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(); @@ -7908,8 +7909,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; @@ -7918,6 +7919,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) { @@ -7925,7 +7934,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. */