Repository navigation
Conversation
centauri_t6050_start_ipc() holds the PCI rescan lock while it attaches the Bluetooth function's driver, whose probe registers a PM notifier. A suspend that starts while the N1 is still coming up after a wake then never finishes: - the suspend runs the PM notifiers; the PCIe host's flushes its unpark work, - that work waits for the rescan lock in its cold rescan, - the boot worker holds the lock and waits, in hci_register_dev(), to write the notifier chain the suspend is reading. Nothing has armed the sleep's watchdog yet, so the machine stays up with the suspend stuck. On a K116s, two RTC deep sleeps back to back do it every time; a lid closed again a few seconds after a wake does too. Take a reference under the lock and attach after dropping it. Fixes: 0a2d99d ("PCI: apple: T6050: look for a parked port's functions from a work") Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
No blockers. Checked drivers/net/wireless/apple/centauri/t6050/centauri_ipc.c at the head: the Beta function is pinned with HW row: K116s on this branch with CONFIG_PROVE_LOCKING, 10 back-to-back Assisted-by: LLM (Claude:Opus 5.5) |
|
Moving attachment out of the rescan lock is still needed. This head replays cleanly onto integration/aurora |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal pre-PR §1–§6 review at caa54bfba018 against integration/aurora tip 70a00e583b03: REQUEST_CHANGES.
Code, Concurrency & Supersession Audit
- Not superseded: Even after commit
b8fce260d6be(N1 keep-alive deep sleep), livedrivers/net/wireless/apple/centauri/t6050/centauri_ipc.c:453still callsdevice_attach(&ipc->function[2]->dev)while holdingpci_lock_rescan_remove(). The lock-order inversion withapple_pcie_t6050_pm_notify()->flush_work(&pcie->t6050_unpark_work)->apple_pcie_t6050_cold_rescan()->pci_lock_rescan_remove()still exists on boot and on any fallback warm-reset sleep/recovery path. - §1–§3 (Concurrency / lifetimes / error paths): Clean.
centauri_t6050_start_ipc_locked()pinsipc->function[2]withpci_dev_get()beforepci_unlock_rescan_remove(), andcentauri_t6050_start_ipc()callsdevice_attach(&beta->dev)outside the rescan lock followed bypci_dev_put(beta).- Error paths preserve exact return values when
beta == NULL(-ECANCELED,-EBUSY,-ENOMEM, etc.) and return0with the existing warning whendevice_attach()fails. - Teardown/removal races are safe:
centauri_t6050_quiesce()clearsc->ready(smp_store_release) and drainscancel_delayed_work_sync(&c->boot_work);cen_probe()(drivers/bluetooth/btcentauri_t6050.c:956) returns-EPROBE_DEFERwhenapple_centauri_control_ready()is false and takes neither the rescan lock nor F0'sdevice_lock;centauri_t6050_prepare()serializes suspend behindc->boot_lock; anddevice_attach()safely skips adevice_del()'dbeta.
- §4 (Attribution): Clean — human author/committer and human
Signed-off-by: Jens Axboe <axboe@kernel.dk>only, zero AI commit trailers. - §6 (CI & naming): Live CI is green (
host-testsrun44377640166).
Blockers
- §5 (Exact-head regression & lockdep evidence on current tip): The K116s suspend/resume test results were run on
0abc2f385e54(prior tob8fce260d6be, which substantially changedcentauri_pci.c/centauri_ipc.c/btcentauri_t6050.cdeep sleep) and omit the required §5 regression summary. Please post an exact-head K116s test run (withCONFIG_PROVE_LOCKINGexercising back-to-back suspend/resume including fallback/boot attach) plus the full regression pass (0 SELinux denials, 0 failed units, 0 new kernel errors).
Assisted-by: LLM (Gemini 4 Neon)
|
K116s row with lock checking, as far as it goes. Kernel:
Neither report is this PR's. Until those two are sorted, a |
A suspend that starts while the N1 is still coming up after a wake never finishes. The machine stays up with the suspend stuck, and no watchdog fires, because the sleep's WD2 is not armed yet.
The deadlock (stacks from a K116s, T6050, firmware 27.2):
apple_pcie_t6050_pm_notify()callsflush_work()on the host's unpark work.apple_pcie_t6050_cold_rescan(), waiting inpci_lock_rescan_remove().centauri_t6050_start_ipc()holds the rescan lock while it attaches the Bluetooth function's driver.cen_probe()→hci_register_dev()→register_pm_notifier()waits to write the notifier chain the suspend is reading.Fix. Take a reference to the Beta function under the lock and call
device_attach()after dropping it. 17 lines added, 6 removed, one file.Reproduce. Two RTC deep sleeps back to back, the second started as soon as the first returns:
Without the fix the second
rtcwakehangs every time (1 of 1 here, and it matches a lid-closed hang from the night before). Closing the lid a few seconds after a wake does the same.Testing. K116s,
integration/aurora0abc2f3 plus my K116s series:Beta driver attachment failed: -517; the deferred probe binds the function after the wake.centauri-recovery-tests.py,centauri-bt-arena-tests.pyandcentauri-wifi-pm-tests.pypass on this branch.Not tested on a J714s or J716c; the three code paths are the same there.
Fixes: 0a2d99d ("PCI: apple: T6050: look for a parked port's functions from a work")