Repository navigation
soc: apple: rtkit: echo OSLOG counters on every RTKit and every G17 GPU - #3384
RyanTheTide wants to merge 2 commits into
Conversation
The G17 driver turned the RTKit OSLOG counter echo off on every GPU coprocessor, because the T8140 and T8142 GPU firmware had only run with its counters unanswered. That is not a property of the hardware or the firmware: the echo is the OSLOG protocol of every RTKit firmware that sends counters. A firmware that uses it holds the next counter until the last is echoed and takes no AP power notice while one is outstanding; a firmware that does not use it sends no counters, so the echo never goes out. Drop the set_oslog_echo(false) call, so the GPU coprocessors follow the RTKit default like every other RTKit client. On T8140 and T8142, where RTKit starts with the echo on, the GPU counters are now echoed instead of dropped. On T6040, T6041 and T6050 nothing changes on the wire: an admitted counter was already acknowledged with the same message (the exact counter on endpoint 8) by the non-echo path. Signed-off-by: Ryan Murray <[email protected]>
The OSLOG counter echo was chosen by machine: rtk->oslog_echo was set only when the machine is apple,t8140 or apple,t8142. With the echo off, a counter was dropped on those two machines (and on a node with apple,sync-syslog-ack) by apple_rtkit_oslog_unanswered(), but acknowledged after a buffer/channel check on every other one by apple_rtkit_oslog_echoed(). The echo is RTKit protocol behaviour, not a SoC property. The IOP sends nothing at OSLOG setup that tells the two apart: its endpoint carries a buffer request (size and IOVA), channel-zero counters and the opaque types 3-5, and the management HELLO advertises protocol 11-12 on every generation. A firmware that uses the counter protocol sends counters and holds the next one until the last is echoed; one that does not sends none, so the echo never goes out. The acknowledgment that every non-T814x RTKit has sent since commit 1369d18 ("soc: apple: acknowledge OSLog progress in negotiated and inherited sessions") is the same message (the exact counter on endpoint 8), so M1- to M5-era firmware already gets it. So echo every channel-zero counter by default, on every RTKit. The off state keeps one meaning everywhere: the counter is dropped. It is off on a node with apple,sync-syslog-ack (the T8122 dcpext, which has only run with its counters unanswered; a DCP driver that restarts its DCP across a sleep turns it back on as before) and where a client turns it off. Both machine-keyed helpers go, with the admitted-buffer and channel checks of the old acknowledgment path, APPLE_RTKIT_OSLOG_LOG_RESERVED and oslog_inherited, which only that path read. The saved-scope poll's log-word test (apple_rtkit_log_word()) now follows the echo flag alone, as the receive path does. The echo path, which T8140 and T8142 have run since their sleep work, echoes the exact counter as macOS does. The one behaviour change on other SoCs is in edge cases: a counter that failed those checks is now echoed instead of dropped with a warning, a polled idle (T6050 AOP) echoes an owed counter as on T8140, and when two counters are queued before the receive work runs only the newer one is echoed, which acknowledges the older one too since the counter is cumulative. T8140 and T8142 keep the same messages on the wire: the echo starts on there as before (no node of theirs has apple,sync-syslog-ack). The host OSLOG control test and the DCP selftest now check the echo policy instead of the machine list. The echo and its polled-idle handling are Diljit Singh's (T8140) and Nick's (T8142); the counter acknowledgment is Eryk Wieliczko's and Chris Kearney's. Fixes: d9b438c ("arm64: apple: support coordinated suspend-to-RAM on T8140") Fixes: 1369d18 ("soc: apple: acknowledge OSLog progress in negotiated and inherited sessions") Signed-off-by: Ryan Murray <[email protected]>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
The new type-2 OSLOG path removes the check for reserved bits and can echo words that checked-ACK families previously dropped, even without a negotiated or inherited buffer. The new comment explains cumulative channel-zero counters, but does not establish that those other words are channel-zero counters. Keep the validation where its removal lacks evidence, or document measured protocol evidence and add a control for a type-2 word outside the accepted channel-zero form. Keep the Neo GPU soak and the second-family row as merge gates.
|
Neo row at this head (f6fac68): A18 Pro (T8140, J700, G17P). The kernel was the combined fixa5 test kernel, linux main fca33ed plus the heads of #2887 #2959 #3384 #2919 #2393 #2895. Every file this PR changes is byte-identical to this head there, except two shared files:
In both, nothing else differs from this head: no lines from anywhere else, and none of this PR's lines missing. One-shot BLS entry, default command line. 1. Idle soak with the echo visible. Dynamic debug was on for
2. The GPU coprocessors sent no OSLOG traffic. That held over 30 min idle, the s2idle cycles, 3 min of gpubench load, and a second one-shot boot with
So on this Neo build the GPU echo path had nothing to act on. There is no regression, and no misbehaviour in any RTKit, but this row can't positively show a GPU counter echo. The MTP echo, the path every RTKit now takes, ran 3 times with 0 failures. 3. Regression smoke on the same boots:
The Neo was restored to fleet89 and verified: saved entry unchanged, next_entry empty, test kernel removed. Evidence (lab store): |
Dismissed under the 12-01 merge bar: this review's blockers were not shown failures (CI/rows/rebase/design or re-run asks). Follow-ups, not blocking: No code affirmation; follow-ups: keep reserved-bit validation for type-2 OSLOG or show protocol evidence + control; Neo GPU soak
Supersedes #2412. That branch merged
integration/aurora, so it no longer merges intomaincleanly. This is the same change ported ontomain, with the review's blocker folded in: no per-SoCoslog_echoswitch, and every G17 GPU coprocessor follows the RTKit default.Problem
On
mainthe RTKit OSLOG counter echo is chosen by machine:__apple_rtkit_init()turns the echo on only forapple,t8140andapple,t8142.apple_rtkit_oslog_unanswered()drops the counter on those two machines and onapple,sync-syslog-acknodes.apple_rtkit_oslog_echoed()acknowledges it after a buffer/channel check on every other machine. That acknowledgment is the same message as the echo: the exact counter on endpoint 8.g17/mod.rs,receiver.set_oslog_echo(false)).Change
Commit 1 (
drm/asahi: g17): the GPU coprocessors follow the RTKit echo default. Theset_oslog_echo(false)call goes, and there is no per-SoCConfigfield. On T8140 and T8142 the GPU counters are now echoed instead of dropped. On T6040, T6041 and T6050 nothing changes on the wire: their counters already got the same acknowledgment.Commit 2 (
soc: apple: rtkit): the echo is on by default for every RTKit.rtk->oslog_echo = !rtk->sync_syslog_ack. With the echo off, the counter is dropped on every SoC.apple_rtkit_oslog_unanswered()andapple_rtkit_oslog_echoed()are removed, together with the old acknowledgment branch,APPLE_RTKIT_OSLOG_LOG_RESERVEDandoslog_inherited(only that path read them).apple_rtkit_log_word()(saved-scope poll) now reads the echo flag, as the receive path does.tools/asahi/rtkit-oslog-tests.py,run-host-tests.pyand the apple-dcpboot.pyselftest now check the echo policy instead of the machine list.Not ported from #2412: its second commit (T6050 PMP CoreAnalytics ack and SIO description keyed on the hardware).
mainalready has both.pmp_ca_event_ackis set fromapple,t6050-pmp-v2alone, andsio_t6050_board()usesapple_t6050_sleep_described(). Thehw/*.rsoslog_echoinitialisers that the review flagged never landed onmain, so there is nothing to drop there.Per-SoC effect
apple,sync-syslog-ack): unchanged. Counters are still dropped. A DCP driver that restarts its DCP across a sleep still turns the echo back on (dcp.c, unchanged).Credit: Diljit Singh wrote the echo and its polled-idle handling (T8140). Nick extended the echo to T8142. Eryk Wieliczko and Chris Kearney wrote the counter acknowledgment.
Tested:
tools/asahi/rtkit-oslog-tests.py: 1710 OSLog counter/echo/session controls passed. All 5 mutants (owed,policy,counter,reset,buffer) were caught by assertions.tools/asahi/run-host-tests.py --only rtkit: 28/28. Alsortkit-v27-late(3/3),display-sleep-merge(1/1),cio(5/5) andcio-native(1/1), which extractrtkit.ctoo.tools/testing/selftests/drivers/gpu/apple-dcp/run.sh --group boot: 6/6, includingoslog-events.--group edid: 4/4.scripts/checkpatch.pl: clean on both commits.rustfmt --checkclean ong17/mod.rs. The arm64 fleet-config build (Image, modules including the asahi Rust driver, dtbs) is OK in the combined FIXUP-A kernel 7.3.0-aurora-fixa5 (main fca33ed + this PR's files byte-identical).Rows owed at f6fac68: Neo (T8140) boot + GPU OSLOG echo idle soak; one T6050 or T8142 boot. Test kernel: 7.3.0-aurora-fixa5 (kit built; rows in progress).
Risk
Risk: two-way · Neo (T8140), T8142, every Mac with RTKit coprocessors. A plain revert undoes it.
The T8140/T8142 GPU firmware has only run with its OSLOG counters dropped. It now gets them echoed, as every other T8140/T8142 RTKit and the M4 Pro/Max and M5 Pro/Max/Ultra GPU firmware already do. The Neo soak row covers this. On every other SoC the message on the wire is unchanged, except in the edge cases listed above.