Repository navigation
Conversation
…ask for them The endpoint map starts endpoint 7 only for clients that set APPLE_RTKIT_NEEDS_COREANALYTICS and for registry-v2 PMP firmware, but apple_rtkit_rx_dispatch() hands every other endpoint-7 message to apple_rtkit_coreanalytics_rx(). Any co-processor's buffer request is therefore allocated, zeroed and kept until the session is torn down, at whatever size the request names (up to 255 MiB), although nothing on the host reads that buffer for it. Decide this once: apple_rtkit_ep7_served() is the one predicate the endpoint map and the dispatcher both use, so the endpoint is served exactly for the clients it is started for. A message there from any other co-processor is reported as one to an unknown endpoint, as the debug endpoint already is without sync_syslog_ack. Clients that ask for CoreAnalytics, today the PMP, and the registry-v2 auxiliary buffer are handled as before. This applies to every RTKit client on every SoC. The new host test, tools/asahi/rtkit-coreanalytics-tests.py, compiles the dispatcher and the CoreAnalytics handlers from this file and checks both sides; the code before this change allocates for a client that did not ask. The two host tests that compile the dispatcher with stand-ins get one for apple_rtkit_ep7_served(). Fixes: 2aff1b9 ("soc: apple: rtkit: describe and adopt retained system buffers") Reported-by: Erik Bourget <erik@ebourget.net> Suggested-by: Erik Bourget <erik@ebourget.net> Signed-off-by: Jeff Queisser <funkzy@users.noreply.github.com>
|
The change itself is small and the predicate matches what the endpoint map already starts. Notes:
Assisted-by: LLM (Claude:Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Pre-PR checklist review on 5c415384582bc0888c2d1dc443771c9bc7baf831 (CI: 7/7 checks green — host-tests, source, rust-build, kunit, and all three DWC3/ATC builds).
Code Audit
drivers/soc/apple/rtkit.c: Unifying the endpoint 7 predicate intoapple_rtkit_ep7_served()(rtk->pmp_registry_v2 || apple_rtkit_needs_coreanalytics(rtk)) ensuresapple_rtkit_rx_dispatch()serves endpoint 7 strictly for the same clients thatapple_rtkit_management_rx_epmap()starts it for, without breaking adopted sessions (apple_rtkit_mark_running()).- Verified
pmp_ca_event_ackis only ever set whenpmp_registry_v2is true (rtkit.c:2356), soapple_rtkit_pmp_aux_rx()remains reachable for all registry-v2 PMP sessions. - Non-blocking note:
dev_warnon unserved endpoint 7 matchesAPPLE_RTKIT_EP_DEBUGand thedefault:branch right beside it (ratelimiting could be a future hardening follow-up across all three if a co-processor spams unknown endpoints). - Host test fixtures:
tools/asahi/rtkit-coreanalytics-tests.pycompiles the production dispatcher and CoreAnalytics handlers unchanged under ASan/UBSan and catches--old-ref cacf35543b4d; both existing dispatcher fixtures (display-sleep-merge-tests.pyandapple-dcp/run.py) are updated and pass CI.
Pre-PR Checklist (§1–§6)
- §1 No model gating: Pass — no new SoC/board/firmware gates (reuses existing
APPLE_RTKIT_NEEDS_COREANALYTICSandpmp_registry_v2). - §2 Production-ready: Pass — default command line, no hacks.
- §3 Safety: Pass — eliminates unrequested up-to-255 MiB kernel allocations from arbitrary co-processors without introducing hardcoded caps.
- §4 Clean-room & attribution: Pass — human author/committer and
Signed-off-byonly in commit;Assisted-by:disclosed in PR body. - §5 Evidence: Holding for positive-path & multi-generation hardware rows. The stock-base J775D A/B row cleanly proves no regression on non-EP7 clients, but as noted in
## Still to run, we still need:- A PMP hardware row on a Mac running CoreAnalytics /
pmp_registry_v2to prove the served endpoint 7 path is unchanged. - M1–M4 regression row(s) checking
dmesg | grep "unknown endpoint 07"to confirm no co-processor there silently relies on endpoint 7 without settingAPPLE_RTKIT_NEEDS_COREANALYTICS.
- A PMP hardware row on a Mac running CoreAnalytics /
- §6 Naming: Pass.
Zero code, policy, or CI blockers — holding as COMMENT only for the remaining §5 PMP positive-path and M1–M4 hardware rows.
Assisted-by: LLM (Gemini 4 Neon)
…t flood the log Since the previous commit, an endpoint-7 message from a co-processor that did not ask for CoreAnalytics is reported as one to an unknown endpoint instead of being acknowledged silently. How often such a message arrives is up to the firmware: one that sends CoreAnalytics events periodically would log a warning per event. The same holds for every warning the receive path prints about a firmware message. The dispatcher printed the unknown-endpoint warning in three places (the debug endpoint without sync_syslog_ack, endpoint 7 when not served, and any other endpoint); they now share apple_rtkit_unserved_ep_msg(). That helper, the receive path's "Message from undiscovered endpoint" warning (printed for the same kind of message on an adopted session) and the per-endpoint warnings for a message the handler doesn't know (management, CoreAnalytics, crash log, ioreport, syslog, oslog, and an application endpoint with no receiver) all use dev_warn_ratelimited(), as the kdebug and syslog-record warnings already did, and the registry-v2 PMP's "refused auxiliary buffer request" error uses dev_err_ratelimited(). Warnings about what the AP sends, and the endpoint map's one-time report of an unknown system endpoint, are unchanged. Only logging changes. rtkit-coreanalytics-tests.py now checks that an unserved endpoint-7 message, and a message to a system endpoint nobody serves, go through the shared warning. The host tests that compile these functions with stand-ins (display-sleep-merge, rtkit-oslog, apple-dcp ordered-rx and oslog-events) get dev_warn_ratelimited() or a stand-in for the helper. Suggested-by: Ryan Murray <ryan@aurorasilicon.org> Suggested-by: DjDeveloperr <hey@djdev.me> Signed-off-by: Jeff Queisser <funkzy@users.noreply.github.com>
|
Thanks, Ryan and dj.
Assisted-by: LLM (Claude:Opus 5.5) |
|
Thanks. Re-checked at d91a256. The first commit is unchanged (same SHA), so this is only about the new one.
The code looks good to me. Only that row is left. Assisted-by: LLM (Claude:Opus 5.5) |
|
Not on integration/aurora yet: on daa9e2d the dispatcher still hands every endpoint-7 message to the CoreAnalytics handler. Both commits apply cleanly on daa9e2d, and the host tests that compile this code pass on that tree: run-host-tests.py --only rtkit 17/17 (including rtkit-coreanalytics-tests and its --old-ref run), display-sleep-merge 1/1, and the apple-dcp boot group 4/4. The code review is done on both sides; the remaining item is the M4 Air boot at d91a256 (PMP probe with its CoreAnalytics buffer unchanged, and the adopted MTP session with no "endpoint 07" line and working keyboard and trackpad). |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 pre-PR re-review at d91a256494420f946d29d53943f11ca9c2f6c9a6 (CI: 7/7 green — host-tests, kunit, rust-build, source, and all three DWC3/ATC builds; mergeable=true, clean and not superseded on integration/aurora).
Follow-up Verification (from 5c415384582b)
- Runtime commit
5c415384582bis unchanged (apple_rtkit_ep7_served()unifiesapple_rtkit_management_rx_epmap()andapple_rtkit_rx_dispatch()). - Commit
d91a25649442cleanly consolidates all three unknown-endpoint warnings intoapple_rtkit_unserved_ep_msg()withdev_warn_ratelimited(), rate-limits all firmware-triggered receive-path unknown-message / undiscovered-endpoint warnings (dev_warn_ratelimited()/dev_err_ratelimited()) while preserving exact log strings, and updates all four host-test harnesses (rtkit-coreanalytics-tests.py,display-sleep-merge-tests.py,rtkit-oslog-tests.py, andapple-dcp/boot.py+run.py).
Pre-PR Checklist (§1–§6)
- §1 No model gating: Pass — no new SoC/board/firmware gates (reuses existing
APPLE_RTKIT_NEEDS_COREANALYTICSandpmp_registry_v2). - §2 Production-ready: Pass — default command line, no hacks.
- §3 Safety: Pass — eliminates unrequested up-to-255 MiB kernel allocations from arbitrary co-processors without hardcoded caps, and rate-limits firmware-triggered RX warnings against log flooding.
- §4 Clean-room & attribution: Pass — both commits (
5c415384582b,d91a25649442) carry human author/committer (Jeff Queisser <funkzy@users.noreply.github.com>) and humanSigned-off-by:only, zero AI trailers in commits;Assisted-by:disclosed in PR body. - §5 Evidence: Incomplete (blocking) — see below.
- §6 Naming: Pass.
Blocking Finding
- Missing PMP positive-path and adopted-MTP / M1–M4 hardware rows (§5): The refreshed stock-base J775D A/B row at
d91a25649442cleanly covers non-EP7 co-processors there (SMC, NVMe, DCPs, AVDs), but as noted in## Still to runwe still need before merge:- A PMP positive-path row on a Mac running CoreAnalytics /
pmp_registry_v2(e.g., M4 Air J713 PMP probe) proving the opted-in endpoint-7 buffer allocation and readiness path is unchanged. - An adopted-MTP and M1–M4 regression row (e.g., J713 / J773g / A18 Pro) checking
dmesg | grep -e "endpoint 07" -e "endpoint 0x07", working keyboard/trackpad on adopted MTP, and §5 regression counts (0 SELinux denials, 0 failed units, 0 new kernel errors).
- A PMP positive-path row on a Mac running CoreAnalytics /
Verdict
REQUEST_CHANGES — zero code, logging, test, or CI blockers (all 7 CI checks green at d91a25649442); holding solely for the remaining §5 PMP positive-path and adopted-MTP / M1–M4 hardware row(s).
Assisted-by: LLM (Gemini 4 Neon)
Problem
The endpoint map starts endpoint 7 only for clients that set
APPLE_RTKIT_NEEDS_COREANALYTICSand for registry-v2PMP firmware.
apple_rtkit_rx_dispatch()still hands every other endpoint-7 message toapple_rtkit_coreanalytics_rx(), so a buffer request from any co-processor is allocated, zeroed and kept until thesession is torn down, at whatever size the request names (up to 255 MiB). Nothing on the host reads that buffer for
those clients.
Why this shape
Whether endpoint 7 is in use was decided twice. The endpoint map starts it only for registry-v2 PMP firmware and for
clients that set
APPLE_RTKIT_NEEDS_COREANALYTICS. The dispatcher served it for every client. A narrower alternative,capping the size of a CoreAnalytics request, would bound each buffer, but it would still allocate for clients that
never asked, and it needs a size the hardware does not provide. The change makes both places use one predicate,
apple_rtkit_ep7_served(), so the dispatcher serves the endpoint exactly when the endpoint map starts it. A messageon it otherwise is reported like one to any unknown endpoint, as the debug endpoint already is. The PMP, which asks
for CoreAnalytics, and registry-v2 PMP firmware are handled as before. Every other RTKit client (DCP, SMC, ANS, AOP,
the GPU and the rest) no longer allocates anything for endpoint 7. The predicate is the client's declared need, not "was
the endpoint started": a session taken over from an earlier owner (
apple_rtkit_mark_running()) records no startedendpoints. Which system endpoints a session runs is kept in three lists (the start loop, the dispatcher and
apple_rtkit_mark_running()); one per-endpoint table could replace them, and can follow separately.Change
The endpoint is served only for the clients the endpoint map starts it for: one predicate,
apple_rtkit_ep7_served(), now decides both. A message there from any other co-processor is reported as one to anunknown endpoint, as the debug endpoint already is without
sync_syslog_ack.Clients that ask for CoreAnalytics (today the PMP) and the registry-v2 auxiliary buffer are handled as before. It
applies to every RTKit client on every SoC.
A second commit rate-limits what the receive path prints about firmware messages, so firmware that sends events
periodically cannot flood the log now that unserved endpoint-7 messages are reported. The dispatcher's three
unknown-endpoint warnings (the debug endpoint without
sync_syslog_ack, endpoint 7 when it isn't served, and anyother endpoint) share one helper,
apple_rtkit_unserved_ep_msg(). That helper, the "Message from undiscoveredendpoint" warning and the per-endpoint warnings for a message the handler doesn't know (management, CoreAnalytics,
crash log, ioreport, syslog, oslog, and an application endpoint with no receiver) use
dev_warn_ratelimited(), asthe kdebug and syslog-record warnings already did, and the registry-v2 PMP's "refused auxiliary buffer request"
error uses
dev_err_ratelimited(). Only logging changes.Testing
tools/asahi/rtkit-coreanalytics-tests.py(registered inrun-host-tests.py). It compiles thedispatcher and the CoreAnalytics handlers from
rtkit.cunchanged, under ASan and UBSan. A client that asked gets itsbuffer and its acknowledgements; registry-v2 PMP firmware gets its auxiliary buffer; any other client's request
allocates nothing and gets no reply, at any size. Its
--old-refrun requires the code before this change to fail,and it does: that code allocates for a client that did not ask.
through the shared rate-limited warning.
display-sleep-merge-tests.py,rtkit-oslog-tests.py,and the apple-dcp
ordered-rxandoslog-eventsfixtures) get stand-ins forapple_rtkit_ep7_served(), thehelper or
dev_warn_ratelimited(); all pass.run-host-tests.pyin the build VM, at this head: 451 of 451 pass on the base, 453 of 453 with this series (the new test and its--old-refrun are the 2added). KUnit, built in: 375 of 377 cases pass in 76 suites and 2 skip, the same as the base.
rtkit-ca-endpoint-1(integration/aurora 000ab96 plus both commits ofthis PR, d91a256) against kit
rtkit-ca-endpoint-1b(the same base alone), windowryan2775a@20261122-1147. One boot each through the 27.0 firmware and Aura main dff1235d, default kernel command
line, read-only root. Both boot, and the same co-processors come up on both: SMC, NVMe, both DCPs, both AVD
decoders. Integration doesn't yet bring up the J775D's AOP or GPU.
options it needs (
CRYPTO_USER_API_HASH,CRYPTO_USER_API_SKCIPHER,KEY_DH_OPERATIONS), andsystemd-networkd-persistent-storage because the test boots mount the root read-only.
receiver), 0 new. No WARNING, BUG or Oops. ALARM has no SELinux, so there is no AVC count.
"undiscovered endpoint", on either boot.
trackh-i60(integration/aurora cacf355 plus the first commit,5c41538, only) against kit
trackh-ib(that base alone), through the 27.2 firmware with our daily Aurabuild. Both boot with the same co-processors, the same 2 failed units and the same err-level lines.
removed and added again: on 6 of 8 boots without the first commit and 1 of 3 with it. Both patterns show with and
without it, and no boot sees a message on endpoint 7, so this change takes no different path there; it is probe
order.
drm/asahi: t6050: identify the K114/K116 27.2 (26B8125) G17S firmware (on #1173) #1650 and arm64: dts: apple: t6050-j775d: Give the Mac Studio (M5 Ultra) a working GPU, and its M and P core capacities (754/1024) to the scheduler #1973 for the GPU, and the AOP bring-up) with this change and two other changes of ours (RTKit crash log pages,
GEM_USERPTR accounting), against the same kit without them. The AOP, the GPU and every other RTKit co-processor
come up as on that base. Failed units: 1 on both. Kernel errors: the same lines, plus one USB enumeration retry of the KVM's keyboard receiver on the kit
with the changes. The AOP and GPU lines of this row depend on those carried patches.
as the J775D kernel; no warning in
rtkit.c.--strict: no errors.Still to run
dmesg | grep "unknown endpoint 07", which namesany co-processor there that uses the endpoint without asking for it.
Assisted-by: LLM (Claude:Opus 5.5)