Repository navigation
drm/asahi: g17: advertise soft faults - #2081
jgoyvaerts wants to merge 1 commit into
Conversation
|
Thanks for working out that the earlier robustness failures came from the context views at low VAs, and for documenting that range in the uAPI. The reasoning in Could |
Commit 6f7faee ("drm/asahi: g17: do not advertise soft faults") stopped advertising DRM_ASAHI_FEATURE_SOFT_FAULTS on G17, after every robustness2 rgba32 vertex_attribute_fetch case read non-zero data with the bit set. Its explanation was wrong. Mesa pointed the out-of-bounds vec3/vec4 vertex fetches at address 0 plus index times stride, and that range is not unmapped on G17: once a client runs compute work, the first 64 KiB of its VM hold the execution context's null view (CONTEXT_VIEWS[0], the render context presented at its fixed low address, as macOS presents it), and userspace maps the other context views up to 0x74000. Mesa no longer redirects robust fetches there on G17 (the Mesa change "asahi: explicitly bound robust native vector vertex fetches", 4115628b637f in aurora-wip). The G17 firmware takes no fault_control, but its own fault mode gives soft faults. Measured on the M4 Pro (T6040, firmware 25G83) with the bit clear and nothing else changed: - shader loads from unmapped client addresses return zero, whether the missing translation is at the leaf, at level 1 or at the root; - shader stores to unmapped or read-only pages, and atomics on read-only pages, are dropped; - none of these reports a fault or causes a recovery. This is a property of the firmware family, not of the SoC: the driver gives every G17 queue the same fault setting (QueueConfig::unk_66 = 1, the word the M5 firmware names soft_fault_enabled). Advertise soft faults on every GPU the G17 backend drives, with fault_control at its 0xb default as on the other generations. Say in the driver and in the uAPI that the context views are mapped memory. With the bit set on the M4 Pro, unmapped addresses read zero, stores and atomics to them are dropped without a fault, and all 98,776 dEQP-VK.robustness.* cases give the same results as without it (47,933 pass, 50,843 not supported, 0 fail), with no GPU recovery. The other G17 SoCs (T6041, T8140, T8142, T6050) have not been measured. Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com> Assisted-by: LLM
d395290 to
50c9683
Compare
|
Done in 50c9683. Measured on the M4 Pro (T6040, fw 25G83) only. Title, commit message and body updated. Re-checked: arm64 build of Yes please: robustness2 and the unmapped-read probes on your A18 Pro and M4 Pro would cover the parts we have not measured. |
|
Thanks for 50c9683. Advertising soft faults for the whole G17 backend from the firmware's fault mode, with the reason in the comment, is what we were after. We will run robustness2 and the unmapped-read probes on our A18 Pro and M4 Pro and post them here. |
|
Row from our A18 Pro (MacBook Neo, T8140, G17P), as offered: production 7.3.0-40 vs the same tree plus this PR (fault_control default), one-shot boot, same machine.
So no regression on G17P. An M4 Pro row is still queued. |
|
Row from our M4 Pro (J616s, T6040, G17P profile): production fleet kernel vs the same tree plus this PR, one-shot boot.
Together with the A18 Pro row above: no regression on either G17 machine we have. |
Turns
DRM_ASAHI_FEATURE_SOFT_FAULTSback on for every GPU the G17 backend drives. One commit.6f7faee (our #391) turned it off on G17 because every robustness2 rgba32
vertex_attribute_fetchcase read non-zero data with it on. The explanation in that commit was wrong. Mesa pointed out-of-bounds vec3/vec4 vertex fetches at address 0 plus index times stride. On G17 that range is not unmapped. Once a client runs compute work,install_job_context_aliases()maps the execution context's null view (CONTEXT_VIEWS[0]) at VA 0..0x10000, and userspace maps the other context views up to 0x74000. The fetches read the render context from there. Mesa stopped redirecting robust fetches to address 0 on G17 in 4115628b637f ("asahi: explicitly bound robust native vector vertex fetches").The G17 firmware has no fault_control word, but its own fault mode already gives soft faults. That is a property of the firmware family, not of the SoC: the driver gives every G17 queue the same fault setting (
QueueConfig::unk_66= 1, the word the M5 firmware namessoft_fault_enabled). So there is no per-SoC field.supports_soft_faults()ing17/mod.rsadvertises the bit wheneverfault_controlkeeps its 0xb default, as on the other generations. The commit also notes in the driver and in the uAPI doc that the first 0x74000 bytes of a G17 VM hold the context views, so userspace must not use them as a zero sink.How tested (M4 Pro T6040, firmware 25G83, the only part measured):
vertex_attribute_fetchcases pass when run directly with deqp-vk. A kprobe onmap_pagesshowed that those cases run in VMs whose VA 0 holds the null view.drivers/gpu/drm/asahi/with the M5 backend enabled is clean (no new warnings); checkpatch clean; asahi KUnit 685 pass / 1 skip.Not measured: T6041 (M4 Max), T8140 (A18 Pro), T8142 and T6050 (M5). The same unmapped-read probe and the robustness run would show any part that differs. RyanTheTide offered to run robustness2 and the unmapped-read probes on an A18 Pro and an M4 Pro.
For the speed-up, Mesa has to use the bit on G17P. Shared Mesa currently keeps G17P code generation independent of soft faults. With soft-fault bounded uniform loads and load speculation enabled on G17P, Cyberpunk 2077 runs 7.3% faster on the M4 Pro. The Mesa side is not part of this PR.
🤖 Generated with Claude Code