Skip to content

soc: apple: mailbox: drain G17 receive interrupts in hard IRQ - #2980

Merged
DjDeveloperr merged 1 commit into
mainfrom
perf/apple-mailbox-g17-hardirq
Nov 24, 2026
Merged

DjDeveloperr merged 1 commit into
mainfrom
perf/apple-mailbox-g17-hardirq

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

What: ASCWrap v6 GPU mailboxes (APPLE_MBOX_ASCWRAP_V6_ROLE_GFX and ..._GFX1) registered their recv-not-empty interrupt as a pure threaded IRQ, adding an IRQ-thread wakeup to every GPU completion before apple_rtkit_rx() could queue the driver's event work. The receive path is now drained in hard IRQ (apple_mbox_g17_recv_irq()), waking the oneshot thread only when APPLE_G17_MBOX_RX_BUDGET is saturated; ASCWrap v8 (apple,t8152-gfx-ascwrap-v8) stays on apple_mbox_recv_irq() with its storm guard.

Tested: J714s M5 Pro (G17S B1), Aurora 7.3.0 M5 integration test kernel (build 4) with apple_mbox_g17_recv_irq live in /proc/kallsyms: 0 faults/warnings over 402/403 Vulkan CTS, 193/200 occlusion-query CTS and 128/128 OpenGL rows; host completion latency 99.8 → 92.6 us, shallow render submission 70.9 → 61.1 us. Host tests mailbox 2/2, sep-suspend 22/22 pass.

Risk: two-way · Macs with an ASCWrap v6 GPU mailbox: M4 Pro/Max (T6040/T6041), Neo (T8140), M5 (T8142) and M5 Pro (T6050); ASCWrap v8 (T8152) is excluded.

Not yet: a hardware row at the current head; M4 Pro/Max, Neo and M5 (T8142) not run.

Details

All ASCWrap v6 GFX/GFX1 receive handlers already run under spin_lock_irqsave(&mbox->rx_lock, flags) in apple_mbox_poll_locked() and are strictly hard-IRQ safe: apple_rtkit_rx() performs only atomic FIFO/flag checks, GFP_ATOMIC work allocation, queue_work(), and non-sleeping recv_message_early() callbacks (AtomicBool stores, complete_all(), mod_delayed_work_on(), and workqueue enqueue), deferring sleeping RTKit callbacks to rtk->wq.

This change splits the G17 receive path into:

  • apple_mbox_g17_recv_irq() (hard IRQ): drains apple_mbox_poll_locked() and returns IRQ_HANDLED on normal completions.
  • apple_mbox_g17_recv_thread() (oneshot thread): woken via IRQ_WAKE_THREAD only when APPLE_G17_MBOX_RX_BUDGET is saturated, so the flood-throttle sleep and thread-context uclamp adjustment stay off hard IRQ.
  • ASCWrap v8 (hw->is_ascwrap_v8) is excluded from apple_mbox_is_g17(), so v8 keeps apple_mbox_v8_rx_irq_guard().
  • apple_g17_rx_hardirq_dispatch_test KUnit test covering both IRQ_HANDLED and IRQ_WAKE_THREAD dispatch paths, and that ASCWrap v8 GFX/GFX1 mailboxes stay excluded.
Evidence
  • scripts/checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks.
  • Host tests: mailbox (2/2), sep-suspend (22/22) PASS.
  • Live M5 Pro (G17S B1), built into Aurora 7.3.0 M5 integration test kernel build 4, apple_mbox_g17_recv_irq verified active in /proc/kallsyms: 0 faults/warnings across 402/403 Vulkan CTS (synchronization.smoke, synchronization.op.single_queue.barrier, synchronization.op.multi_queue, compute.pipeline.basic), 193/200 occlusion-query CTS, and 128/128 OpenGL rows; host completion latency improved from 99.8 us to 92.6 us and shallow render submission from 70.9 us to 61.1 us.

@DjDeveloperr DjDeveloperr left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Pre-PR Checklist Review (§1–§6) — Changes Needed

Reviewed head: 5555740b417a3586588310d54de3a5e730ae05ce
Live CI: 7/7 checks SUCCESS (host-tests, source, rust-build, kunit, DWC3/ATC builtin-no-atc, DWC3/ATC modular-no-atc, DWC3/ATC builtin-modular-atc; mergeable CLEAN)
Cross-PR conflicts (#2981, #2967, #2968, #2969): None — no other open PR modifies drivers/soc/apple/mailbox.c or drivers/soc/apple/mailbox-g17-test.h.

Blocker — ASCWrap v8 (apple,t8152-gfx-ascwrap-v8) Storm Guard Silently Bypassed

In drivers/soc/apple/mailbox.c:

  1. apple_mbox_probe_ascwrap_v8() (lines 1451–1458) sets mbox->ascwrap_v6.role to APPLE_MBOX_ASCWRAP_V6_ROLE_GFX or APPLE_MBOX_ASCWRAP_V6_ROLE_GFX1.
  2. apple_mbox_is_g17() (lines 540–544) checks only role == APPLE_MBOX_ASCWRAP_V6_ROLE_GFX || role == APPLE_MBOX_ASCWRAP_V6_ROLE_GFX1, so it returns true for every ASCWrap v8 mailbox as well.
  3. apple_mbox_probe() (lines 1654–1660) therefore registers apple_mbox_g17_recv_irq / apple_mbox_g17_recv_thread for ASCWrap v8 instead of apple_mbox_recv_irq.
  4. Unlike apple_mbox_recv_irq() (lines 982–983), apple_mbox_g17_recv_irq() never calls apple_mbox_v8_rx_irq_guard(mbox, consumed).

Impact:

  • The if (mbox->hw->is_ascwrap_v8) apple_mbox_v8_rx_irq_guard(mbox, consumed); check in apple_mbox_recv_irq() is now completely unreachable dead code.
  • If ascwrap_v8_rx_irq=1 is enabled on T8152 (G18), an unpowered PSD (apple_mbox_poll_locked() returns -EHOSTDOWN) or a stuck/miswired level-triggered IRQ will spin infinitely in hard IRQ context instead of disabling the line after APPLE_ASCWRAP_V8_RX_STORM_LIMIT empty hits and falling back to polling — hard-locking the CPU.

Required fix: Either invoke if (mbox->hw->is_ascwrap_v8) apple_mbox_v8_rx_irq_guard(mbox, consumed); under rx_lock in apple_mbox_g17_recv_irq() (all of disable_irq_nosync, dev_err, and queue_delayed_work are hard-IRQ safe) and remove the unreachable branch from apple_mbox_recv_irq(), or exclude mbox->hw->is_ascwrap_v8 from the hard-IRQ split (e.g., gate on apple_mbox_is_g17(mbox) && !mbox->hw->is_ascwrap_v8 if v8 is intended to stay on apple_mbox_recv_irq), and cover the v8 storm-guard path in KUnit.

Hard-IRQ Safety, Locking, Teardown & Non-G17 Audit

  • Hard-IRQ safety (Pass on all ROLE_GFX/ROLE_GFX1 consumers):
    • apple_rtkit_rx() (drivers/soc/apple/rtkit.c:1648-1725) uses only ktime_get_ns(), dma_rmb(), atomic flag/FIFO operations, GFP_ATOMIC allocation, and queue_work().
    • Every recv_message_early() callback reachable via ROLE_GFX/ROLE_GFX1 is hard-IRQ safe:
      • G17 (drivers/gpu/drm/asahi/g17/mod.rs:450): complete_all() + queue_event_records() (RoleState borrows an Arc<Shared> keeping refcount >= 2 so Shared::drop cannot run in hard IRQ).
      • M5 live boot (drivers/gpu/drm/asahi/m5/live_boot.rs:35): AtomicBool::store().
      • G16S / T6040 & T6041 (drivers/gpu/drm/asahi/g16/boot.rs:201): mod_delayed_work_on() on leaked Arc<Shared>.
      • G18 / T8152 (drivers/gpu/drm/asahi/g18/boot/mod.rs:988): AtomicBool::store().
  • Locking / lockdep (Pass): mbox->rx_lock uses spin_lock_irqsave everywhere (including hard IRQ, which also keeps the KUnit process-context call safe); no lock ordering inversions with tx_lock or lifecycle_lock.
  • Flood / livelock bound (Pass for ASCWrap v6): Hard IRQ drains at most APPLE_G17_MBOX_RX_BUDGET (64) messages before returning IRQ_WAKE_THREAD, keeping the level IRQ masked via IRQF_ONESHOT across the 1–2 ms usleep_range() in apple_mbox_g17_recv_thread().
  • Teardown & suspend (Pass): apple_mbox_stop_locked(), apple_mbox_quiesce(), and apple_mbox_suspend_noirq() (apple_mbox_hold_rx()) all use disable_irq() / synchronize_irq(), synchronizing both hard IRQ and thread handlers.
  • Non-G17 Apple mailboxes (Pass): ASC v4, M3, T8140 ASC/AOP, T8152 SMC/AOP, DCP, SEP, etc. remain on apple_mbox_recv_irq() with unchanged runtime behavior.
  • Buildability (=m/=y & KUnit) (Pass): IS_REACHABLE(CONFIG_KUNIT) handles all tristate combinations cleanly; scripts/checkpatch.pl --strict is clean (0 errors/warnings/checks).

Checklist Findings (§1–§6)

  • §1 (No model gating / multi-Mac coverage) — Gaps: apple_mbox_is_g17() also matches T6040/T6041 (M4 Pro/Max, apple,t6040-ascwrap-v6), T8140 (G17P), T8142 (M5 base), and T8152 (G18, apple,t8152-gfx-ascwrap-v8), not just M5/G17 ASCWrap v6. Commit message should reflect the true scope, and runs (or explicit test requests) are needed on the other affected Macs.
  • §2 (Production-ready, no hacks) — Pass.
  • §3 (Safety) — Fail: Blocked by the ASCWrap v8 storm-guard bypass above.
  • §4 (Clean-room & attribution) — Pass: Human author/committer (Diljit Singh <[email protected]>), human Signed-off-by: only, zero AI trailers in commit, Assisted-by: present in PR body.
  • §5 (Evidence) — Gaps:
    1. Missing mandatory regression tuple (0 SELinux denials, 0 failed units, 0 new kernel errors).
    2. Clarify baseline A's exact kernel/commit for the 99.8 -> 92.6 us / 70.9 -> 61.1 us A/B (and whether it isolated #2980 alone), plus confirm 402/403 Vulkan CTS and 193/200 occlusion-query CTS match baseline A unchanged.
    3. Note live non-G17 mailbox regression coverage on the booted Mac (SMC/DCP/SEP/AOP/NVMe alongside the sep-suspend host test).
  • §6 (Naming) — Pass.
  • Minor doc nit: Comments in include/linux/soc/apple/mailbox.h:128-130 and drivers/soc/apple/mailbox.c:915-917 still say the threaded receive handler runs on every message; after this change apple_mbox_apply_rx_util_min() only runs when the flood-throttle thread wakes.

Verdict: Changes Needed — fix the ASCWrap v8 storm-guard bypass and complete the §1/§5 items before MERGETRAIN-LINUX4.

@DjDeveloperr

DjDeveloperr commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Live G17S B1 (Apple M5 Pro) Hardware Verification

Verified on Apple M5 Pro (J714s, G17S B1) running 7.3.0-m5-cdirect5-safe (containing this PR 5555740b417a3586588310d54de3a5e730ae05ce, native 16-plane apple-mcc, and #2981 relaxed M5 command-port MMIO):

  • Hard-IRQ receive path active: apple_mbox_g17_recv_irq verified present in /proc/kallsyms; live GFX/GFX1 ASCWrap v6 receive lines (2302600000.mailbox-recv IRQ 113 / 2302e00000.mailbox-recv IRQ 115) drained >14.7M GPU completion interrupts across the full qualification run with zero flood/stall events and zero kernel warnings.
  • Latency impact (7.3.0-m5-cdirect5-safe vs 7.3.0-m5-cdirect3 on identical efabab3850 userspace):
    • Host fence wait latency (compute round-trip): 99.80 -> 94.34 µs (-5.5%)
    • Cross-queue timeline semaphore hop latency: 20.30 -> 17.91 µs/hop (-11.8%)
    • Cross-queue binary semaphore hop latency: 20.60 -> 18.25 µs/hop (-11.4%)
    • Overall synchronization latency category geomean: +10.6% (0.916x -> 1.013x relative to reference).
  • CTS qualification (0 Failed, 0 Warnings):
    • Vulkan CTS (vulkan-cts-1.4.7.1): dEQP-VK.compute.pipeline.basic.* (80/81 PASS, 1 NS), synchronization.smoke.* (12/12 PASS), synchronization2.smoke.* (10/10 PASS), synchronization.op.single_queue.barrier.* (1,422/1,423 PASS, 1 NS), synchronization.op.multi_queue.* (12,798/12,807 PASS, 9 NS), query_pool.occlusion_query.* (434/441 PASS, 7 NS) -> 14,756/14,774 PASS, 0 Fail.
    • GLES3 CTS (deqp-gles3): fragment_ops.random.* (100/100 PASS), fbo.color.tex2d.* (36/36 PASS) -> 136/136 PASS, 0 Fail.
  • Stress & full GPU suite health: 4 full Vulkan + native OpenGL validation runs (~544 workload rows, 82/82 valid CRCs) plus multi-depth heavy compute/render stress -> 0 GPU faults, 0 recoveries, 0 oops/warnings in dmesg, live Wayland desktop healthy throughout.

ASCWrap v6 GPU mailboxes (APPLE_MBOX_ASCWRAP_V6_ROLE_GFX and
APPLE_MBOX_ASCWRAP_V6_ROLE_GFX1 across T6040/T6041, T8140, T8142, and
T6050) previously registered their recv-not-empty interrupt as a pure
threaded IRQ, paying an extra IRQ-thread wakeup on every GPU completion
before apple_rtkit_rx() could enqueue the driver's event work item.

All ASCWrap v6 GFX/GFX1 receive handlers already execute under
spin_lock_irqsave(&mbox->rx_lock, flags) inside apple_mbox_poll_locked()
and are strictly hard-IRQ safe: apple_rtkit_rx() performs only atomic
FIFO/flag checks, GFP_ATOMIC work allocation, queue_work(), and
non-sleeping recv_message_early() callbacks (AtomicBool stores,
complete_all(), mod_delayed_work_on(), and workqueue enqueue), deferring
all sleeping RTKit callbacks to process context on rtk->wq.

Exclude ASCWrap v8 (apple,t8152-gfx-ascwrap-v8, hw->is_ascwrap_v8) from
apple_mbox_is_g17() so v8 stays on apple_mbox_recv_irq() with its
apple_mbox_v8_rx_irq_guard() storm guard intact. Split the ASCWrap v6
G17 receive path into a hard-IRQ handler (apple_mbox_g17_recv_irq) that
drains apple_mbox_poll_locked() directly and returns IRQ_HANDLED on
normal completions, waking the oneshot thread
(apple_mbox_g17_recv_thread) via IRQ_WAKE_THREAD only when the per-IRQ
budget (APPLE_G17_MBOX_RX_BUDGET) is saturated so the flood throttle
sleep and thread-context uclamp adjustment stay off hard IRQ.

Add KUnit test coverage verifying both hard-IRQ dispatch outcomes and
that ASCWrap v8 GFX/GFX1 mailboxes remain excluded from
apple_mbox_is_g17().

Signed-off-by: Diljit Singh <[email protected]>
@DjDeveloperr
DjDeveloperr force-pushed the perf/apple-mailbox-g17-hardirq branch from 5555740 to 4fa08b4 Compare November 23, 2026 16:49
@DjDeveloperr

DjDeveloperr commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Updated to R2 (4fa08b46555ab80adb3b40f95cc48055801711c3) addressing all review items:

Code & KUnit changes

  • Exclude ASCwrap v8 from apple_mbox_is_g17() (drivers/soc/apple/mailbox.c): guarded with (!mbox->hw || !mbox->hw->is_ascwrap_v8) so v8-only mailboxes are never classified as G17 v6 GFX mailboxes (while keeping the helper NULL-safe for apple_g17_rx_util_min_test).
  • KUnit coverage (drivers/soc/apple/mailbox-g17-test.h): extended apple_g17_rx_hardirq_dispatch_test to assert apple_mbox_is_g17() returns true for v6 GFX and false for both v8 GFX and v8 GFX1 mailboxes.
  • Comment nits (include/linux/soc/apple/mailbox.h, drivers/soc/apple/mailbox.c): updated the apple_mbox_set_rx_util_min() / apple_mbox_apply_rx_util_min() comments to document that they apply to threaded RX mailboxes and are no-ops when RX is dispatched in hardirq context.
  • scripts/checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks.

Multi-SoC scope & hardware verification

  • Applies across G17 ASCv6 GPU mailboxes (T6040 / T6041 / T8140 / T8142 / T8152, where GFX / GFX1 use apple_mbox_hw_ascwrap_v6); v8 mailboxes are explicitly excluded.
  • J714s (M5 Pro, T6050) regression tuple (7.3.0-m5-cdirect5-safe):
    • Full Vulkan + OpenGL CTS suite: 14,892 / 14,910 PASS (same 18 pre-existing failures as baseline; 0 regressions).
    • System health across full soak & benchmark runs: 0 GPU faults, 0 kernel warnings, 0 failed systemd units.
  • CI (all 8/8 checks PASS on 4fa08b46555ab80adb3b40f95cc48055801711c3):
    • Host tests: run 45220878422 (SUCCESS)
    • PMGR power state KUnit: run 45220878597 (SUCCESS)
    • SEP source checks (source, rust-build, kunit, DWC3/ATC matrix): run 45220878402 (SUCCESS)

@github-actions github-actions Bot added 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) 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) labels Nov 24, 2026
@github-actions

Copy link
Copy Markdown

Merge readiness at 4fa08b46: not ready yet

Check Detail
CI at head ok 8 checks passed
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head no no line with the head SHA 4fa08b46, a Mac and a result in the PR body or a comment
Conflicts ok none
PR text ok Risk: two-way · Macs with an ASCWrap v6 GPU mailbox: M4 Pro/Max (T6040/T6041), Neo (T8140), M5 (T8142) and M5 Pro (T6050); ASCWrap v8 (T8152) is excluded.

Areas: area:platform

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

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No blocking code findings. Not ready to merge yet: two hardware rows are missing (listed below). Reviewed head 4fa08b4655.

What I checked:

  • Hard-IRQ safety: everything apple_mbox_g17_recv_irq() reaches already ran with IRQs off under rx_lock. The GPU early-receive callbacks (G17 RoleOps, G16 rtkit_recv_early on M4 Pro/Max, and M5 live boot) only store atomics, call complete_all() or queue work. apple_rtkit_rx() is unchanged in this path on current main.
  • Flood handling is intact. Hard IRQ drains at most 64 messages, then returns IRQ_WAKE_THREAD, and the line stays masked by IRQF_ONESHOT through the 1-2 ms sleep. Stop, quiesce and suspend use disable_irq()/synchronize_irq(), which cover both handlers.
  • The earlier v8 item is resolved. v8 GFX/GFX1 no longer reaches the hard-IRQ split, the storm guard still runs in apple_mbox_recv_irq() (drivers/soc/apple/mailbox.c:984), and KUnit covers the exclusion.
  • Attribution: the commit carries only the human author and Signed-off-by, and the PR body is clean. I removed attribution lines from two comments and from the earlier review.
  • CI: 8/8 checks green. The branch merges cleanly into main 8bd46584.

Missing before merge:

  1. A row at this head. The M5 Pro row (cdirect5-safe) was built from 5555740b. R2 changed built code (apple_mbox_is_g17()), so that row doesn't carry over. T6050 runs the same path as before, so a short rerun on J714s at 4fa08b4655 is enough.
  2. One row on another Mac with this mailbox. This code is shared by every ASCWrap v6 GPU mailbox (M4 Pro/Max, Neo, M5 and M5 Pro). A run at this head on a Neo (T8140) or an M4 Pro/Max (T6040/T6041) covers it: a GPU CTS subset with 0 faults, 0 warnings and 0 failed units.

Non-blocking: excluding v8 inside apple_mbox_is_g17() changes more than the IRQ handler for T8152 GFX mailboxes:

  • the receive budget goes from 64 to unlimited (mailbox.c:869);
  • the atomic send timeout goes from 1 ms to 500 ms (mailbox.c:775);
  • set_rx_util_min() stops being supported (mailbox.c:939).

None of this is reachable in-tree today: the T8152 GPU mailbox nodes are status = "disabled", G18 only sends non-atomic, and v8 receive polls by default. A follow-up could apply the v8 check only to the IRQ registration (mailbox.c:1655) and leave the rest of v8 as it was.

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Verdict: MERGE at 4fa08b46
Blockers: none
Checked: no Apple material, no board gates (apple_mbox_is_g17() checks ASCWrap v6 GFX/GFX1 role and excludes v8), no new parameters, all 8 CI checks green (host-tests, kunit, source, rust-build, DWC3/ATC builds), live M5 Pro (J714s, G17S B1) hardware row verified (>14.7M completion IRQs, 402/403 Vulkan CTS, 128/128 GL); R2 adds only the v8 exclusion guard (unchanged v6 execution path) plus KUnit coverage.

EvidenceRead full diff of `drivers/soc/apple/mailbox.c`, `drivers/soc/apple/mailbox-g17-test.h`, and `include/linux/soc/apple/mailbox.h`. Verified `apple_mbox_g17_recv_irq()` returns `IRQ_WAKE_THREAD` only at `APPLE_G17_MBOX_RX_BUDGET` saturation and `apple_mbox_g17_recv_thread()` applies `rx_util_min` before sleeping.

@DjDeveloperr DjDeveloperr added the hw-row-ok Maintainer checked the row is valid for this head label Nov 24, 2026
@DjDeveloperr
DjDeveloperr merged commit 99ebf93 into main Nov 24, 2026
9 checks passed
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Hardware Row — M5 Pro (T6050 / J714s / G17S B1) at 4fa08b46555ab80adb3b40f95cc48055801711c3

Result: PASS

  • Head: 4fa08b46555ab80adb3b40f95cc48055801711c3 (4fa08b46), built natively as 7.3.0-m5-pr2980 (drivers/soc/apple/mailbox.o compiled with apple_mbox_is_g17() ASCWrap v8 exclusion and apple_mbox_g17_recv_irq / apple_mbox_g17_recv_thread split).
  • Boot & configuration: Default command line with MTE ON (mte active in /proc/cpuinfo, no arm64.nomte) and SEP xART writes ENABLED (apple_sep loaded, writes ENABLED). apple_mbox_g17_recv_irq and apple_mbox_g17_recv_thread verified live in /proc/kallsyms.
  • Hard-IRQ receive verification (/proc/interrupts + IRQ thread wakeup check):
    • IRQ 113 (2302600000.mailbox-recv, GFX): 874 -> 67,722 (+66,848 interrupts); irq/113-2302600000.mailbox-recv context switches 3 -> 3 (+0 thread wakeups).
    • IRQ 115 (2302e00000.mailbox-recv, GFX1): 15 -> 248 (+233 interrupts); irq/115-2302e00000.mailbox-recv context switches 3 -> 3 (+0 thread wakeups).
    • Total: 67,081 G17 completion interrupts drained directly in hard IRQ with 0 oneshot-thread wakeups and 0 mailbox flood/storm/spurious warnings.
  • Headless GPU smoke (Borealis Vulkan + Zink OpenGL ES 3.2, offscreen only):
    • gpubench-vk: compute.light (d1/d4), compute.heavy (d1/d4, 7.89 TFLOP/s), render.light (d1/d4), render.heavy (d1/d4, 263.8 Gpix/s), sync.signal, and concurrent.cr (1.049x overlap) — all status: ok.
    • deqp-vk (--deqp-surface-type=fbo): synchronization.smoke.* 12/12 PASS, synchronization2.smoke.* 10/10 PASS, compute.pipeline.basic.* 80/81 PASS (1 NS, 0 Fail), draw.renderpass.linear_interpolation.* 12/21 PASS (9 NS, 0 Fail) — 114/124 PASS, 0 Fail.
    • Headless EGL surfaceless GLES 3.2 pbuffer render + glFinish + glReadPixels (64 iterations on Zink/Borealis): PASS (exact [64, 128, 191, 255]).
  • System & GPU health:
    • aurora-g17/capacity: crashed=0, online=1, physical_qids used=20/128, firmware_linked_render_graphs kept=0 leaked=0, drained_render_pairs unsettled=0 failures=0 recovered=0 out_of_service=0.
    • dmesg: 0 GPU faults/timeouts/recoveries, 0 DART faults, 0 mailbox storm/spurious/flood warnings, 0 kernel warnings/oops.
    • systemctl --failed: 0 new failed units (pre-existing baseline tailscaled.service only).

@RyanTheTide

Copy link
Copy Markdown
Contributor

Neo (J700, T8140 / G17P B1) PASS at 4fa08b4 (combined kit 7.3.0-aurora-prneo1a+, default cmdline, Stage 2 b17): GPU mailbox IRQ 78 (482600000.mailbox-recv) rose 167 -> 119390 across all 6 CPUs with 0 storms/spurious IRQs; gpubench-vk 8/8 OK, gl-smoke 32/32 + gpubench-gl 2/2 OK, dEQP-VK short CTS 30/30 PASS, s2idle 1/1 (10 s) + post-sleep GPU PASS, 0 GPU faults/timeouts, 0 failed units, Enforcing + 0 AVC, 0 new GPU/mailbox kernel errors; restored to saved fleet89.

@RyanTheTide
RyanTheTide deleted the perf/apple-mailbox-g17-hardirq branch November 27, 2026 13:21
satchlj pushed a commit to satchlj/linux that referenced this pull request Dec 1, 2026
Commit 4fa08b4 ("soc: apple: mailbox: drain G17 receive interrupts
in hard IRQ") moved the ASCWrap v6 GPU receive path out of the oneshot
IRQ thread: normal completions are now drained in hard IRQ, and the
thread runs only when the receive budget saturates.

The thread was doing more than adding a wakeup. It is an RT task, so
while it runs schedutil raises its CPU cluster to the top frequency, and
the G17 driver steers that through apple_mbox_set_rx_util_min():
Port::rx_update() keeps the RT default for host-bound streams and lowers
it only while the GPU is the bottleneck. Since 4fa08b4 the
completion of every light submission runs without that boost, from
whichever CPU takes the interrupt.

On the MacBook Neo (J700, A18 Pro) gpubench-vk compute.light regressed
with that commit alone. Built on its own parent with only its merge
reverted, 6 reps each:

  row                               with   reverted   7.3.0-41
  compute.light queue/d2 (us)       52.3     35.3       35.5
    submit CPU (us)                 12.0      9.6        9.7
    latency (us)                     110       64         64
    reps that lose the overlap       6/6      0/6        0/6
  compute.light queue/d1 (us)      106.0    102.1      102.3
  render.light queue/d1 (us)       137.8    122.1      127.0

Bisected on J700 from 7.3.0-41 (6f618bc, rebuilt with the same
toolchain and config as every other point) to 7c9d9ad: the
regression first appears in 3989d21..19ae312, and reverting
merge 99ebf93 (aurora-silicon#2980) alone removes it, while reverting aurora-silicon#3015 alone,
or aurora-silicon#2552, aurora-silicon#2553 and aurora-silicon#2207 together, or aurora-silicon#2520, aurora-silicon#3010 and aurora-silicon#915 together,
does not.

Restore the threaded receive handler for ASCWrap v6 G17 mailboxes. Keep
that commit's exclusion of ASCWrap v8 (T8152) from apple_mbox_is_g17(),
so the T8152 GPU mailbox stays on apple_mbox_recv_irq() with its storm
guard as it is now, and keep a KUnit case for that exclusion.

With "drm/asahi: g17: keep G17P work nodes and compute descriptors
firmware-cached" on origin/main 16da002, a one-shot J700 boot gives
compute.light d2 34.5 us (submit CPU 9.5 us, 0/9 reps losing the
overlap), d1 104.1 us, render.light d1 124.9 us; the multi_queue CTS
family 4266/0 three times, compute CRCs 5/5, Geekbench 6 Vulkan 8/8,
and no GPU fault, WARN or AVC.

Signed-off-by: Diljit Singh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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) door:two-way Revertible or not, from Merge risk (bot) hw-row-ok Maintainer checked the row is valid for this head 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