Repository navigation
wifi: brcmfmac: serialize firmware-offloaded replacement joins after suspend - #2163
RyanTheTide merged 5 commits into
Conversation
209d130 to
2d31212
Compare
|
The amended commit (2d31212) drops that reinitialization (firmware down/up and power-mode restore on resume). It keeps the two parts that address the traced bug: preserving the pending SSID when the driver answers Locally: the suspend fixture passes all 33 controls and all six CI mutations hit their intended assertions; 394 of 394 host-test runs pass; strict checkpatch is clean; What this changes about the evidence: the 400-cycle J613 run covered the older-base candidate including the reinitialization. This reduced port has not been booted, and it is not yet shown that the join changes alone are sufficient on hardware. The PR body is corrected to say so. A J613 row for this exact head will follow. |
The Wi-Fi code was identical to The scan request was accepted before each forced suspend. The fallback harness did not verify an in-flight scan abort or barrier execution on the failed cycle. The natural phase was skipped after the failure. The older candidate's 100 forced + 300 natural result included non-WoW reinitialization and used a different base. This run shows that the reduced PR did not meet the recovery criterion on this J613. It does not isolate the cause of the reconnect failure. Next: restore the reinitialization on resume (with the host fixture extended to cover it), and run a control on this same base without the PR, so the failure can be attributed. Please hold review of this head until that row is posted. |
|
Thanks for posting the failed row plainly and asking to hold. Notes for the next version:
Row for the next head on the J613: the control without the PR, then the PR with 30/30 forced and 150/150 natural cycles reconnecting within 30 s, no |
|
@satchlj checking open drafts today. To come out of draft, this still needs:
If it's no longer needed, say so here and we'll close it. Otherwise it stays open as a draft until these are done. |
|
Same-base control re-check on MacBook Air 13" M3 (J613, T8122) running
So merged #3169 does not resolve the scan-interrupted |
ff484ad to
e0ddda0
Compare
There was a problem hiding this comment.
Verdict: FIX, then re-review at e0ddda09.
Blockers:
- Permanent
vif->join_cancelinglockout on race or timeout (drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:2542-2574,5178-5195,7867-7880):brcmf_notify_connect_status()runs on the event workqueue withoutwiphy_lock. Betweentest_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state)(L2566) andbrcmf_set_join_canceling(vif, true)(L2544), the event callback can observejoin_canceling == false, handle the old join's final terminal event, and clearBRCMF_VIF_STATUS_CONNECTING.brcmf_cancel_pending_join()then callsreinit_completion(), setsjoin_canceling = true, and sendsBRCMF_C_DISASSOCto an already-idle firmware, which emits no further terminal event.wait_for_completion_timeout()then times out after 1000 ms and leavesvif->join_canceling = true.- Once
vif->join_cancelingstaystrueafter anyBRCMF_JOIN_CANCEL_TIMEOUTtimeout (from that race, a lost/suppressed firmware event, or a subsequent non-WoWbrcmf_cfg80211_resume()that sendsBRCMF_C_DOWN/BRCMF_C_UPatL5185-5189without clearingjoin_canceling), every subsequentbrcmf_cfg80211_connect()entersbrcmf_cancel_pending_join()viabrcmf_join_canceling(ifp->vif), skipsBRCMF_C_DISASSOCbecausejoin_cancelingis alreadytrue, stalls underwiphy_lockfor 1000 ms, and returns-EBUSYpermanently until the interface is brought down (__brcmf_cfg80211_down). - Fix: (a) after
reinit_completion()+brcmf_set_join_canceling(vif, true)(with ordering againstbrcmf_notify_connect_status()), re-checktest_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state)and bail out withjoin_canceling = falseif the old join already completed; (b) clearjoin_canceling(and any staleCONNECTINGbit) when non-WoWbrcmf_cfg80211_resume()runsBRCMF_C_DOWN/BRCMF_C_UP; and (c) provide a bounded recovery path when cancel times out (e.g., firmwareDOWN/UPor resettingjoin_cancelingonce firmware is quiesced) instead of wedging all future connects in-EBUSY.
- Exact-head hardware verification (
Not yet): Post the exact-head J613 (and second-Mac regression check if touching allbrcmfmacchips) hardware row and green CI on the fixed head.
Checked: Full 5-file diff (net/wireless/sme.c, drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.{c,h}, tools/asahi/brcmf-suspend-tests.py, tools/asahi/run-host-tests.py), cfg80211_connect() -EBUSY SSID preservation, non-WoW GET_PM/DOWN/UP/SET_PM resume sequence, and brcmf_notify_connect_status() locking/event handling.
Evidence
net/wireless/sme.c:1538(if (!wdev->connected && !(err == -EBUSY && old_ssid_len))): sound —cfg80211_connect()already verified SSID equality atL1453-1456before callingrdev_connect(), andold_ssid_lenis0once any priorcfg80211_connect_done()clears it, sossid_lenis preserved only while an earlier join is genuinely pending.drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:5178-5195: non-WoWGET_PM/DOWN/UP/SET_PMsequence andbrcmf-suspend-tests.pyrestore-pmmutation look clean, aside from not clearingvif->join_cancelingacrossBRCMF_C_DOWN/BRCMF_C_UP.drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:2542-2574:brcmf_join_canceling()has no escape hatch after a 1000 ms timeout except__brcmf_cfg80211_down(), andL2566 -> L2544races with locklessbrcmf_notify_connect_status().
|
Thanks, all three parts of blocker 1 were real. Fixed in
Tests:
Blocker 2 is still open: the exact-head J613 row needs the test J613, which is down right now. The candidate boot plan will be rebuilt at this head. |
There was a problem hiding this comment.
Verdict: FINISH at d3b5011
The flag ordering, completion recheck and resume cleanup address the earlier wedge paths. On a second timeout the code now admits a replacement without a terminal event or a confirmed reset. Please establish that old join events are fenced before that admission, or retain the refusal until confirmed firmware recovery. Cover the late old event after a replacement is admitted, and retain the J613 runtime row.
|
Agreed, admitting on a second timeout was unfenced. Fixed in
Tests:
The J613 runtime row is kept in Not yet. The test J613 is down; the candidate boot will run it at this head. |
There was a problem hiding this comment.
Verdict: HOLD at eaf3f53d — code and host-test coverage are clean (both the earlier join_canceling lockout and unfenced second-timeout admission blockers are cleanly resolved); awaiting queued CI and the exact-head J613 hardware row.
Blockers:
- Exact-head J613 hardware verification at
eaf3f53d(pendingrubraavailability) and green queued CI checks.
Checked: Full delta commit eaf3f53de6 (drivers/net/wireless/broadcom/brcm80211/brcmfmac/{cfg80211.c,cfg80211.h,fweh.c,fweh.h}, tools/asahi/{brcmf-join-cancel-tests.py,brcmf-suspend-tests.py,run-host-tests.py}), brcmf_fweh_idle() event-queue + worker ordering, brcmf_station_reset() / join_reset fencing across both second-timeout cancel and non-WoW resume, and commit Signed-off-by.
Evidence
- Fencing and recovery verified (
eaf3f53de6):- Second silent cancel (
cfg80211.c:2539-2578): Instead of admitting a replacement without a terminal event, the second timeout callsbrcmf_station_reset()(GET_PM/DOWN/UP/SET_PM) whilejoin_cancelingremainstrue, recordsvif->join_reset = trueon success, and still returns-EBUSY. A subsequent connect admits only oncebrcmf_fweh_idle(ifp->drvr)confirms bothevent_qis empty and!work_busy(&fweh->event_work)(preventing any queued/in-flight old-join event from reaching the replacement). - Non-WoW resume (
cfg80211.c:5247-5265): Armsjoin_canceling = truebeforeBRCMF_C_DOWNwheneverCONNECTINGorjoin_cancelingis active, recordsjoin_reset = trueafterDOWNsucceeds, and fails a pending host connect once viacfg80211_connect_done(). - Non-fwsup connect escape (
cfg80211.c:2619):!ifp->vif->join_resetallows non-fwsup connects to pass through the reset fence oncefwehis idle rather than staying blocked in-EBUSY. - Tests: Registered in
run-host-tests.pywith 6 killed mutations (no-recheck,skip-retry-disassoc,retry-wedge,no-barrier-arm,admit-unfenced,no-reset) plusbrcmf-suspend-tests.pyresume-join.
- Second silent cancel (
- Remaining merge gate: Queued CI green and exact-head J613 hardware row at
eaf3f53d.
|
The |
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
eaf3f53 to
abd2f57
Compare
When cfg80211_connect() receives a replacement connect request for the same SSID while an earlier join is still in progress and the driver returns -EBUSY, clearing wdev->u.client.ssid_len drops the lookup key needed when the earlier join completes. Preserve wdev->u.client.ssid_len on -EBUSY when old_ssid_len was already set, matching how a refused reassociation preserves the existing SSID. Signed-off-by: Satya Benson <[email protected]>
When userspace issues a replacement connect while a firmware-offloaded (SAE/PSK) station join is still in flight, starting a new join without waiting for the prior join to terminate lets the old join's events complete against the replacement request or wedge firmware authentication. Serialize replacement connects by sending BRCMF_C_DISASSOC for the old target, suppressing stale connect/roam callbacks until firmware delivers a terminal event (bounded by BRCMF_JOIN_CANCEL_TIMEOUT while holding the wiphy lock), and returning -EBUSY if cancellation fails or times out so cfg80211 keeps the pending join intact. Clear the cancel flag when the interface goes down. Signed-off-by: Satya Benson <[email protected]>
After a non-WoW suspend where the dongle stayed powered across sleep, firmware can retain stale association and supplicant state that causes the first post-resume join to fail with authentication errors. On non-WoW resume of a ready station VIF, preserve the configured power mode across a BRCMF_C_DOWN / BRCMF_C_UP cycle. Extend brcmf-suspend-tests.py (including the restore-pm mutation) and register it in run-host-tests.py. Signed-off-by: Satya Benson <[email protected]>
brcmf_cancel_pending_join() could leave join_canceling set for good: - The event path runs without the wiphy lock. If the old join's last event was handled just before the flag was set, the DISASSOC went to idle firmware, no terminal event followed and the wait timed out. - After any timeout the flag stayed set, and every later connect skipped the DISASSOC, waited the full second again and returned -EBUSY until the interface went down. - A non-WoW resume's DOWN/UP did not clear it either. Now the cancel is armed with a full barrier before CONNECTING is tested, and a join that ended (or connected) through the normal path, before the flag or during the wait, is not cancelled. A connect that finds an earlier cancel still pending sends the DISASSOC again; if that one also sees no terminal event, the join is taken as gone, so one -EBUSY is the most a silent firmware costs. The resume's DOWN ends any join: it fails a pending host request once and clears the flag. tools/asahi/brcmf-join-cancel-tests.py runs the cancel against scripted firmware events, with four negative controls; brcmf-suspend-tests.py checks the resume path. Signed-off-by: Satya Benson <[email protected]>
There was a problem hiding this comment.
Verdict: HOLD at abd2f57 for current CI and the J613 hardware row.
Checked: The brcmfmac, wireless SME and focused join/suspend test blobs match eaf3f53. The current test runner still registers both suites and their timeout, reset and resume mutation cases. The prior code review carries to this head. Keep the current-head J613 validation and hosted checks.
abd2f57 to
efb853f
Compare
|
I rebased onto The resolutions:
The join-cancel and suspend controls pass, and all 15 of their mutations are killed (Linux host). One interaction for the reviewer, deliberately left unchanged in this rebase. While a cancelled join is pending, |
There was a problem hiding this comment.
Verdict: FIX, then re-review at efb853f9
Blockers:
brcmf_cfg80211_resume()leavesjoin_cancelingstucktrueifBRCMF_C_DOWNfails (drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.cL5247–L5256):- When
BRCMF_VIF_STATUS_CONNECTINGis set (pending == true) andjoin_cancelingwasfalse, L5250 armsbrcmf_set_join_canceling(ifp->vif, true)before callingBRCMF_C_DOWN. - If
BRCMF_C_DOWNreturns an error (if (err) goto out;at L5253–L5254),join_cancelingis never restored:join_cancelingstaystrue,join_resetstaysfalse, andBRCMF_VIF_STATUS_CONNECTINGstays set. - As a result,
brcmf_notify_connect_status()suppresses events for the live join, and for any non-SAE/PSK profile (!ifp->vif->join_reset && profile->use_fwsup != BRCMF_PROFILE_FWSUP_SAE && != BRCMF_PROFILE_FWSUP_PSK) every subsequentbrcmf_cfg80211_connect()returns-EBUSYuntil interface down. - Fix: Save
was_canceling = brcmf_join_canceling(ifp->vif)before arming and restoreif (!was_canceling) brcmf_set_join_canceling(ifp->vif, false);whenBRCMF_C_DOWNfails, and cover theBRCMF_C_DOWNerror path withCONNECTINGset inbrcmf-suspend-tests.py.
- When
- Complete green hosted CI and post the exact-head station resume + replacement-join hardware receipt at the updated head.
Checked:
- Audited
efb853f9(MERGEABLEonmainf5c98532) acrosscfg80211.c,cfg80211.h,fweh.c,fweh.h,brcmf-join-cancel-tests.py,brcmf-suspend-tests.py, andrun-host-tests.py. - Rebase conflict resolution against
e012a8c9(link_downcompletion) is clean:link_downis waited on only for a connected VIF, whilejoin_cancelingapplies only when unconnected. - The
brcmf_station_reset()+join_reset+brcmf_fweh_idle()fence inbrcmf_cancel_pending_join()avoidsrtnl_lockdeadlock while keepingjoin_cancelingarmed across the reset untilfweh->event_qandfweh->event_workare idle, and__brcmf_cfg80211_down()clears bothjoin_resetandjoin_canceling. - DCO
Signed-off-by:present onefb853f9; no Apple material or policy issues.
Evidence
cfg80211.cL5247–L5256:brcmf_set_join_canceling(ifp->vif, true)runs beforeBRCMF_C_DOWN;if (err) goto out;bypassesjoin_reset = trueandcfg80211_connect_done()without restoringjoin_canceling.cfg80211.cL2618–L2621: non-SAE/PSK profiles requirejoin_resetto enterbrcmf_cancel_pending_join()and releasejoin_canceling.
…g it A second cancel that saw no terminal event admitted the replacement at once. A late event of the old join could then still reach it. Now that cancel resets the station firmware (GET_PM, DOWN, UP, SET_PM) with join_canceling still set, so the event path keeps ignoring the old join, and still refuses the connect. The reset ends the join for certain. A later connect admits a replacement only once no firmware event is queued or being handled (brcmf_fweh_idle()), so none of the old join's events can reach it. brcmf_fweh_idle() takes only the event queue's own lock; flushing the worker from connect could deadlock on the rtnl lock an interface event takes. The non-WoW resume's DOWN fences the same way: a pending or cancelled join keeps the flag, the reset is recorded, and the next connect releases it on an idle queue, whatever the profile's supplicant. A DOWN that fails ends no join, so a join that was not already being cancelled gets its events back. brcmf-join-cancel-tests.py adds the reset, a late event still queued after it, and the release on a drained queue, with the admit-unfenced and no-reset negative controls; brcmf-suspend-tests.py checks the resume fence and the failed DOWN, with the down-error-fence negative control. Signed-off-by: Satya Benson <[email protected]>
efb853f to
2115ca6
Compare
|
Blocker 1 is fixed at
Blocker 2 is still open. CI is re-running on the new head. The exact-head J613 hardware row is blocked: the test J613's remote-recovery cable needs reseating before it can run any risky trial. |
There was a problem hiding this comment.
Verdict: HOLD at 2115ca6 for hosted CI and the station resume and replacement-join hardware row.
Checked: On failed C_DOWN, the resume path now clears a cancellation fence it armed itself and retains a pre-existing cancellation. The fixture covers both states, and the new mutation removes the restoration to exercise the regression. The code finding at efb853f is addressed. Keep the current-head J613 receipt and hosted checks.
|
Hardware row at this head on J613 (MacBook Air 13" M3, T8122): 6/6 forced-scan s2idle cycles recovered in 0.5–1.0 s, then a hard reset during the 7th. So this row is not a pass. Setup: Results:
Not yet / not attributed: the reset has not been reproduced at this head, and its cause is unknown. The same evening, the same forced-scan harness also gave resets and one missed RTC wake on kernels without this PR, always with the workarounds aside. With both workarounds in place, 20/20 cycles were clean on the default kernel. So one reset is not evidence against this change. A repeat at this head, with a reset-safe harness, is next. |
|
Repeat at this head, same boot as the partial row above ( The setup was the same as before, with both userspace workarounds moved aside. The harness now stops at the first cycle whose Wi-Fi does not return, and reboots the machine itself if a cycle stalls for 3 minutes. Neither happened.
Tally at this head: 26 of 27 forced-scan cycles recovered in under 1 s; the other ended in the reset above. That reset is still unexplained and has not reproduced at this head. Resets and a missed RTC wake were also seen on kernels without this PR, always with the workarounds aside. |
There was a problem hiding this comment.
Verdict: MERGE at 2115ca6e5001
Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.
Checked: Code reviewed in the earlier App review at this head (6102231485).
Follow-ups (not blocking): hosted CI, J613 station resume + replacement-join row
|
Merging at |
|
Follow-up on the reset in the 29 Nov row (6/6, then a reset in cycle 7). More J613 rows since then show that the hard reset is not specific to this PR: it also happens on MacBook Air 13" M3 (J613, T8122). Same harness as above: a scan is running at suspend, 15 s RTC wake, Wi-Fi must be back within 30 s, both userspace workarounds aside unless noted, and a run stops at its first failure.
What the resets look like: each came within about 15 s of a completed resume. Nothing reached the kernel log, and no soft-lockup, hung-task or oops panic fired (all three armed on A). The 33–66 s gap to the next boot fits a watchdog reset, not a panic (a deliberate panic with Reading: the reset needs the WLAN function bound, and it occurs with and without this PR, so these rows don't attribute it to this change. With this PR, all 123 forced-scan cycles that completed got Wi-Fi back, in 0.5–1.5 s where timed. Without it, Wi-Fi never came back after the first resume. Not yet: the 150-cycle natural-suspend phase. Warning and barrier-timeout counts for these runs are not available, because their per-cycle logs were not kept. The reset itself has no cause or fix yet. |
What: Preserve
wdev->u.client.ssid_lenincfg80211_connect()when a replacement connect for the same SSID returns-EBUSY, serialize replacement firmware-offloaded (SAE/PSK) station joins inbrcmfmacwithBRCMF_C_DISASSOCand aBRCMF_JOIN_CANCEL_TIMEOUT(1000 ms) barrier until firmware emits a terminal event, and reinitialize non-WoW ready station firmware (GET_PM/DOWN/UP/SET_PM) on resume. Drops the previous BCM4388 chip-ID gate, splitsnet/wireless/sme.cinto its own commit, and extendsbrcmf-suspend-tests.py(restore-pmmutation).Tested:
2115ca6e5001(onmainf5c98532ba34):brcmf-join-cancel-tests.pyandbrcmf-suspend-tests.pycontrols pass and all of their mutations (6 + 10, includingrestore-pm,resume-joinand the newdown-error-fence) are killed; the otherbrcmf-*host tests pass.LLVM=1 W=1arm64 compile ofbrcmfmac/cfg80211.oandfweh.o: clean.checkpatch.pl --stricton the review fix: 0/0/0.linux-aurora 7.3.0.aurora1-43(dc7c873addc8, includes#3169) and both userspace workarounds removed: 0/1 FAIL on forced scan-interrupteds2idle(iwd: connect-failed, status: 16, NetworkManagerconfig -> failed (reason 'no-secrets')).5a8bb0c8, join-cancel barrier + non-WoW resume reinit) on J613 with workarounds removed: 30/30 forced scan-interrupteds2idle+ 67/67 natural cycles (97/97 PASS, 0 failures).Risk: two-way door · all
brcmfmacMacs (cfg80211_connect()-EBUSYSSID preservation, firmware-offloaded station join cancellation, and non-WoW station resumeDOWN/UPreinit).Not yet: Exact-head J613 (MacBook Air 13" M3, T8122) hardware verification run at
2115ca6e5001. The prior equivalent build passed 97/97 on J613.