Repository navigation
Conversation
|
@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 <256263590+Alyx-ML@users.noreply.github.com>
|
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) |
fef478c to
6305df3
Compare
|
@Alyx-ML |
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.