Repository navigation
centauri: scan all 38 channels, free function 1's IRQs before its devres does - #1801
DjDeveloperr merged 2 commits into
Conversation
The scan worker stopped every 13-channel chunk once 8 channels had reported, so a scan covered 24 of the 38 channels: 2.4 GHz 9-13, 5 GHz 100-116 and 153-165 were never scanned and channel 149 was the last one kept. A 5 GHz BSS on those channels came and went between scans (J815, same AP on 2437 and 5745 MHz), and the supplicant joined 2.4 GHz after a boot or a wake. Wait for the firmware's scan event instead. Stop a chunk only once all of its channels have reported without one, after a second without progress, at its deadline (twice the dwell per channel, at least 8 s) or on an abort, and keep what an early-ended chunk found rather than failing the scan. The finish line reports this scan's channels and beacons, not the totals since probe. A stop the firmware refuses (status 342: the chunk had already ended, seen when a scan met the start of a suspend, rc=-121) ends that chunk with its results instead of failing the whole scan. Assisted-by: Claude Opus 5.5 Signed-off-by: Nick <[email protected]>
… does
Function 0 requests the IRQs of function 1's MSI vectors, which belong
to function 1's managed device. Removing the PCIe host removes function
1 first: its devres freed the vectors under function 0's handlers
("remove_proc_entry: removing non-empty directory 'irq/96', leaking at
least 'centauri'", J815 radio host unbind before a deep sleep), and
function 0 then freed IRQs that were gone. Register a devres action on
that function which frees the handlers first, and drop it when function
0 frees them itself.
Assisted-by: Claude Opus 5.5
Signed-off-by: Nick <[email protected]>
DjDeveloperr
left a comment
There was a problem hiding this comment.
Reviewed. Both fixes are correct for the problems they target, so I'm approving. The T6050 transport (apple_centauri_t6050, t6050/) is untouched, and apple_centauri still bails out behind apple,t6050-pcie hosts, so this affects the T8142 and T8152 boards only.
Scan: every wait is bounded. Bringing the interface down still aborts the scan quickly. Partial results are kept instead of failing the whole scan.
IRQs: the devres action on function 1 runs before its pcim MSI release. Function 0's normal teardown removes the action first, and the handler counter keeps either path from freeing twice.
Optional follow-ups, none blocking:
centauri_wifi.c~958: any non-zero return from the stop is treated as "chunk already over", including-ETIMEDOUT/-EIO. Treating only the firmware's refusal (-EREMOTEIO) that way, and propagating other errors, would be more precise. The next chunk's start still catches a dead firmware.centauri_wifi.c~907/914:doneis sampled before the chunk's start command. A late scan-done (0x05) from the previous chunk, which can now happen because a refused stop or a quiet chunk continues instead of aborting, could end the next chunk on its first pass. Samplingdone/channelsaftercommand()returns avoids that.centauri_wifi_unregister()(existing code) setsstoppingbut notscan_abortbeforecancel_work_sync(). With the longer per-chunk deadlines, a remove during a scan can now wait for the whole scan.centauri_ipc.c~368: on the existing debugfs-only path wherecentauri_free_boot()skipscentauri_free_ipc(), a later function 1 unbind reachesref->c->ipcafter function 0's devmcis gone. Storing theipcpointer incentauri_vector_ref, and usingconly as the cookie, would close that.
A note in the commit that the chunking hasn't been run on the J813 (scan_tlvs = false, so the firmware picks the chunks' channels) would also help.
1b12994
into
aurora-silicon:integration/aurora
remove_proc_entry: removing non-empty directory 'irq/96', leaking at least 'centauri'), and function 0 then freed IRQs that were gone. A devres action on function 1 now frees function 0's handlers first, and is dropped when function 0 frees them itself.Tested on J815: every boot since the fix:
Wi-Fi scan finished: rc=0 channels=38 of 38(was 24) and joined 5745 MHz, at boot and again after each pm_test sleep step (before: a 5 GHz / 2.4 GHz coin flip). Function 1 still probes, and in four later boots the sleep test unbound the radio host with no WARN (boot 348f4fee, before the fix, had it at the same unbind).The T6050 driver (
centauri/t6050/) is untouched.Part of the J815 (MacBook Air 15-inch, M5, T8142) bring-up: board results are summarised in discussion #135. Tested on a J815 with a macOS 27.0 stub (firmware 27.0) through aura Stage 2.
Assisted-by: Claude Opus 5.5