Skip to content

Commit 084b9e1

Browse files
committed
drm/msm/gem: Unpin objects slightly later
The introduction of "drm/msm/gem: Evict active GEM objects when necessary" exposes a problem with "drm/msm/gem: Unpin buffers earlier", in that we need to keep the object pinned in the time the submit is queued up in the gpu scheduler. Otherwise the shrinker will see it as a thing that can be evicted if we wait for it to be signaled. But if the shrinker path is waiting on it with the obj lock held, the job cannot be scheduled, as that also requires briefly grabbing the obj lock, leading to deadlock. (Not to mention, we don't want the shrinker to evict an obj queued up in gpu scheduler.) Fixes: f371bcc ("drm/msm/gem: Unpin buffers earlier") Fixes: 025d272 ("drm/msm/gem: Evict active GEM objects when necessary") Closes: https://gitlab.freedesktop.org/drm/msm/-/issues/19 Signed-off-by: Rob Clark <[email protected]> Tested-by: Chia-I Wu <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/504528/ Link: https://lore.kernel.org/r/[email protected]
1 parent e8b595f commit 084b9e1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

drivers/gpu/drm/msm/msm_gem_submit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,11 +501,11 @@ static int submit_reloc(struct msm_gem_submit *submit, struct msm_gem_object *ob
501501
*/
502502
static void submit_cleanup(struct msm_gem_submit *submit, bool error)
503503
{
504-
unsigned cleanup_flags = BO_LOCKED | BO_OBJ_PINNED;
504+
unsigned cleanup_flags = BO_LOCKED;
505505
unsigned i;
506506

507507
if (error)
508-
cleanup_flags |= BO_VMA_PINNED;
508+
cleanup_flags |= BO_VMA_PINNED | BO_OBJ_PINNED;
509509

510510
for (i = 0; i < submit->nr_bos; i++) {
511511
struct msm_gem_object *msm_obj = submit->bos[i].obj;

drivers/gpu/drm/msm/msm_ringbuffer.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ static struct dma_fence *msm_job_run(struct drm_sched_job *job)
2525

2626
msm_gem_lock(obj);
2727
msm_gem_unpin_vma_fenced(submit->bos[i].vma, fctx);
28-
submit->bos[i].flags &= ~BO_VMA_PINNED;
28+
msm_gem_unpin_locked(obj);
29+
submit->bos[i].flags &= ~(BO_VMA_PINNED | BO_OBJ_PINNED);
2930
msm_gem_unlock(obj);
3031
}
3132

0 commit comments

Comments
 (0)