sv6160: correct two claims this review got wrong about the kernel

Both were found by fact-checking the review's own output against the 6.18
tree, line by line, rather than against what it remembered writing.

  - The comment above devm_request_threaded_irq() said "the PM core masks the
    line for the suspend and latches a wake".  Backwards.  With the wake
    armed, suspend_device_irq() takes the irqd_is_wakeup_set() branch, sets
    IRQD_WAKEUP_ARMED and returns BEFORE any __disable_irq(): the line stays
    enabled through the suspend.  What disables it, marks it pending and
    aborts the suspend is the first assertion after that point
    (irq_can_handle_pm() -> irq_pm_handle_wakeup()).  The line that really is
    disabled at suspend time is one with neither IRQF_NO_SUSPEND nor a wake
    armed.  The behaviour the change was made for is unaffected; the
    explanation was wrong, and a wrong explanation in a comment is how the
    next reader gets it wrong too.

  - KNOWN-ISSUES said a module-reload harness "never exercises" ifdown/ifup,
    mac_stop, mac_flush or remove().  It does: rmmod -> sv6160_remove ->
    ieee80211_unregister_hw -> ieee80211_remove_interfaces ->
    cfg80211_shutdown_all_interfaces -> dev_close, which both disconnects
    (.flush) and stops (.stop), and backtoours.sh brings the interface up
    again afterwards.  What the harness never does is run any of them on a
    module that then STAYS loaded -- a credit or skb stranded by .stop is
    freed by the unload a second later, so "never returned for the module's
    life" leaves no trace, and the .start after a reload always meets a fresh
    softc.  And only three or four of the findings were of that shape: the
    rest ran on every cycle and survived because their knob defaults off
    (cmd_gate, wt_trace), because the firmware never sent the input that
    trips them (runt RX_SERIAS links, event 32), or because the next unload
    erased the damage.  The harness gap is real, but it is "and then keep the
    module loaded", not "never runs .stop".

Also: the A/B baseline paragraph said two code commits sit between a57846c
and 09fd788.  Four commits touch the driver source there, two of them
docs:-prefixed; only a7dfd19 changes executable code.  Subject prefixes lie
in both directions, which is the reason to read the diffs.

Comment and documentation only; no behavioural change.  Builds clean.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JSNniou44nN9EFGqTmZ6my
This commit is contained in:
Paul KilarandClaude Opus 5 committed 2026-09-19 07:40:23 -04:00
1 parent b0e34e9617
commit 3f0f67e174
2 files changed
+32 -11

No files matched your search

+26 -9
View File
@@ -177,20 +177,37 @@ themselves. Commits `9de36d7` (driver), `48a253d` (the convergence fixes),
### Applied, needs an ordinary soak
Lifecycle and accounting bugs that a module-reload harness never exercises,
which is why an 8-hour soak did not see them: `remove()` freed the softc under
a live IRQ thread; `mac_stop`/`mac_flush` stranded `tx_outstanding_ac[]` and
leaked batched skbs; the per-AC counter had no lock; the resync could free a
frame a CMD53 was still reading; `cmd_gate=1` self-deadlocked the IRQ-thread
drain; several firmware-supplied lengths were used without a lower bound.
Lifecycle and accounting bugs an 8-hour soak did not see: `remove()` freed the
softc under a live IRQ thread; `mac_stop`/`mac_flush` stranded
`tx_outstanding_ac[]` and leaked batched skbs; the per-AC counter had no lock;
the resync could free a frame a CMD53 was still reading; `cmd_gate=1`
self-deadlocked the IRQ-thread drain; several firmware-supplied lengths were
used without a lower bound.
**Add an ifdown/ifup cycle to the harness before the next soak** — that gap is
exactly what hid this whole class.
Why the soak missed them is worth stating precisely, because the obvious
version is wrong. A `rmmod`/`insmod` recovery *does* run `remove()`, `.stop`
and `.flush` — `rmmod` → `sv6160_remove` → `ieee80211_unregister_hw` →
`ieee80211_remove_interfaces` → `cfg80211_shutdown_all_interfaces` →
`dev_close`, which both disconnects (→ `.flush`) and stops (→ `.stop`) — and
`backtoours.sh` brings the interface back up afterwards. What it never does is
run any of them on a module that then *stays loaded*: a credit or skb stranded
by `.stop` is freed by the unload a second later, so "never returned for the
module's life" leaves no trace, and the `.start` after a reload always meets a
fresh softc. Only three or four of the findings were of that shape; the rest
ran every cycle and survived because the knob that reaches them defaults off
(`cmd_gate`, `wt_trace`), because the firmware never sent the input that trips
them (runt `RX_SERIAS` links, event 32), or because the next unload erased the
damage.
**Add an ifdown/ifup cycle to the harness before the next soak** — that is the
gap, not the absence of `.stop`.
### Applied as experiments, needs a paired A/B
A/B against **`09fd788`**, the immediate pre-review parent. Not `a57846c`: that
is the last *soaked* build, but two code commits sit between the two, so it
is the last *soaked* build, but four commits touch the driver source between
the two (two of them `docs:`-prefixed; only `a7dfd19` changes executable
code), so it
cannot attribute a difference to either change below.
- **The `-EBUSY` back-off now drops `sc->lock`, not just the host claim.**
@@ -394,8 +394,12 @@ static int sv6160_probe(struct sdio_func *func,
* and ACKs the firmware. No IRQF_NO_SUSPEND: it is documented as
* incompatible with the enable_irq_wake() below (suspend-and-
* interrupts.rst), and it kept the thread draining a suspended
* host. The PM core masks the line for the suspend and latches a
* wake; the thread also refuses to drain while is_suspended. */
* host. With the wake armed the PM core does NOT mask the line
* for the suspend -- suspend_device_irq() takes the
* irqd_is_wakeup_set() branch, sets IRQD_WAKEUP_ARMED and returns
* before any __disable_irq(). The first assertion after that is
* what disables it, marks it pending and aborts the suspend in
* progress. The thread also refuses to drain while is_suspended. */
ret = devm_request_threaded_irq(&func->dev, sc->host_wake_irq,
NULL, sv6160_gpio_irq_thread,
IRQF_ONESHOT,