Repository navigation
thermal/drivers/apple-pmp: count only kernel-thread reads as the core's failed reader - #3824
Conversation
…'s failed reader A user space thread that read thermal_zoneN/temp while the sensor was failing, and then wrote "disabled" to thermal_zoneN/mode, was taken for the core's broken-sensor disable: both calls came from the same task, so the next good sample re-enabled the zone the operator had disabled. The core backs off and gives up from its workqueues, so remember a failed reader only when it is a kernel thread. A user task is never recorded, and a disable it writes stays.
There was a problem hiding this comment.
Verdict: MERGE at b7ffc9b
Checked:
- A failed read is recorded only for a kernel thread (
current->flags & PF_KTHREAD). A user task that reads a failingtempand then writesmode=disableditself now leavesfailed_readerNULL, so its disable counts as manual and stays. That closes the same-thread case from the #2774 follow-up. - Tried to find an interleaving where a user read wipes a core failure between the core's
get_tempand itsthermal_zone_broken_disable(). Both the sysfstempread (thermal_zone_get_temp) and__thermal_zone_device_update()run undertz->lock, and the core's read, recheck and broken-disable happen inside one locked update. So no user read can land between them. - The core gives up from its poll/recheck work items (kworkers). The first failure after a user re-enable only schedules a recheck, because the recheck delay is reset at broken-disable. If the core ever gave up from a user task, the zone would stay disabled: the pre-#2774 behaviour and the safe side, as the PR says.
Follow-ups (not blocking):
- None.
|
Merge readiness at
Areas: none matched in CODEOWNERS Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Reviewed the failed-reader assignment, the thermal core's polling work and the mode-change path. A user read can no longer arm automatic re-enable, and the core workqueue keeps its same-task recovery path. The diff and host CI are clean. Merge still needs a J713 row on this head covering manual disable and recovery after a core-originated disable.
|
Row: b7ffc9b + J713 (M4 Air, fleet91 with this driver as a module) + PASS. The swapped module came up at level 0 with the zone enabled. |
What
Follow-up to #2774 (the review's non-blocking same-thread case). If a user space thread read
thermal_zoneN/tempwhile the PMP sensor was failing and then wrotedisabledtothermal_zoneN/modeitself, apple-pmp-thermal took that for the core's broken-sensor disable and re-enabled the zone at the next good sample. Now a failed read is remembered only when the reader is a kernel thread (the core backs off and gives up from its workqueues), so a user task never matches and a disable it writes stays.Tested
apple_pmp_test_fault_disable_origin.run-host-tests.py --only pmp24/24,--only asahi-m4pass.Risk
Risk: two-way · J713 (only the auto re-enable decision changes; a revert restores the #2774 behaviour).
If the core ever gave up from a user task, the zone would stay disabled until re-enabled by hand, which is the behaviour before #2774.
Not yet