Repository navigation
soc: apple: rtkit: echo OSLOG counters on every RTKit and every G17 GPU - #3384
RyanTheTide wants to merge 3 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 <ryan@aurorasilicon.org>
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 <ryan@aurorasilicon.org>
|
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
DjDeveloperr
left a comment
There was a problem hiding this comment.
Approve on the code at f6fac68b799a. Only g17/mod.rs ever turned the echo off, so after this the policy really is "echo unless apple,sync-syslog-ack". The saved-scope poll reads the same flag as the receive path.
This isn't a no-op off T8140/T8142, though, and that decides which rows it needs. On M1–M4 and T6050, every RTKit (DCP, SMC, ANS, AOP, PMP, SIO, ISP, AVE…) now goes through the deferred echo path (oslog_owed, with the polled-idle shortcut) instead of the old direct send. It also echoes words that used to be dropped: words with no mapped or inherited buffer, and words with bits 55:32 set, which used to log "invalid oslog notification". The J700 row covers the G17 half. The RTKit half needs, at the merged head, one s2idle-capable Mac of another generation with no new RTKit warnings, a few s2idle cycles, and NVMe, SMC and display healthy after wake: J414s (M2 Pro) and J773g (M4) are the closest, and J516s if its slot frees up.
The branch also conflicts with main and needs a forward merge first.
main moved the buffer and syslog resets in apple_rtkit_reset_session() under "if (!keep_buffers)" and resets oslog_inherited there too. This branch removes that field, so the merge keeps main's block without the oslog_inherited line. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Forward-merged main ( Checked at
Still needed before merge, per the approval: the RTKit half needs an exact-head row on another generation, since every RTKit now takes the deferred echo path. That row is a few s2idle cycles with no new RTKit warnings, and NVMe, SMC and the display healthy after wake, on J414s (M2 Pro, T6020) and J773g (M4, T8132). The Neo row at Full host suite, |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Reviewed at 4971a29aa4cb, merged cleanly into main 3bee58a9c408. Main has moved to b47fc630 since, but none of its new commits touch this PR's files.
- Merge resolution. I compared both sides line by line. The PR's changed lines at
4971a29a(against1b95b711) match its changed lines atf6fac68b(against its basefcb12427) in every file. The only difference is the indentation of the removedrtk->oslog_inherited = false;, which main had moved into its newif (!keep_buffers)block. Nothing from main was dropped:keep_buffersandapple_rtkit_reinit_retaining_buffers(), the handshake deadline,rx_heldand the mailbox status are all intact. - Deferred echo on every RTKit. Main's newer users still behave:
apple_rtkit_v27_rx_drained()now also waits for an owed counter on every SoC. The counter is recorded in the same receive path that queues the work it's counted in, so drained timing doesn't change.- The polled idle paths (
apple_rtkit_sleep_idle_polled(),apple_rtkit_polled_begin()) now echo an owed counter off T8140/T8142 too, as the PR text says. - Main's
set_oslog_echo(true)calls in SIO, DCP andrtkit-helperare now redundant but harmless. They can go in a follow-up.
- Checked on pc at the merge:
W=1LLVM arm64 builds ofrtkit.o,apple-sio.o, everyrtkit.huser (DCP, SMC, NVMe, AOP, PMP, ATC/USB2 PHYs, dockchannel, Thunderbolt, ANE) and the asahi module: no new warnings against main.- Host tests in the CI container:
--only rtkit28/28 (with the five mutants),cio5/5,display-sleep1/1,apple-dcp1/1 andg17-333/333. All match main. - checkpatch
--strict: both commits clean.
Verdict: MERGE at 4971a29
Before merge: hosted CI green at this head, the RTKit rows (J414s and J773g: a few sleep cycles with no new RTKit warnings, and NVMe, SMC and the display healthy after wake), and an approval from someone who didn't push the last commit. The Neo row at f6fac68b covers the G17 half.
|
J773g (Apple M4 Mac mini, T8132, firmware 27.2) receipt at exact head
|
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.