Skip to content

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

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

RyanTheTide wants to merge 4 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 <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>
@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 72580bd6: not ready yet

Check Detail
CI at head running running: apple-build, host-tests, pr-text / pr-text, KUnit plan
Review no needs one approving review from Core, Omarchy Mac or Aurora Maintainers (not the author)
Requested changes ok none
Hardware row at head no no line with the head SHA 72580bd6, a Mac and a result in the PR body or a comment
Conflicts ok not computed yet
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 removed the needs-hw-row No hardware row at the PR head (bot) label Dec 2, 2026
@aurora-silicon-review
aurora-silicon-review Bot requested review from DjDeveloperr, maralcbr and satchlj and removed request for DjDeveloperr, joshuaswarren and satchlj December 3, 2026 04:32
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Hardware verification (J414s / M2 Pro, T6020, exact head 4971a29aa4cb)

Ran the sealed J414s #3384 + #3310 kit (work/j414s-linux3384-3310-row-20261203, SHA256SUMS verified) on MacBook Pro 14-inch M2 Pro (J414s, Mac14,9, SoC T6020, OS firmware 27.2 mBoot-20457.41.3, Fedora 45, boot.bin sha256 196da4c69088... identical on both arms).

  • Base arm: 7.3.0-g14s272-fb5b5f56, boot_id=6cdd657d-111a-4447-9275-dbf344fdc14b, build ID 69fb198ff7a0917fc22f75fb3989199c99defbc3 (main c09b61228e62 + #3998 fb5b5f56cc01).
  • Head arm: 7.3.0-g14s272-rk3384d3310, boot_id=f5526d38-e377-4c6a-ade6-30cecaecc648, build ID 3bfaf28fcd87fa2827acc465ef8f14180ff54603 (base + clean merge of #3384 4971a29aa4cb and #3310 e0de694cc997, commit edc7818d6f98, tree 1174e9ca42fb).

Results (PASS for #3384 OSLOG echo + RTKit/system health)

  • Live OSLOG echo verified on head (dyndbg func apple_rtkit_oslog_rx +p):
    • Base: 0 oslog counter ... echoed lines.
    • Head: 1 live line during sleep/wake: rtkit-helper 2a9400000.mtp: RTKit: oslog counter 0200000000003195, echoed.
  • Sleeps (3/3 rtcwake -d /dev/rtc0 -m freeze -s 20 on both arms):
    • Base: 3/3 (0 0 -> 1 0 -> 2 0 -> 3 0, boot same, 28–29 s).
    • Head: 3/3 (0 0 -> 1 0 -> 2 0 -> 3 0, boot same, 29 s).
  • Health before and after every sleep on head:
    • nvme_io_512MiB (O_DIRECT write + readback SHA-256): 4/4 PASS (8bd57517...).
    • smc_battery (100 %), smc_hwmon (24 sensors), display_panel (connected enabled On), compositor (plasmalogin), wifi (wld0, 4/4 0 % loss on head): all PASS.
    • gpubench-vk --verify (render.light, compute.light, copy.bw): 12/12 valid CRC PASS on both arms.
    • Display DPMS (kscreen-doctor --dpms off/on): PASS dpms Off On on both arms.
  • Kernel log comparison (judge.py compare): 0 DART/RTKit errors, 0 new RTKit or DART lines on head vs base, 0 new warning-level lines, 0 WARN/BUG/RTKit crashes, 0 new failed systemd units.
  • Automated judge.py caveats (explicitly reported, non-kernel):
    • Head inventory-0.txt vs inventory-1..3.txt flagged by judge.py: Bus 001/Bus 002 Linux xHCI 2.0/3.0 root hubs appeared after sleep 1 (Type-C host role negotiation on the lab cable) and stayed identical across sleeps 1–3; lspci -n was 100% identical across boot and all 3 sleeps.
    • Base arm had 3 % and 8 % Wi-Fi ping loss after sleeps 1 and 2 on the lab AP (0 % across all 4 checks on head).

@aurora-silicon-review
aurora-silicon-review Bot requested review from maralcbr and satchlj and removed request for maralcbr and satchlj December 3, 2026 21:02

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The receive worker and polled idle use the same echo selection. The synchronous external DCP exception remains, and reset preserves the existing retained-buffer behavior. The J414s and J773g receipts cover shared RTKit and wake. The older J700 test saw no GPU counter, so please capture a live G17 counter and its echo during a current-head soak. A non-pusher approval is still due. On main 16a732e, ARM64 W=1 linked Asahi and built rtkit.o, and the RTKit suite passed 28/28.

@aurora-silicon-review
aurora-silicon-review Bot requested review from DjDeveloperr, maralcbr and satchlj and removed request for DjDeveloperr, maralcbr and satchlj December 4, 2026 13:22

@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.

Verdict: MERGE at 4971a29

Checked: The receive worker and polled receive use the same echo policy. The synchronous external DCP retains its no-echo default, and retained-buffer reset still follows the base. The OSLOG control suite passed 1,710 cases at this head and caught all five supplied mutations. Hosted Apple build, host tests, and KUnit passed.

The earlier review identified the expanded acceptance of type-2 counters. I confirmed the echo sends the word unchanged and never uses the channel bits or count to access the buffer. Dj's J414s comparison observed a live MTP echo, passed 3/3 sleeps in each arm, and reported zero new RTKit or DART errors. The J773g receipt also passed. The Neo receipt observed no GPU counters, so it covers GPU regression smoke and MTP echo.

@github-actions github-actions Bot added the merge-conflict Conflicts with the base branch (bot) label Dec 5, 2026
Resolve conflict in tools/asahi/rtkit-oslog-tests.py by keeping main's
IOReport reset state fields (ioreport_lock, ioreport_state_lock,
ioreport_state) alongside this branch's removal of oslog_inherited.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Forward-merged main (7b10eb104ce6) into sweep/rtkit-oslog-v2 as 72580bd6f733 (plain merge commit, no rebase/force-push).

Resolved the one conflict in tools/asahi/rtkit-oslog-tests.py by keeping main's IOReport reset state fields (ioreport_lock, ioreport_state_lock, ioreport_state) while keeping this branch's removal of oslog_inherited.

Verified locally:

  • ARCH=arm64 LLVM=1 compiled drivers/soc/apple/rtkit.o and drivers/gpu/drm/asahi/asahi_core.o cleanly
  • tools/asahi/rtkit-oslog-tests.py: 1710/1710 controls PASS
  • tools/testing/selftests/drivers/gpu/apple-dcp/run.py --group boot: 6/6 PASS

@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Dec 5, 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) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (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.

2 participants