Skip to content

soc: apple: rtkit: echo OSLOG counters on every RTKit and every G17 GPU - #3384

Open
RyanTheTide wants to merge 2 commits into
mainfrom
sweep/rtkit-oslog-v2
Open

RyanTheTide wants to merge 2 commits into
mainfrom
sweep/rtkit-oslog-v2

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Supersedes #2412. That branch merged integration/aurora, so it no longer merges into main cleanly. This is the same change ported onto main, with the review's blocker folded in: no per-SoC oslog_echo switch, and every G17 GPU coprocessor follows the RTKit default.

Problem

On main the RTKit OSLOG counter echo is chosen by machine:

  • __apple_rtkit_init() turns the echo on only for apple,t8140 and apple,t8142.
  • With the echo off, apple_rtkit_oslog_unanswered() drops the counter on those two machines and on apple,sync-syslog-ack nodes. 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.
  • The G17 driver turns the echo off on every GPU coprocessor (g17/mod.rs, receiver.set_oslog_echo(false)).

Change

Commit 1 (drm/asahi: g17): the GPU coprocessors follow the RTKit echo default. The set_oslog_echo(false) call goes, and there is no per-SoC Config field. 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() and apple_rtkit_oslog_echoed() are removed, together with the old acknowledgment branch, APPLE_RTKIT_OSLOG_LOG_RESERVED and oslog_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.py and the apple-dcp boot.py selftest 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). main already has both. pmp_ca_event_ack is set from apple,t6050-pmp-v2 alone, and sio_t6050_board() uses apple_t6050_sleep_described(). The hw/*.rs oslog_echo initialisers that the review flagged never landed on main, so there is nothing to drop there.

Per-SoC effect
  • T8140, T8142: every RTKit except the GPU sends the same bytes as before (the echo was already on). The GPU coprocessors now echo their counters. This is the row owed below.
  • T6040, T6041, T6050 (G17 coprocessors, DCP, SMC, ANS, AOP, MTP, SIO, PMP, ISP, AVE): these used to get the checked acknowledgment and now get the echo, which is the same message. Edge cases:
    • A counter with no negotiated or inherited buffer, or with bits 55:32 set, is now echoed. Before, it was dropped with a warning.
    • If two counters are queued before the receive work runs, only the newer one is echoed. The counter is cumulative, so that echo covers both.
    • A polled idle echoes an owed counter, as on T8140.
  • T8103, T8112, T600x, T602x, T603x, T8122 (except its dcpext): same as above.
  • T8122 dcpext (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. Also rtkit-v27-late (3/3), display-sleep-merge (1/1), cio (5/5) and cio-native (1/1), which extract rtkit.c too.
  • tools/testing/selftests/drivers/gpu/apple-dcp/run.sh --group boot: 6/6, including oslog-events. --group edid: 4/4.
  • scripts/checkpatch.pl: clean on both commits.
  • rustfmt --check clean on g17/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.

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]>
@RyanTheTide
RyanTheTide requested review from a team and DjDeveloperr as code owners November 27, 2026 13:04
@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:m4 Macs affected, from Merge risk (bot) blast:m5 Macs affected, from Merge risk (bot) blast:neo Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Merge readiness at f6fac68b: not ready yet

Check Detail
CI at head no failing: pr-text / pr-text, KUnit asahi, KUnit spi-hid-apple, KUnit avd, KUnit ave, KUnit isp
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok in the PR body at f6fac68b
Conflicts no merge conflicts with main: merge it in (no force push)
PR text ok 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.

Areas: area:gpu, area:platform

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions github-actions Bot added blast:all Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) and removed blast:m4 Macs affected, from Merge risk (bot) blast:m5 Macs affected, from Merge risk (bot) blast:neo Macs affected, from Merge risk (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 27, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

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 apple_rtkit_oslog_rx, so every "oslog counter ..., echoed" line shows. 30 min idle, sampled every 5 min, then s2idle x3 (rtcwake -d rtc0 -m freeze -s 20).

t0 5m 10m 15m 20m 25m 30m after s2idle 1/2/3
counters echoed (MTP) 0 1 1 2 2 3 3 3 / 3 / 3
echo failures / dropped counters / RTKit errors / GPU fw crashes 0 0 0 0 0 0 0 0
  • s2idle: 3/3 rc=0. Each cycle really suspended: PM suspend entry/exit x3, about 20 s of wall time not counted in monotonic time. Network answered after each wake.
  • G17 capacity read crashed=0 throughout.
  • The only RTKit lines were the known "crashlog endpoint not in the endpoint map" notices.

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 dyndbg="func apple_rtkit_oslog_rx +p" on the command line, so boot-time messages were included. That boot also ran dEQP-VK smoke and glmark2.

  • From boot: OSLOG setup messages came from SMC (4), AOP (10) and both DCPs (4 each).
  • Nothing at all came from 482600000.gpu: no setup messages and no counters.

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:

  • 0 failed units, Enforcing, 0 AVC denials, 0 oopses, 0 err-level kernel lines.
  • eDP connected, Wi-Fi up, aurora bound.
  • dEQP-VK api.smoke.* 8/8 and draw.renderpass.simple_draw.* 4/4, both boots.
  • glmark2 off-screen 9986 / 10244. gpubench quick set rc=0.

The Neo was restored to fleet89 and verified: saved entry unchanged, next_entry empty, test kernel removed.

Evidence (lab store): traces/kernel/20261128-fixa5-rows/neo/ (B1-oslog.txt, B1-oslog/, B1-journal-k.txt, oslog-boot/). Scripts: kits/test/20261128-fixa5/{oslog.sh,neo-row.sh,neo-oslog-boot.sh}.

@github-actions github-actions Bot added the ci-failing A check failed at the PR head (bot) label Nov 27, 2026
@aurora-silicon-review
aurora-silicon-review Bot dismissed their stale review December 1, 2026 05:07

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

@github-actions github-actions Bot added the merge-conflict Conflicts with the base branch (bot) label Dec 1, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gpu Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:all Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) merge-conflict Conflicts with the base branch (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant