From: Luka Gejak <luka.gejak@linux.dev>
To: Ping-Ke Shih <pkshih@realtek.com>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Michael Straube <straube.linux@gmail.com>,
Bitterblue Smith <rtl8821cerfe2@gmail.com>,
Peter Robinson <pbrobinson@gmail.com>,
Hans de Goede <johannes.goede@oss.qualcomm.com>,
luka.gejak@linux.dev
Subject: RE: [PATCH v7 6/6] wifi: rtw88: sdio: add TX back-pressure and retry on page starvation
Date: Tue, 25 Aug 2026 09:22:18 +0200 [thread overview]
Message-ID: <6EA9DEEA-DFF7-4AFC-9C46-55D0EDF256BB@linux.dev> (raw)
In-Reply-To: <348bea609cee45179ee2a0c7dd03f0d1@realtek.com>
Hi Ping-Ke,
On August 25, 2026 8:36:30 AM GMT+02:00, Ping-Ke Shih <pkshih@realtek.com> wrote:
> With WRITE_ONCE() and READ_ONCE(), I think it will concurrency work
> well. Did you really encounter problems with smp_mb()?
Not from a failure I hit, no. It came out of reading the code, and I think
it is still needed, so let me lay out the case rather than just assert it.
The flag alone is not enough because of this order:
producer worker
skb_queue_tail()
reads len, sees >= HIWATER
drains the queue to empty
reads the flag, still false,
so it does not wake
writes the flag true
ieee80211_stop_queue()
The AC is now stopped with an empty queue and nobody left to wake it. That
is what the re-check under the barrier is for: once the flag is set, read
the length again, and if the worker drained it meanwhile, undo the stop.
For that re-check to mean anything the flag store has to be visible before
the length is re-loaded. READ_ONCE and WRITE_ONCE stop the compiler from
tearing or hoisting either access, but they do not order one against the
other, so without smp_mb() the CPU may still perform the length re-load
before the flag store lands. Then the worker can read the old flag, skip
the wake, and the re-check reads a length that is already stale, which puts
us back at the same stuck AC.
So I have kept it, with the blank line you asked for. If you would rather
drop the flag entirely, both watermark helpers become two-line functions
and the barrier goes with it, since ieee80211_stop_queue() and
_wake_queue() are idempotent and the watermarks alone can decide the state.
I did not do that here because it is a bigger change than the one you asked
about and I would rather not touch the concurrency in this patch without
your say-so.
> Can we move below just before the user?
Moved, though not all the way: rtw_sdio_indicate_tx_status() consumes the
skb, either handing it to rtw_tx_report_enqueue() or to
ieee80211_tx_status_irqsafe(), so reading q_map after that call would be a
use after free. It now sits immediately before it, with a comment saying
why it cannot go further down.
Best regards,
Luka Gejak
next prev parent reply other threads:[~2026-08-25 7:22 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-20 9:04 [PATCH v7 0/6] wifi: rtw88: preparations for RTL8723B/RTL8723BS luka.gejak
2026-08-20 9:04 ` [PATCH v7 1/6] wifi: rtw88: add the RTL8723B chip type and SDIO helper luka.gejak
2026-08-20 9:04 ` [PATCH v7 2/6] wifi: rtw88: rx: mark zero length packets on RTL8723BS luka.gejak
2026-08-20 9:04 ` [PATCH v7 3/6] wifi: rtw88: tx: extend the TX report purge timeout to RTL8723BS luka.gejak
2026-08-20 9:04 ` [PATCH v7 4/6] wifi: rtw88: sdio: track free TX pages and OQT credits for RTL8723BS luka.gejak
2026-08-25 6:12 ` Ping-Ke Shih
2026-08-25 7:20 ` Luka Gejak
2026-08-25 7:25 ` Ping-Ke Shih
2026-08-25 7:33 ` Luka Gejak
2026-08-25 7:50 ` Ping-Ke Shih
2026-08-25 8:07 ` Luka Gejak
2026-08-25 8:22 ` Ping-Ke Shih
2026-08-25 8:32 ` Luka Gejak
2026-08-25 8:38 ` Ping-Ke Shih
2026-08-25 8:42 ` Luka Gejak
2026-08-25 8:49 ` Ping-Ke Shih
2026-08-20 9:04 ` [PATCH v7 5/6] wifi: rtw88: sdio: set up RX aggregation and interrupts " luka.gejak
2026-08-20 9:04 ` [PATCH v7 6/6] wifi: rtw88: sdio: add TX back-pressure and retry on page starvation luka.gejak
2026-08-25 6:36 ` Ping-Ke Shih
2026-08-25 7:22 ` Luka Gejak [this message]
2026-08-25 8:27 ` Ping-Ke Shih
2026-08-22 16:51 ` [PATCH v7 0/6] wifi: rtw88: preparations for RTL8723B/RTL8723BS Luka Gejak
2026-08-23 6:00 ` Luka Gejak
2026-08-25 7:08 ` Ping-Ke Shih
2026-08-25 7:27 ` Luka Gejak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6EA9DEEA-DFF7-4AFC-9C46-55D0EDF256BB@linux.dev \
--to=luka.gejak@linux.dev \
--cc=johannes.goede@oss.qualcomm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=pbrobinson@gmail.com \
--cc=pkshih@realtek.com \
--cc=rtl8821cerfe2@gmail.com \
--cc=straube.linux@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox