From: sashiko-bot@kernel.org
To: "Gyeyoung Baek" <gye976@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/imagination: Switch the GPUVM to immediate mode
Date: Sat, 10 Oct 2026 17:36:07 +0000 [thread overview]
Message-ID: <sashiko-outbox-166779@kernel.org> (raw)
In-Reply-To: <20261011-pvr-gpuvm-immediate-v1-1-5b298dfce4f8@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/imagination: memory leak of gpuvm_bo on pvr_vm_map error path
--
commit 191fc7b0dba1141708c7edc0b3aeac368ef8588f
Author: Gyeyoung Baek <gye976@gmail.com>
drm/imagination: Switch the GPUVM to immediate mode
This commit switches the GPUVM to immediate mode so that each GEM's GPUVA list
is protected by its gpuva.lock. It introduces deferred operations such as
drm_gpuvm_bo_put_deferred() and cleanup via drm_gpuvm_bo_deferred_cleanup().
> diff --git a/drivers/gpu/drm/imagination/pvr_vm.c b/drivers/gpu/drm/imagination/pvr_vm.c
> --- a/drivers/gpu/drm/imagination/pvr_vm.c
> +++ b/drivers/gpu/drm/imagination/pvr_vm.c
[ ... ]
> @@ -214,7 +214,7 @@ static int pvr_vm_bind_op_exec(struct pvr_vm_bind_op *bind_op)
>
> static void pvr_vm_bind_op_fini(struct pvr_vm_bind_op *bind_op)
> {
> - drm_gpuvm_bo_put(bind_op->gpuvm_bo);
> + drm_gpuvm_bo_put_deferred(bind_op->gpuvm_bo);
>
> kfree(bind_op->new_va);
> kfree(bind_op->prev_va);
[ ... ]
> @@ -758,7 +769,9 @@ pvr_vm_map(struct pvr_vm_context *vm_ctx, struct pvr_gem_object *pvr_obj,
>
> err_cleanup:
> mutex_unlock(&vm_ctx->lock);
> +
> pvr_vm_bind_op_fini(&bind_op);
> + drm_gpuvm_bo_deferred_cleanup(&vm_ctx->gpuvm_mgr);
>
> return err;
> }
[Severity: High]
Does this code leak the gpuvm_bo and the referenced drm_gem_object on the
early error path of pvr_vm_map()?
If pvr_vm_bind_op_map_init() fails internally (for example, if memory is
exhausted when calling pvr_gem_object_get_pages_sgt()), it takes its own
error path:
pvr_vm_bind_op_map_init() {
...
err_bind_op_fini:
pvr_vm_bind_op_fini(bind_op);
return err;
}
This calls the newly modified pvr_vm_bind_op_fini(), which places the BO onto
the gpuvm_mgr bo_defer list via drm_gpuvm_bo_put_deferred().
However, back in pvr_vm_map(), the early return bypasses the newly added
cleanup call:
pvr_vm_map() {
...
int err = pvr_vm_bind_op_map_init(&bind_op, vm_ctx, pvr_obj,
pvr_obj_offset, device_addr,
size);
if (err)
return err;
...
}
Because drm_gpuvm_bo_deferred_cleanup() is bypassed here, would this cause an
unbounded accumulation of leaked BOs on the bo_defer list? Can this be fixed
by ensuring the cleanup function is also called on this early return path?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261011-pvr-gpuvm-immediate-v1-0-5b298dfce4f8@gmail.com?part=1
next prev parent reply other threads:[~2026-10-10 17:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-10 17:22 [PATCH 0/2] drm/imagination: Switch the GPUVM to immediate mode Gyeyoung Baek
2026-10-10 17:22 ` [PATCH 1/2] " Gyeyoung Baek
2026-10-10 17:36 ` sashiko-bot [this message]
2026-10-11 5:31 ` Gyeyoung Baek
2026-10-10 17:22 ` [PATCH 2/2] drm/imagination: Stop locking reservations around map and unmap Gyeyoung Baek
2026-10-10 17:36 ` 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=sashiko-outbox-166779@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gye976@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.