diff options
author | Boris Brezillon <boris.brezillon@collabora.com> | 2019-11-29 14:59:08 +0100 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2020-02-03 11:23:21 +0000 |
commit | 7e0cf7e9936c4358b0863357b90aa12afe6489da (patch) | |
tree | dcc48a883e1e10ddef9ba7f8791d2894a66d7bf9 /drivers/gpu/drm/panfrost/panfrost_job.c | |
parent | 8ccb5bf7619c6523e7a4384a84b72e7be804298c (diff) | |
download | lwn-7e0cf7e9936c4358b0863357b90aa12afe6489da.tar.gz lwn-7e0cf7e9936c4358b0863357b90aa12afe6489da.zip |
drm/panfrost: Make sure the shrinker does not reclaim referenced BOs
Userspace might tag a BO purgeable while it's still referenced by GPU
jobs. We need to make sure the shrinker does not purge such BOs until
all jobs referencing it are finished.
Fixes: 013b65101315 ("drm/panfrost: Add madvise and shrinker support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20191129135908.2439529-9-boris.brezillon@collabora.com
Diffstat (limited to 'drivers/gpu/drm/panfrost/panfrost_job.c')
-rw-r--r-- | drivers/gpu/drm/panfrost/panfrost_job.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c index e364ee00f3d0..4d383831c1fc 100644 --- a/drivers/gpu/drm/panfrost/panfrost_job.c +++ b/drivers/gpu/drm/panfrost/panfrost_job.c @@ -269,8 +269,13 @@ static void panfrost_job_cleanup(struct kref *ref) dma_fence_put(job->render_done_fence); if (job->mappings) { - for (i = 0; i < job->bo_count; i++) + for (i = 0; i < job->bo_count; i++) { + if (!job->mappings[i]) + break; + + atomic_dec(&job->mappings[i]->obj->gpu_usecount); panfrost_gem_mapping_put(job->mappings[i]); + } kvfree(job->mappings); } |