From: sashiko-bot@kernel.org
To: "Rob Clark" <robin.clark@oss.qualcomm.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v5 07/10] drm/msm: Don't fallback to shared VM for VM_BIND
Date: Thu, 16 Jul 2026 20:28:15 +0000 [thread overview]
Message-ID: <20260716202815.CE50B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260716201538.365824-8-robin.clark@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The fallback condition for `vm` in `msm_gpu_create_private_vm` incorrectly uses `!kernel_managed` instead of `kernel_managed`, breaking legacy contexts on older hardware and failing to prevent fallback for VM_BIND contexts.
--
--- Patch [7]: [PATCH v5 07/10] drm/msm: Don't fallback to shared VM for VM_BIND ---
commit fff36b547a5d97354f5a0baebf86eafdd34bd4f8
Author: Rob Clark <robin.clark@oss.qualcomm.com>
Date: Thu Jul 16 20:15:30 2026 +0000
drm/msm: Don't fallback to shared VM for VM_BIND
This commit modifies the fallback logic for VM creation to prevent userspace
managed VMs (VM_BIND) from falling back to the shared kernel-managed VM if
private VM creation fails.
[ ... ]
> diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
> index 18ed00e5f143b..d02c37380414b 100644
> --- a/drivers/gpu/drm/msm/msm_gpu.c
> +++ b/drivers/gpu/drm/msm/msm_gpu.c
> @@ -875,7 +875,7 @@ msm_gpu_create_private_vm(struct msm_gpu *gpu, struct task_struct *task,
> to_msm_vm(vm)->pid = get_pid(task_pid(task));
> }
>
> - if (IS_ERR_OR_NULL(vm))
> + if (IS_ERR_OR_NULL(vm) && !kernel_managed)
[Severity: High]
Does this boolean logic operate backwards from the stated intent of the patch?
If a legacy application runs on older hardware (A5xx or prior) that lacks
private VM support, kernel_managed is true. The !kernel_managed check
evaluates to false, skipping the fallback and returning NULL or an error.
Would this break command submission on these platforms?
Conversely, if a VM_BIND context (kernel_managed == false) fails to create
a private VM due to memory pressure, the !kernel_managed check evaluates to
true. This causes it to fall back to the kernel-managed shared VM, allowing
the very behavior the patch was trying to prevent.
If that VM_BIND fallback occurs, could it trigger a kernel panic later?
Userspace could issue a VM_BIND ioctl with a non-zero offset against the
erroneously assigned kernel-managed VM, hitting this BUG_ON:
drivers/gpu/drm/msm/msm_gem_vma.c:msm_gem_vma_new() {
...
if (vm->managed) {
BUG_ON(offset != 0);
BUG_ON(!obj);
...
}
> vm = drm_gpuvm_get(gpu->vm);
>
> return vm;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260716201538.365824-1-robin.clark@oss.qualcomm.com?part=7
next prev parent reply other threads:[~2026-07-16 20:28 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 20:15 [PATCH v5 00/10] drm/msm: A couple lazy-vm fixes Rob Clark
2026-07-16 20:15 ` [PATCH v5 01/10] drm/msm: Fix barriers accessing ctx vm Rob Clark
2026-07-16 20:31 ` sashiko-bot
2026-07-16 20:15 ` [PATCH v5 02/10] drm/msm: Rework queuelock Rob Clark
2026-07-16 20:39 ` sashiko-bot
2026-07-16 20:15 ` [PATCH v5 03/10] drm/msm: Synchronize VM creation on ctxlock Rob Clark
2026-07-16 20:33 ` sashiko-bot
2026-07-16 20:15 ` [PATCH v5 04/10] drm/msm/a6xx: Access VM directly in submit path Rob Clark
2026-07-16 20:43 ` sashiko-bot
2026-07-16 20:15 ` [PATCH v5 05/10] drm/msm: Add helper to check for per-process pgtables VM Rob Clark
2026-07-16 20:15 ` [PATCH v5 06/10] drm/msm: Allow lazy VM creation to fail Rob Clark
2026-07-16 20:33 ` sashiko-bot
2026-07-16 20:15 ` [PATCH v5 07/10] drm/msm: Don't fallback to shared VM for VM_BIND Rob Clark
2026-07-16 20:28 ` sashiko-bot [this message]
2026-07-16 20:15 ` [PATCH v5 08/10] drm/msm: Validate lazy VM in GEM_NEW Rob Clark
2026-07-16 20:29 ` sashiko-bot
2026-07-16 20:15 ` [PATCH v5 09/10] drm/msm: Fix per-process-pgtables check Rob Clark
2026-07-16 20:48 ` sashiko-bot
2026-07-16 20:15 ` [PATCH v5 10/10] drm/msm: Remove invalid overflow check Rob Clark
2026-07-16 20:34 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260716202815.CE50B1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=robin.clark@oss.qualcomm.com \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox