Repository navigation
Conversation
Contributor
|
@Alyx-ML checking open drafts today. To come out of draft, this still needs:
If it's no longer needed, say so here and we'll close it. Otherwise it stays open as a draft until these are done. |
SUBMIT copies the command stream and the sync array into kmalloc() buffers (KVec), with sizes that userspace picks. kmalloc() warns when asked for more than KMALLOC_MAX_SIZE, and with panic_on_warn that warning stops the machine. G16 and G17 refuse a longer stream before the copy, but: - The default max_cmdbuf_size() is usize::MAX. The GPUs that do not override it (g14_v27_2, G15, G18, M3 and M5) copy a stream of any size the ioctl allows. - G15's parser refuses a stream over its 4 MiB MAX_CMDBUF, but only after the copy. - parse_array() sizes the sync array from in_sync_count plus out_sync_count with no bound. - VM_BIND copies stride * num_binds bytes. A GPU without a bind batch limit does not bound either one. Make KMALLOC_MAX_SIZE the default bound, as g17::command::MAX_STREAM already asserts for G17. Have G15 return its MAX_CMDBUF, as G16 does, so a longer stream fails with E2BIG before the copy instead of EINVAL after it. Refuse a sync array larger than KMALLOC_MAX_SIZE with E2BIG. Charge both copies to the caller's memcg (GFP_KERNEL_ACCOUNT), since userspace picks their size. Copy the VM_BIND array with __GFP_NOWARN, so an oversized one fails with ENOMEM and no warning. No stream that could be copied before is refused: a larger copy already failed in kmalloc(), with the warning. G15 and G16 accept at most 4 MiB, and G17's MAX_STREAM is checked at build time to be at most KMALLOC_MAX_SIZE on arm64. The earlier version of this change also moved both copies to kvmalloc() and gave G17 its own bound. main has since given G17 MAX_STREAM and keeps the copies in kmalloc() buffers, so this version follows that. Signed-off-by: Alyx-ML <[email protected]>
Contributor
Author
|
Rebased onto
I have updated the description. No stream that could be copied before is refused. It still Assisted-by: LLM (Claude:Opus 5.5) |
Alyx-ML
force-pushed
the
aurora/asahi-submit-alloc
branch
from
November 27, 2026 01:14
fef478c to
6305df3
Compare
This branch has not been deployed
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.
Part of the #2755 split. Draft: it needs deqp-vk or CTS runs.
Summary
Evidence
(
WARN_ON_ONCE_GFP()), which stops the machine under panic_on_warn. G15, G18, M3, M5 andg14_v27_2 had no bound before the copy.
mainand checked with rustfmt. My fork's Actions could not run, so thePR's own CI is the build and KUnit
asahicheck at this head.Merge Danger
Door: two-way
Blast Radius: every GPU's SUBMIT
On G15, a stream over 4 MiB, which its parser refused after the copy with EINVAL, now fails
before it with E2BIG. On the GPUs without their own bound, a stream over KMALLOC_MAX_SIZE fails
with E2BIG instead of a warning and ENOMEM.