Skip to content

drm/asahi: g17: wait interruptibly when submission order window is full - #3306

Merged
DjDeveloperr merged 6 commits into
mainfrom
fix/g17-order-window-backpressure
Dec 1, 2026
Merged

DjDeveloperr merged 6 commits into
mainfrom
fix/g17-order-window-backpressure

Conversation

@erikwb

@erikwb erikwb commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

What: Wait interruptibly on a CondVar for up to 1 s when a G17 context's ORDER_WINDOW (1024) fills instead of failing the submit ioctl immediately with -EBUSY, and leave output syncobjs untouched on -ERESTARTSYS before publication so compositor retry bursts and restarted ioctls avoid Borealis GL_GUILTY_CONTEXT_RESET aborts and duplicate timeline publication.
Tested: At 5d9bcf092530: arm64 QEMU Asahi Rust KUnit (drivers/gpu/drm/asahi/.kunitconfig) 491 passed, 4 skipped, 0 failed (including no_ioctl_is_ordered_past_the_window and full_window_signal_leaves_timeline_untouched_for_restart); G17 host tests (tools/asahi/run-host-tests.py --only g17) 238/238 passed; asahi-m4 host selftests (test-submit-restart.py, test-fence-signalling.py) pass (1/1, 2/2, 2/2, 7/7, and sync_input C coalescing tests passed); checkpatch.pl --strict clean (0 errors, 0 warnings, 0 checks). Live J716c (16-inch M5 Max, T6050) hardware row at 5d9bcf092530 in batched candidate c3da8eed6f72 (over main 9af21b007425, default command line, Stage 2 1.0.0b17-g00976384, Linux 7.3.0, AC 100%, all 7 PR files byte-identical): single boot ID, 0 panics/Oops/BUG/SErrors/DART faults/GPU faults/LSM denials, only the pre-existing aurora-peripherals and systemd-networkd-wait-online units failed, Borealis Apple M5 Max (G17C B1), eDP-1 3456x2234@120; dEQP-VK.ssbo.layout.single_basic_type.* 909/909 Pass, vk_burn ~50k dispatches, vkcube (FIFO and immediate present modes), glmark2-wayland (zink), and a GPU burst after a pm_test=devices suspend/resume all completed with 0 GPU faults, 0 timeouts and 0 new dmesg lines. A dedicated deferred-submit stress run in a second four-PR batched candidate f59b93fb961f (over main 9af21b007425, default command line, Stage 2 1.0.0b17-g00976384, Linux 7.3.0, AC 100%, all 7 PR files byte-identical) then drove one Vulkan context past the window: a ~0.7 s compute dispatch signals timeline value 1, and 1,300 (and in a repeat 1,500) further tiny dispatches each wait on that value and signal a later point, so each is its own submit ioctl held behind the dispatch (traced with asahi_g17_submit). One vkQueueSubmit blocked 666.1 ms in the kernel (the full-window wait, not -EBUSY) and returned VK_SUCCESS; all 1,339 (and 1,541) traced submit ioctls returned 0 (0 -EBUSY, 0 VK_ERROR_DEVICE_LOST), the final timeline value was reached ~710 ms after the first submit, a 900-submit control run inside the window blocked no ioctl (slowest 0.2 ms), and the boot showed 0 GPU faults/timeouts, no error-level kernel lines beyond the pre-existing systemd-gpt-auto-generator pair, and 0 panics/Oops/BUG/SErrors/DART faults/LSM denials. Earlier-head J716c (T6050) hardware row at b01dc0e46139 in candidate 3e4078f656d5 (main fcb124279183 plus unchanged b01dc0e46139 and sibling PRs, default command line, eDP-1 3456x2234@120, no external display attached): boots cleanly to SDDM/Hyprland desktop (Apple M5 Max (G17C B1)), passes 2x dpms off/on cycles under GPU load (4 x 1,985-case dEQP-VK.ssbo.* CTS probes, 7,940/7,940 Pass), 0 GPU submission errors, 0 new dmesg lines across the DPMS+CTS window, 0 new failed units (aurora-peripherals.service at settle and systemd-networkd-wait-online.service later are pre-existing on the default boot), 0 LSM denials (0 avc/apparmor/landlock/yama lines), 3 boot err lines (2x pre-existing systemd-gpt-auto-generator plus aurora 2302600000.gpu: M5 bare-metal bootstrap failed at session: EPROBE_DEFER at 0.65 s before GPU came up; dual 3840x2160@240 external display DPMS was verified at prior commit 4d5fcb73db27). Commit 5d9bcf092530 itself is a KUnit-only KVec -> KVVec fix; however, the preceding merge 3bf1d8bd9e5f (main aa3351bc8e6f) brought in #3021 (KVVec submission syncs) and #3380 (G17 retirement hrtimer), so the 3e4078f656d5 row predates those changes and is kept only as an earlier-head row.
Risk: two-way door · G17 GPUs (T6050 M5 Pro/Max/Ultra, T8142 M5, T8140 A18 Pro, T6040/T6041 M4 Pro/Max); no impact on G13/G14/G15/G16 drivers.
Revert: git revert -m 1 <merge-commit> restores immediate -EBUSY on ORDER_WINDOW overflow and the prior Outputs::drop() fallback fence path; no persistent on-disk, DT, or firmware state is written.
Not yet: A18 Pro (J700, T8140) normal GPU workload row at 5d9bcf092530 (0 GPU submission errors, 0 failed units, 0 new kernel errors, and 0 SELinux/LSM denials; external hardware, second G17 family requested before merge); T6040/T6041 (M4 Pro/Max) and T8142 (M5) G17 hardware rows (external hardware); and the -ERESTARTSYS restart and 1 s -EBUSY timeout fallback on hardware (the J716c stress released the window after ~0.67 s, so neither path ran on hardware; KUnit exercises signal interruption and injects EBUSY to check error-fence publication, without waiting out the 1 s deadline).

Details

Root cause

When a context submits more than ORDER_WINDOW (1024) ioctls ahead of its oldest waiting ioctl (observed during an Aquamarine atomic-commit retry burst when an external display errored with -EINVAL), WorkStateLease::deferred() immediately returned -EBUSY. Userspace Vulkan drivers (Borealis / zink) treat a submit ioctl error as VK_ERROR_DEVICE_LOST, raising GL_GUILTY_CONTEXT_RESET and aborting Hyprland.

In addition, if WorkStateLease::deferred() was interrupted by a signal after output syncobjs were resolved and returned -ERESTARTSYS inside Outputs::publish(), Outputs::drop() installed and signalled a fallback -ERESTARTSYS fence on the resolved output syncobjs before the kernel restarted the ioctl, exposing -ERESTARTSYS to timeline waiters and causing the restarted ioctl to publish the same timeline point twice.

Changes

  • Split identity::Order wake tracking into OrderWake { publishers, submitters } (drivers/gpu/drm/asahi/g17/context/identity.rs) so full-window submitters are woken whenever the oldest ordinal advances or is abandoned without altering publisher admission ordering.
  • Pair context.order with order_wait: Arc<CondVar> (drivers/gpu/drm/asahi/g17/context.rs) so WorkStateLease::deferred() (via assign_order()) holds a single context.order guard and waits interruptibly in <=50 ms slices (up to 1 s) using stack-allocated CondVar::wait_interruptible_timeout() with zero per-wait heap allocations.
  • Re-check context.status().get() != 0 on each slice (returning -EIO on VM loss), return -ERESTARTSYS on signals, and fall back to -EBUSY only if the window stays full for 1 s.
  • Acquire WorkStateLease::deferred() before Outputs::publish() and context.note_render() in Queue::submit() (drivers/gpu/drm/asahi/g17/queue/mod.rs), and skip fallback error-fence publication/exposure in Outputs::output_fence() and Outputs::drop() (drivers/gpu/drm/asahi/g17/fence.rs) when returning -ERESTARTSYS before publication so restarted ioctls leave timeline and cumulative syncobjs untouched.
  • Update KUnit test no_ioctl_is_ordered_past_the_window to verify the submitter wake flag on admission, and add full_window_signal_leaves_timeline_untouched_for_restart in asahi_g17_aggregate_promise (using KUnit-only SyncObj::new_kunit() and asahi_g17_kunit_{raise,clear}_sigterm() helpers) covering full-window signal interruption with timeline and cumulative SignalBundle syncobjs, clean ioctl restart publication, and error-fence publication with injected EBUSY (without waiting out the 1 s deadline).
  • Merge main (fcb124279183) at e56d52102205 (keeping both AtomicU64 and OrderWake in drivers/gpu/drm/asahi/g17/context.rs) and main (aa3351bc8e6f) cleanly at 3bf1d8bd9e5f, and update the #[cfg(CONFIG_KUNIT = "y")] test vectors in full_window_signal_leaves_timeline_untouched_for_restart() from KVec to KVVec at 5d9bcf092530 to match Outputs::new() after #3021 (fad5d04a1fa8).

Overlapping PRs

  • aurora-silicon/linux#3429 also modifies drivers/gpu/drm/asahi/g17/context.rs, and #3443 / #3411 also modify drivers/gpu/drm/asahi/g17/queue/mod.rs; #3306 is independent of those series and merges cleanly onto current main (ee36fbdcd1c8, git merge-tree --write-tree -> 349e622db4a4).
Evidence
  • Commits on fix/g17-order-window-backpressure (merge-base aa3351bc8e6f):
    • 4d5fcb73db27 drm/asahi: g17: wait interruptibly when submission order window is full
    • e56d52102205 Merge branch 'main' into fix/g17-order-window-backpressure
    • b01dc0e46139 drm/asahi: g17: leave output syncobjs untouched on -ERESTARTSYS
    • 3bf1d8bd9e5f Merge remote-tracking branch 'origin/main' into fix/g17-order-window-backpressure
    • 5d9bcf092530 drm/asahi: g17: use KVVec in signal interruption KUnit test
  • Local verification at 5d9bcf092530:
    • KUnit (./tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/gpu/drm/asahi/.kunitconfig --jobs=32 --timeout=900): Ran 495 tests: passed: 491, skipped: 4 (0 failed, including no_ioctl_is_ordered_past_the_window and full_window_signal_leaves_timeline_untouched_for_restart).
    • Host tests (python3 tools/asahi/run-host-tests.py --only g17): 238/238 passed.
    • Selftests (python3 tools/testing/selftests/drivers/gpu/asahi-m4/test-submit-restart.py and test-fence-signalling.py): pass (1/1, 2/2, 2/2, 7/7, and sync_input C coalescing tests passed (256-hop chain -> 2 leaves, error preserved)).
    • Style (./scripts/checkpatch.pl --strict --git aa3351bc8e6f..5d9bcf092530 and git diff aa3351bc8e6f..5d9bcf092530 | ./scripts/checkpatch.pl --strict --no-signoff -): 0 errors, 0 warnings, 0 checks.
  • Live J716c (16-inch M5 Max, T6050) at 5d9bcf092530 in batched candidate c3da8eed6f72 (over main 9af21b007425, default cmdline, Stage 2 1.0.0b17-g00976384, Linux 7.3.0, AC 100%; all 7 changed files drivers/gpu/drm/asahi/g17/{context.rs,context/identity.rs,fence.rs,queue/mod.rs,sync_output.c,sync_output.h} and rust/kernel/drm/syncobj.rs verified byte-identical to 5d9bcf092530):
    • Single boot ID; 0 panics/Oops/BUG/SErrors/DART faults/GPU faults/LSM denials; only the pre-existing aurora-peripherals and systemd-networkd-wait-online units failed.
    • dEQP-VK.ssbo.layout.single_basic_type.*: 909/909 Pass; vk_burn: ~50k dispatches; vkcube (FIFO and immediate); glmark2-wayland (zink); GPU burst after pm_test=devices resume: 0 GPU faults, 0 timeouts, 0 new dmesg lines.
    • Redacted kernel log excerpt (Stage 2 1.0.0b17-g00976384, default cmdline):
aurora 2302600000.gpu: Probing...
aurora 2302600000.gpu: GPU firmware build: 26B123 for T6050 G17C, primary then secondary
aurora 2302600000.gpu: GPU firmware: 27.2 (26B123), G17C
aurora 2302600000.gpu: M5 primary initdata acknowledged
aurora 2302600000.gpu: M5 secondary initdata acknowledged
aurora 2302600000.gpu: M5 firmware opening records retired
[drm] Initialized aurora 1.0.0 for 2302600000.gpu on minor 2
apple-dcp 48ae00000.dcp: panel peak luminance 1600 nits (ADT)
  • Live J716c (16-inch M5 Max, T6050) deferred-submit stress at 5d9bcf092530 (four-PR batched candidate f59b93fb961f over main 9af21b007425, default command line, Stage 2 1.0.0b17-g00976384, Linux 7.3.0, AC 100%; all 7 PR files verified byte-identical to 5d9bcf092530):
    • Method: one Vulkan context/queue (Borealis Apple M5 Max (G17C B1), Vulkan 1.4); a ~0.7 s compute dispatch (7,400,000 loop iterations) signals timeline semaphore value 1; N further tiny dispatches each wait for value >= 1 and signal 1 + i, so each is one submit ioctl kept behind the first; asahi_g17_submit tracepoint enabled around each run.
    • N = 1,300: vkQueueSubmit #1,057 took 666.1 ms (all others <= 0.1 ms) and returned VK_SUCCESS; all 1,339 traced submit ioctls (1,302 of the test context, 37 of the desktop) returned 0; the wait for value 1,301 returned VK_SUCCESS 710.6 ms after the first submit.
    • N = 1,500: the same call index blocked 666.1 ms, all 1,541 traced submit ioctls returned 0, final value 1,501 reached after 714.9 ms.
    • Control N = 900 (inside the window): 0 ioctls over 10 ms (slowest 0.2 ms), all 939 returned 0.
    • The blocked ioctl was the 1,059th of its context, consistent with 1,024 ioctls queued behind the oldest waiting one plus the first 34 that had already taken their turn; it waited 666.1 ms (> 100 ms, < 1 s) until the first dispatch retired and the window drained, instead of failing with -EBUSY.
    • Whole boot: 0 panics/Oops/BUG/SErrors/DART faults/GPU faults/GPU timeouts/WARNING lines/LSM denials; error-level kernel lines only the 2x pre-existing systemd-gpt-auto-generator (plus watchdog0: watchdog did not stop! at reboot).
  • Earlier-head hardware tests (before 3bf1d8bd9e5f, which merged main aa3351bc8e6f including #3021's KVVec and #3380's G17 retirement hrtimer, and KUnit-only 5d9bcf092530):
    • T6050 / J716c at 4d5fcb73db27 (default cmdline): booted cleanly to Hyprland desktop (eDP-1 3456x2234@120 + DP-1 3840x2160@240 + DP-4 3840x2160@240), passed 2 full DPMS off/on cycles, 0 GPU IOCTL: submit failed or -EBUSY errors.
    • T6050 / J716c at b01dc0e46139 in candidate 3e4078f656d5 (default cmdline, eDP-1 3456x2234@120, no external display attached): boots to SDDM/Hyprland (Apple M5 Max (G17C B1)), 2x dpms off/on cycles via hyprctl while running 4 x 1,985-case dEQP-VK.ssbo.* CTS (7,940 Pass, 0 Fail), 0 GPU submission errors, 0 new dmesg lines across the DPMS+CTS window, 0 new failed units (aurora-peripherals.service and systemd-networkd-wait-online.service also fail on default), 0 LSM denials (0 avc/apparmor/landlock/yama lines), 3 boot err lines (2x systemd-gpt-auto-generator plus aurora GPU EPROBE_DEFER at 0.65 s before GPU came up).

When a context submits more than ORDER_WINDOW (1024) ioctls ahead of its
oldest waiting ioctl (for example during a compositor atomic-commit retry
burst), WorkStateLease::deferred() previously failed immediately with
-EBUSY. Userspace Vulkan drivers treat a submit ioctl error as device
loss, triggering GL_GUILTY_CONTEXT_RESET and aborting the compositor.

Track full-window submitter waits separately in identity::Order and pair
context.order with a CondVar so WorkStateLease::deferred() waits
interruptibly without heap allocations for up to 1 s (re-checking VM
status on each slice and returning -ERESTARTSYS on signals) before
falling back to -EBUSY.

Signed-off-by: Erik Bourget <[email protected]>
@erikwb
erikwb requested review from a team and DjDeveloperr as code owners November 26, 2026 20:12
@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (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-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Merge readiness at 81338726: not ready yet

Check Detail
CI at head ok 32 checks passed
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head no no line with the head SHA 81338726, a Mac and a result in the PR body or a comment
Conflicts ok none
PR text ok Risk: two-way · G17 GPUs (T6050 M5 Pro/Max/Ultra, T8142 M5, T8140 A18 Pro, T6040/T6041 M4 Pro/Max); no impact on G13/G14/G15/G16 drivers. Revert: git revert -m 1 <merge-commit> restores immediate -EBUSY on ORDER_WINDOW overflow and the prior Outputs::drop() fallback fence path; no persistent on-disk, DT, or firmware state is written.

Areas: area:gpu, area:rust

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

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

Verdict at 4d5fcb73: code OK. Merge after the J700 row: this is shared G17 code, so it needs a regression row on the other G17 generation (A18 Pro).

Checked

  • A full order window now waits interruptibly on order_wait in up to 50 ms slices, bounded by a 1 s deadline. It returns EIO if the context has failed, ERESTARTSYS on a signal, and EBUSY only if the turn doesn't move in time.
  • The order lock is held across the condvar wait. notify_turn wakes submitters only when a refusal was recorded, through OrderWake.
  • Both paths that advance the turn (admit and leave) notify, so I found no lost wakeup.
  • KUnit 459/4 skip, with the ordering test updated. J716c desktop plus two 4K240 outputs and DPMS ×2 show 0 submission errors.

Before merge: a J700 (G17P) row at this head with a normal GPU workload (we can run it on our Neo if you'd like). The over-1024-submit stress reproducer can follow.

@github-actions github-actions Bot added the merge-conflict Conflicts with the base branch (bot) label Nov 27, 2026
@RyanTheTide
RyanTheTide disabled auto-merge November 27, 2026 05:31
Conflicts:
	drivers/gpu/drm/asahi/g17/context.rs

Keep both main's AtomicU64 import and this branch's OrderWake import.

Signed-off-by: Erik Bourget <[email protected]>
When WorkStateLease::deferred() is interrupted by a signal while waiting
on a full ORDER_WINDOW, it returns -ERESTARTSYS so the kernel can
restart the submit ioctl. Previously WorkStateLease::deferred() ran
inside Outputs::publish(), and Outputs::drop() installed and signalled a
fallback error fence on the resolved output syncobjs. For timeline
syncobjs, a waiter could observe -ERESTARTSYS before the restarted ioctl
attempted to publish the same timeline point again.

Move WorkStateLease::deferred() before Outputs::publish() in
Queue::submit(), and skip fallback error-fence publication in
Outputs::output_fence() and Outputs::drop() when returning -ERESTARTSYS
before publication. Add a KUnit test covering full-window signal
interruption with timeline and cumulative syncobjs and subsequent ioctl
restart.

Signed-off-by: Erik Bourget <[email protected]>
@erikwb

erikwb commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Merged main (fcb124279183) into fix/g17-order-window-backpressure at e56d52102205 to resolve the import conflict in drivers/gpu/drm/asahi/g17/context.rs, and added b01dc0e46139 so -ERESTARTSYS leaves resolved output syncobjs untouched before publication:

  • Queue::submit() (drivers/gpu/drm/asahi/g17/queue/mod.rs) now acquires WorkStateLease::deferred() before Outputs::publish() and context.note_render().
  • Outputs::output_fence() and Outputs::drop() (drivers/gpu/drm/asahi/g17/fence.rs) skip fallback error-fence exposure and installation when returning -ERESTARTSYS before publication, preventing timeline waiters from observing -ERESTARTSYS or seeing duplicate timeline point publication on ioctl restart (while preserving error-fence publication for all non-ERESTARTSYS failures).
  • Added KUnit test asahi_g17_aggregate_promise.full_window_signal_leaves_timeline_untouched_for_restart covering full-window SIGTERM interruption with timeline and cumulative SignalBundle syncobjs, clean restarted publication, and non-ERESTARTSYS failure handling.

Verified at b01dc0e46139:

  • arm64 QEMU Asahi KUnit (drivers/gpu/drm/asahi/.kunitconfig): 483 passed, 4 skipped, 0 failed (including no_ioctl_is_ordered_past_the_window and full_window_signal_leaves_timeline_untouched_for_restart)
  • Host tests (tools/asahi/run-host-tests.py --only g17): 231/231 passed
  • checkpatch.pl --strict on 4d5fcb73db27, b01dc0e46139, and git diff origin/main..b01dc0e46139: 0 errors, 0 warnings, 0 checks
  • J716c (T6050) at b01dc0e46139 in candidate 3e4078f656d5 (default command line, eDP-1 3456x2234@120, no external display attached): boots cleanly to SDDM/Hyprland (Apple M5 Max (G17C B1)), passes 2x dpms off/on cycles while running 4 x 1,985-case dEQP-VK.ssbo.* CTS (7,940/7,940 Pass), 0 GPU submission errors, 0 new dmesg lines across the DPMS+CTS window, 0 new failed units (aurora-peripherals.service and systemd-networkd-wait-online.service pre-existing on default), and 0 LSM denials (3 boot err lines: 2x pre-existing systemd-gpt-auto-generator plus aurora GPU EPROBE_DEFER at 0.65 s before GPU came up; dual 3840x2160@240 DPMS was verified at prior commit 4d5fcb73db27).

@RyanTheTide: please go ahead with the J700 (A18 Pro / Neo) normal GPU workload row at b01dc0e46139 (including 0 GPU submission errors, 0 failed units, 0 new kernel errors, and 0 SELinux/LSM denials) when you have a chance, as we do not have J700 hardware locally. Agreed on following up separately with the >1024 concurrent deferred submit stress reproducer.

@github-actions github-actions Bot added area:rust Area from CODEOWNERS (bot) ci-failing A check failed at the PR head (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Nov 27, 2026
Commit fad5d04 ("drm/asahi: keep a submission's syncs and command
copy off contiguous pages") changed Outputs::new() to accept
KVVec<SyncItem> instead of KVec<SyncItem>. Update the sync vectors in
full_window_signal_leaves_timeline_untouched_for_restart() to match so
KUnit builds cleanly after merging main.

Signed-off-by: Erik Bourget <[email protected]>
@erikwb

erikwb commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Merged main (aa3351bc8e6f) cleanly at 3bf1d8bd9e5f and added 5d9bcf092530 to fix the KUnit compilation failure against #3021 (fad5d04a1fa8, which changed Outputs::new() from KVec<SyncItem> to KVVec<SyncItem>):

  • drivers/gpu/drm/asahi/g17/fence.rs: updated syncs, cum_syncs, restart_syncs, and fail_syncs inside full_window_signal_leaves_timeline_untouched_for_restart() from KVec::with_capacity(...) to KVVec::with_capacity(...) (5d9bcf092530 itself is a KUnit-only #[cfg(CONFIG_KUNIT = "y")] change, while the 3bf1d8bd9e5f merge of main aa3351bc8e6f also pulled in #3021's KVVec submission syncs and #3380's G17 retirement hrtimer, so the J716c row at b01dc0e46139 / 3e4078f656d5 predates those changes and was refreshed at 5d9bcf092530).

Verified at 5d9bcf092530:

  • J716c (16-inch M5 Max, T6050, batched candidate c3da8eed6f72, default command line): dEQP-VK.ssbo.layout.single_basic_type.* 909/909 Pass, vk_burn ~50k dispatches, vkcube (FIFO and immediate), glmark2-wayland (zink) and a GPU burst after a pm_test=devices resume with 0 GPU faults, 0 timeouts and 0 new dmesg lines
  • J716c deferred-submit stress (four-PR batched candidate f59b93fb961f, default command line): one context with a ~0.7 s compute dispatch holding a timeline semaphore and 1,300 / 1,500 further tiny submits waiting on it; one vkQueueSubmit blocked 666.1 ms in the kernel and returned VK_SUCCESS, every traced submit ioctl (1,339 / 1,541) returned 0 (0 -EBUSY, 0 VK_ERROR_DEVICE_LOST), a 900-submit control blocked no ioctl, and the boot had 0 GPU faults, panics, Oops, BUG, SErrors, DART faults and LSM denials; the -ERESTARTSYS restart and the 1 s -EBUSY fallback were not exercised on hardware.
  • arm64 QEMU Asahi KUnit (drivers/gpu/drm/asahi/.kunitconfig): 491 passed, 4 skipped, 0 failed (including no_ioctl_is_ordered_past_the_window and full_window_signal_leaves_timeline_untouched_for_restart)
  • Host tests (tools/asahi/run-host-tests.py --only g17): 238/238 passed
  • asahi-m4 host selftests (test-submit-restart.py, test-fence-signalling.py): pass
  • checkpatch.pl --strict (HEAD^..HEAD and git diff origin/main): 0 errors, 0 warnings, 0 checks

@RyanTheTide: the J700 (A18 Pro / Neo) normal GPU workload row at 5d9bcf092530 remains pending before merge (external hardware).

@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 5d9bcf09

Blockers: none in code (re-run the cancelled pr-text and readiness checks and run a second-generation G17P/J700 lab regression row before landing).

Checked:

  • drivers/gpu/drm/asahi/g17/queue/mod.rs, context.rs, fence.rs: bounded interruptible CondVar wait (50 ms slices up to 1 s deadline) when ORDER_WINDOW fills; b01dc0e4 leaves resolved output syncobjs untouched on -ERESTARTSYS before publication; 5d9bcf09 updates Outputs::new() KUnit tests to KVVec<SyncItem> cleanly after #3021.
  • Tests & rows: arm64 QEMU Asahi Rust KUnit 491/491 pass (4 skipped, 0 failed), 26/26 build/host/KUnit CI checks green, and live J716c M5 Max deferred-submit stress & desktop rows PASS at exact head 5d9bcf09.
  • Checked for Apple material, tool attribution, private serials, and gating: clean; MERGEABLE on main.
Evidence
  • Head: 5d9bcf092530 (base: main, mergeable: MERGEABLE, +326/-47 across 7 files).

@erikwb

erikwb commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

Both pr-text and readiness passed at 5d9bcf092530, and the PR merges cleanly onto main ee36fbdcd1c8 (git merge-tree --write-tree -> 349e622db4a4).

Re-verified at 5d9bcf092530:

  • drivers/gpu/drm/asahi/.kunitconfig ARM64 KUnit: 491 passed, 4 skipped, 0 failed (no_ioctl_is_ordered_past_the_window and full_window_signal_leaves_timeline_untouched_for_restart pass).
  • python3 tools/asahi/run-host-tests.py --only g17: 238/238 passed.
  • tools/testing/selftests/drivers/gpu/asahi-m4/test-submit-restart.py and test-fence-signalling.py: pass (1/1, 2/2, 2/2, 7/7, and sync_input C coalescing tests passed).
  • ./scripts/checkpatch.pl --strict --git aa3351bc8e6f..5d9bcf092530 and git diff aa3351bc8e6f..5d9bcf092530 | ./scripts/checkpatch.pl --strict --no-signoff -: 0 errors, 0 warnings, 0 checks.
  • Confirmed all 7 changed files (drivers/gpu/drm/asahi/g17/{context.rs,context/identity.rs,fence.rs,queue/mod.rs,sync_output.c,sync_output.h} and rust/kernel/drm/syncobj.rs) in the J716c batched candidates (c3da8eed6f72, f59b93fb961f) are byte-identical to 5d9bcf092530.

Updated the PR body with **Revert:**, the full G17 chip scope (T6050, T8142, T8140, T6040/T6041) under **Risk:**/**Not yet:**, the narrowed KUnit coverage claim in **Not yet:** (signal interruption and injected EBUSY error-fence publication, without waiting out the 1 s deadline), and the Stage 2 version (1.0.0b17-g00976384), byte-for-byte candidate verification, and redacted J716c dmesg excerpt under Evidence. The requested external J700 (T8140) G17 row remains open before merge (J313 and J713 do not use G17).

@github-actions github-actions Bot added blast:m4 Macs affected, from Merge risk (bot) merge-conflict Conflicts with the base branch (bot) labels Nov 28, 2026
Main (#3330, granular work-state retire) added a multi-command path
that splits an ioctl into chunked work-state leases and publishes them
with Outputs::publish_with_status(), next to the single-command
Outputs::publish(). This branch makes publish() take a lease created
by the caller, so the interruptible order-window wait happens before
any output is published.

Kept both: the multi-command path is main's unchanged (its first
WorkStateLease::deferred() now waits interruptibly too, before
publication); the single-command path creates its lease before
publish() as this branch does. note_render() runs just before either
publication, after any wait. Outputs keeps main's publish_source()
split with this branch's publish_with(Option<lease>) on top.

tools/asahi/g17-output-fence-tests.py (main, #3311/#3648) extracts
impl Submission and expected one Arc::new() there, the one in
Submission::new(), which this branch removes; it now expects none.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor

Forward-merged main into this branch (merge commit only, no rebase), new head 8133872. Thanks @erikwb.

Conflict: main's #3330 (granular work-state retire) added a multi-command submit path that splits an ioctl into chunked work-state leases and publishes them with Outputs::publish_with_status(), right where this PR changes publish() to take a caller-created lease. I kept both. The multi-command path is main's code unchanged, and its first WorkStateLease::deferred() now gets the interruptible wait before publication. The single-command path creates its lease before publish() as this PR does. note_render() runs just before either publication, after any wait. In fence.rs, main's publish_source() split stays, with this PR's publish_with(Option<lease>) on top. Main's g17-output-fence-tests.py (#3311/#3648) expected the Arc::new() from Submission::new(), which this PR removes, so its drift count is now 0.

Tests at the merge: run-host-tests.py --only g17 283/283 (main 283/283; before the test fix the merge failed g17-output-fence-tests). asahi KUnit on arm64 QEMU (LLVM=1): 515 tests, 511 passed, 4 skipped (config), including full_window_signal_leaves_timeline_untouched_for_restart and the Order tests.

The merge changed the submit path under test (queue/mod.rs, fence.rs), so the J716c rows at 5d9bcf0 no longer cover this head. Still needed: the J700 row (now at this head), App review at head.

@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: HOLD at 81338726 for current-head hosted checks and the outstanding J700 peer row.

Checked: Both submit paths take their initial work-state lease before publishing any output. The multi-command path retains main’s chunk splits and status-backed publication. If an initial lease wait is interrupted, neither path exposes a fallback output fence, and render accounting is still after the wait. The host fixture change matches the removed constructor allocation.

The prior J716c stress covers the earlier tree. Exercise single- and multi-command submissions on the integrated tree and keep J700 as the second-family row.

@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) ci-failing A check failed at the PR head (bot) and removed ci-failing A check failed at the PR head (bot) merge-conflict Conflicts with the base branch (bot) labels Nov 30, 2026

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

Approved. A full order window now waits interruptibly in 50 ms slices up to 1 s and returns ERESTARTSYS on a signal without touching output syncobjs, and on this merged head both submit paths take the work-state lease before any output is published. The A18 Pro (J700) row Ryan asked for is in: a candidate carrying this head unchanged ran a normal GPU workload (4-queue render with CRC check, compute, concurrent render+compute, vkcube) and one deep sleep, with 0 GPU faults, timeouts or submission errors.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

J700 (Neo, G17P) row at combined SHA 936d72d0 (wip/ewb-g17-rows-20261130 = main fe9af4b6 + #3684 + #3407 + #3306 + #3415 + #3346)

Kernel: one-shot trial boot 472ed0ed with the dead-man timer and the default command line. Stock Fedora -41 was restored and verified afterwards.

  • Built warm from an existing J700 tree; the source tree was verified to equal 936d72d0 (tree 9da3305d).
  • Image sha256 27185481, aurora.ko sha256 625c14e8, vmlinux build ID a7620fb3.

Results

  • GPU use on the KDE desktop: gpubench 4-queue render (per-queue CRC ok), 2-queue compute, concurrent render + compute, vkcube --c 300 on Wayland. All completed.
  • GPU effort after work: effort_full was true during work (48/49 samples) and cleared within about 0.3 s of idle.
  • Host hold at the default idle_off_delay_ms=2: stayed off.
  • Host hold at idle_off_delay_ms=50: on during work (18 samples), released as soon as the work ended, and stayed off through 5 s of idle.
  • Wi-Fi (wld0) connected and Bluetooth (hci0) powered, before and after the sleep.
  • One test sleep (rtcwake -m mem -s 30, deep): suspended and resumed on the same boot. Afterwards Wi-Fi was up and a GPU render readback was valid. During suspend entry the log had one line, dwc3-apple 40a280000.usb: PM: device_prepare(): genpd_prepare returns -11; the suspend still completed.
  • 0 GPU faults, timeouts or submission errors; 0 WARN, 0 AVC; 0 failed units (stock: 0).
  • Kernel error lines: 11, against 12 on a stock boot, with no new kinds. SMC 0 and PCIe 0, before and after the sleep.

This PR: interruptible wait when the submission order window is full. All submits completed and the multi-queue gpubench readbacks were correct, with 0 submission errors.

@github-actions github-actions Bot removed ci-failing A check failed at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 1, 2026

@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 81338726dc3f

Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.

Checked: Both submit paths take their initial work-state lease before publishing any output. The multi-command path retains main’s chunk splits and status-backed publication. If an initial lease wait is interrupted, neither path exposes a fallback output fence, and render accounting is still after the wait. The host fixture change matches the removed constructor allocation.
The prior J716c stress covers the earlier tree. Exercise single- and multi-command submissions on the integrated tree and keep J700 as the second-family row.

Follow-ups (not blocking): hosted checks; single/multi-command submit run on integrated tree (J700 peer not required)

@DjDeveloperr
DjDeveloperr merged commit 7f5b51e into main Dec 1, 2026
53 of 69 checks passed
@DjDeveloperr
DjDeveloperr deleted the fix/g17-order-window-backpressure branch December 1, 2026 06:47
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:rust 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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants