Repository navigation
Conversation
|
The CLPC side and the DT hook look right:
Assisted-by: LLM (Claude:Opus 5.5) |
15d7b93 to
75e26d8
Compare
|
@RyanTheTide thanks. All three points are in
J873g, the run you asked for. asyncbench with 1M triangles a frame gives ~48 ms jobs. A sampler read the CLPC debugfs status every 2 ms, and I counted the middle 80% of each run. Three runs each:
At 48 ms the CLPC's own 32 ms hold covers most of the gap the old code left: the request dropped 16 ms into the job. That is why DCS rarely fell. A job longer than ~48 ms would lose the floor for the rest of its run. I couldn't make that longer job here: scenes of 1.15M triangles and up don't complete on G18 (host watchdog, recovery, EIO). That looks like a parameter buffer limit, unrelated to this PR, and I'm looking into it separately. 20000 triangles a frame is unchanged at 761 against 759 fps. After a run the request is released ( Checks: W=1 build of |
|
Checked 75e26d8. All three points are covered. The job guard holds the floor for the whole wait on every exit path, and the idle work drops it only with Assisted-by: LLM (Claude:Opus 5.5) |
75e26d8 to
700b583
Compare
|
I rebased this onto integration/aurora
Assisted-by: LLM (Claude:Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Pre-PR checklist review at 700b583abf77 (§1–§6). The CLPC side (apple_clpc_hw_t8152.gpu_input, apple_clpc_gpu_get()), DT hook (apple,clpc = <&clpc>), and the long-job / mutex / teardown fixes from @RyanTheTide's earlier pass look good, and all 8 CI checks are green. Requesting changes for two real bugs on the G18 side, a Kconfig hazard, and a §5 evidence gap:
Blockers
-
Rust lifetime soundness hole (
drivers/gpu/drm/asahi/g18/demand.rs:35-65):
G18Demand::job(&self) -> G18DemandJobis a safe function returningG18DemandJob(Option<NonNull<c_void>>)with no lifetime tied to&self, whileG18DemandJob::dropcallsunsafe { g18_demand_end(demand.as_ptr()) }relying only on a comment that no guard outlivesG18Demand. Safe code can dropG18DemandbeforeG18DemandJob, causing a use-after-free. Tie the guard to&selfwith a lifetime (pub(crate) struct G18DemandJob<'a>(Option<NonNull<c_void>>, PhantomData<&'a G18Demand>);andpub(crate) fn job(&self) -> G18DemandJob<'_>), matchingM5ClpcBusy<'a>indrivers/gpu/drm/asahi/m5/drm.rs:137. -
Swallowed
-EPROBE_DEFER(drivers/gpu/drm/asahi/g18/demand.c:49-59,drivers/gpu/drm/asahi/g18/boot/mod.rs:2019):
apple_clpc_gpu_get()returns-EPROBE_DEFERwhenapple-clpchas not probed yet (after adding aDL_FLAG_AUTOREMOVE_CONSUMERdevice link if the provider device already exists in OF).g18_demand_get()swallows-EPROBE_DEFER, logsG18: no CLPC GPU input: -517, and returnsNULL— permanently disabling the CLPC floor for the entire boot wheneverauroraprobes ahead ofapple-clpc(which is non-deterministic when both are modules, as in your own test setup, or ifapple-clpcdefers). Becauseg18/boot/mod.rs:2137(no_probe_defer) turnsEPROBE_DEFERfromstage_firmware()intoENODEVto avoid repeating PSD/SGX reads or stranding a session, acquire the CLPC handle beforeprepare_t8152_device()/ firmware start and propagate-EPROBE_DEFERcleanly (matchingM5ClpcInput::new()inm5/drm.rs:89andasahi_g16_clpc_gpu_get()ing16/glue.c:346). -
Kconfig build-combination gap (
drivers/gpu/drm/asahi/Kconfig:50):
UnlikeDRM_ASAHI_G16(depends on APPLE_CLPC=y || APPLE_CLPC=DRM_ASAHI || APPLE_CLPC=n),DRM_ASAHI_G18has noAPPLE_CLPCreachability dependency. WithCONFIG_DRM_ASAHI=yandCONFIG_APPLE_CLPC=m,IS_REACHABLE(CONFIG_APPLE_CLPC)silently compilesg18/demand.cagainst the-ENODEVstub and drops the floor.
Checklist summary (§1–§6)
- §1 No model gating: Pass — uses DT
apple,clpcphandle and.gpu_input = truematching T8142; no-op without a provider. - §2 Production-ready / code: Blocked by items 1–3 above.
- §3 Safety: Pass.
- §4 Clean-room & attribution: Pass — human commits and
Signed-off-byonly,Assisted-by:at end of PR body. - §5 Evidence: Needs completion — the J873g interleaved A/B and 48 ms mid-job CLPC rows are good, but please add a §5 regression run (0 SELinux denials, 0 failed units, 0 new kernel errors) and note conformance unchanged for the +34% GPU throughput claim after the fix on the live head.
- §6 Naming: Pass.
Assisted-by: LLM (Gemini 4 Neon)
700b583 to
74de19f
Compare
|
@DjDeveloperr all three code points are fixed. New head
Also fixed: the Checks:
The §5 rows on this head (regression counts and conformance unchanged for the throughput claim) come with the J873g runs in progress. Assisted-by: LLM (Claude:Opus 5.5) |
|
Re-checked 74de19f (commit 3 only). The One case to confirm: a tree whose Assisted-by: LLM (Claude:Opus 5.5) |
The T8152 CLPC raises the memory controller (DCS) and fabric floor only for busy CPU clusters. GPU work alone leaves both at their lowest states, so on the J873g (Mac mini M6) a GPU-bound render ran a third slower than it can, and faster the more CPU time the G18 driver's own job waits used while polling: polling made a CPU cluster busy, which raised the floor for the GPU as a side effect. Take GPU input on T8152 as on T8142: while the GPU driver reports work in flight (apple_clpc_gpu_get(), apple_clpc_gpu_set_active()), both rails go to the top of the map, DCS 7 and fabric 4. Accept the T8152 CLPC in apple_clpc_gpu_get(). A provider node the tree disables never gets a device that binds, so apple_clpc_gpu_get() returns 0 for it (no input) rather than -EPROBE_DEFER: a GPU that defers on the CLPC would otherwise wait forever. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Name the T8152 CLPC as the GPU's host performance controller (apple,clpc), as the J813 does, so that the GPU driver can report its work in flight and get the memory controller and fabric floor while it has some. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The G18 backend never told the CLPC that the GPU was busy, so on the J873g the memory controller and fabric floor followed the CPU clusters alone. A GPU-bound render then ran faster the more CPU time the job wait used, and any change that made the wait cheaper made the GPU slower. Report work in flight through the CLPC's GPU input, as the G17 backend does. Each job wait holds the request from the job's start until it ends, on every path out of the wait. The request is dropped 16 ms after the last job ended (a delayed work item), so frame-paced clients keep the floor between frames and an idle GPU releases it. A mutex orders the request against that work, which drops it only while no job runs. The work is cancelled and the CLPC reference put when the last holder of the handle drops it: the session, or a job guard, which keeps its own reference. Without an apple,clpc provider nothing changes. The handle is taken at the start of the probe, before any GPU access. A CLPC that has not probed yet defers the probe there (-EPROBE_DEFER), instead of the GPU running without the floor for the whole boot; later in the probe a deferral can no longer be repeated safely. DRM_ASAHI_G18 depends on APPLE_CLPC being reachable from the driver, as DRM_ASAHI_G16 does. On the J873g (asyncbench, polling job waits, four interleaved rounds on one boot), with the floor against without it: - 20000 triangles per frame: 789 against 585 frames/s - 200 triangles per frame: 1847 against 1636 frames/s - 20000 triangles plus 2 ms of application CPU work: 490 against 488 (CPU-bound, as expected) With 48 ms jobs (1M triangles a frame) the request stays on for the whole run, sampled every 2 ms. When it was refreshed only at a job's start and end, it was off for 54-62% of those samples. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
DjDeveloperr
left a comment
There was a problem hiding this comment.
Pre-PR checklist re-review at 74de19fcca8484e886d743b5c0ac380b5ddc95b8 (§1–§6). All three prior code blockers are cleanly fixed with no new code bugs found; holding approval only for §5 live-head hardware rows and the 3 in-progress CI checks.
Prior Blockers Resolved
- Rust lifetime soundness (
drivers/gpu/drm/asahi/g18/demand.rs): Fixed cleanly viaOption<Arc<Handle>>.G18Demand::job()increments the active job count and clones theArc<Handle>intoG18DemandJob;G18DemandJob::drop()runsg18_demand_end()before dropping itsArc, andHandle::drop()runsg18_demand_put()(cancel_delayed_work_sync()->apple_clpc_gpu_put()->mutex_destroy()->kfree()) only once the last holder drops. Safe code can dropG18DemandandG18DemandJobin any order without UAF, and a failedArc::new()dropsHandlecleanly without leaking. Theimproper_ctypeswarning is also resolved. - Swallowed
-EPROBE_DEFER(g18/demand.c,g18/probe.rs): Fixed cleanly.g18_demand_get()propagates-EPROBE_DEFERand-ENOMEMdirectly (falling back to*out = NULLonly for non-deferral refusal/absence), andG18Demand::new(pdev.as_ref())?runs at the start ofprepare_t8152_device()before any PSD/SGX/DMA/firmware access orno_probe_defer, propagating cleanly out ofAsahiPlatformDriver::probe_g18(). Both application graphics (boot/session.rs) and compute (boot/compute_session.rs) go throughwait_job(). - Kconfig dependency (
drivers/gpu/drm/asahi/Kconfig):DRM_ASAHI_G18now hasdepends on APPLE_CLPC=y || APPLE_CLPC=DRM_ASAHI || APPLE_CLPC=n, matchingDRM_ASAHI_G16.
(Non-blocking note on @RyanTheTide's disabled-node question: apple_clpc_gpu_get() in drivers/soc/apple/clpc.c indeed omits an of_device_is_available(np) check before of_find_device_by_node(np), which is pre-existing across all SoCs and &clpc is enabled on t8152-j873; not a blocker for this PR.)
Checklist & Live Status
- §1 No model gating: Pass.
- §2 Production-ready / code: Pass (0 code blockers).
- §3 Safety: Pass.
- §4 Clean-room & attribution: Pass — all 3 commits (
905a71f5,a860f750,74de19fc) carry human author/committer and humanSigned-off-by:only; PR body includesAssisted-by:. - §5 Evidence (holding): Waiting for the J873g live-head
74de19fcregression run (0 SELinux denials,0 failed units,0 new kernel errors) and conformance-unchanged note for the +34% throughput claim. - §6 Naming: Pass.
- CI (at
74de19fc): 5/8SUCCESS(source,rust-build,DWC3/ATC builtin-no-atc,DWC3/ATC modular-no-atc,DWC3/ATC builtin-modular-atc); 3/8IN_PROGRESS(dt-checks,host-tests,kunit).
Ready to approve once the remaining 3 CI checks finish green and the §5 J873g rows on 74de19fc are attached.
Assisted-by: LLM (Gemini 4 Neon)
74de19f to
e6d9b74
Compare
|
@RyanTheTide Confirmed, and fixed. A provider node with
New head Assisted-by: LLM (Claude:Opus 5.5) |
|
Confirmed at e6d9b74: Assisted-by: LLM (Claude:Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Pre-PR checklist re-review at e6d9b740489191407db23031b86c2c90624a239d (§1–§6). The new disabled-provider fix in commit 1 is clean and all 8/8 CI checks are green; 0 code/policy/attribution/CI blockers. Holding APPROVE solely for the pending §5 J873g live-head hardware rows.
New Commit Delta Verified (03aecd64baba)
drivers/soc/apple/clpc.c:319-322(apple_clpc_gpu_get()): Placingif (!of_device_is_available(np)) { of_node_put(np); return 0; }immediately after the compatible check cleanly prevents infinite-EPROBE_DEFERwhenapple,clpcpoints to astatus = "disabled"node, preserves-EINVALfor non-CLPC phandles, releasesnp, and leaves*out == NULL(initialized at function entry) so callers run without the floor. Commits 2 (ef7f545f79aa) and 3 (e6d9b7404891) are unchanged.
Checklist & Live Status
- §1–§3, §6: Pass (0 code blockers).
- §4 Attribution: Pass — all 3 commits (
03aecd64baba,ef7f545f79aa,e6d9b7404891) carry human author/committer (Thomas Glanzmann <thomas@glanzmann.de>) and humanSigned-off-by:only; PR body includesAssisted-by:. - CI (at
e6d9b7404891): 8/8COMPLETED / SUCCESS(dt-checks,host-tests,source,rust-build,kunit,DWC3/ATC builtin-no-atc,DWC3/ATC modular-no-atc,DWC3/ATC builtin-modular-atc). - §5 Evidence (holding): Ready to approve once the queued J873g live-head
e6d9b740rows land (regression counts0 SELinux denials / 0 failed units / 0 new kernel errors, conformance unchanged for the +34% GPU throughput claim, and the disabled-provider check).
Assisted-by: LLM (Gemini 4 Neon)
|
@DjDeveloperr @RyanTheTide the J873g rows at Build.
Regression (both boots):
A: CLPC linked.
Disabled provider (B).
asyncbench, frames/s, 3 rounds:
In B the whole CLPC is gone, the CPU inputs too, so B is the "no floor at all" case, not just "no GPU input". Conformance unchanged. On boot A, with the same caselists as the base rows on this M6 earlier today (
The 6 fails are the Assisted-by: LLM (Claude:Opus 5.5) |
On the J873g (Mac mini M6), GPU-bound rendering runs about a third faster with this PR: the G18 GPU driver now reports its work to the CLPC, as the G17 backend does on the M5.
Problem
The T8152 CLPC raises the memory controller (DCS) and fabric floor only for busy CPU clusters. It takes no GPU input, and the G18 backend reports none, so GPU work alone leaves both at their lowest states. GPU throughput then depends on how much CPU time the driver's own job waits use:
Change
gpu_input), as T8142 does. While the GPU driver reports work in flight, both rails go to the top of the map (DCS 7, fabric 4).apple_clpc_gpu_get()accepts the T8152 CLPC.apple,clpc = <&clpc>), as the J813 does.apple,clpcprovider nothing changes.Testing
Throughput on the J873g.
asyncbenchis a surfaceless EGL loop: N triangles into an FBO, optional CPU work, then a flush, with at most two frames in flight. Four interleaved rounds ran on one boot, with the floor against without it:The last row is CPU-bound, so it doesn't change.
This exact code on the J873g:
aurora.koandclpc.ko.host_gpu: active 1, floor0x47(DCS 7, fabric 4), reason bitscpu|host_gpu.Checks:
clpc.oandg18/demand.ogives no warnings.apple-dt-check.shagainstb4cd7b3e15f4: 0 new and 0 removed warnings, 138 DTBs.tools/asahi/run-host-tests.py: 450/451. The one failure is the GCC 16pmp-floor-tests --mutant class-twicecase, which doesn't compile with the host compiler and is unrelated.Not in this PR
I also tested two other changes on the J873g. Neither helped, so neither is here:
apple_mailbox.ascwrap_v8_rx_irq=1. It saves CPU time but loses 2–7% throughput: the message arrives a few tens of microseconds before the last retirement words, and the CPU clocks down while it sleeps.cc @DjDeveloperr @RyanTheTide @Acelogic @LiamRay10
Assisted-by: LLM (Claude:Opus 5.5)