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>
Contributor
|
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
Contributor
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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. One
function in
drivers/soc/apple/rtkit.c; it applies to every RTKit client on every SoC.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.
display-sleep-merge-tests.py, and the apple-dcpordered-rxfixture) get a stand-in forapple_rtkit_ep7_served(); both pass.run-host-tests.pyin the build VM: 451 of 451 pass on the base, 453 of 453 with this change (the new test andits
--old-refrun are the 2 added).alone: one boot each through the 27.2 firmware, default kernel command line, read-only root. Both boot. The same
co-processors come up on both: SMC, NVMe, both DCPs, both AVD decoders. The AOP doesn't start on either (the same
timeout on the base: integration doesn't yet bring up the J775D's AOP), and integration has no J775D GPU node yet.
Failed units: 2 on both, the same two. Kernel errors at err level and above: the same lines on both. ALARM has
no SELinux, so there is no AVC count.
removed and added again: on 6 of 8 boots without this change 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.
the boot with this change, nor on the daily-kit boot.
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)