aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/panfrost/panfrost_gem.h
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@collabora.com>2019-11-29 14:59:08 +0100
committerRob Herring <robh@kernel.org>2020-02-03 11:23:21 +0000
commit7e0cf7e9936c4358b0863357b90aa12afe6489da (patch)
treedcc48a883e1e10ddef9ba7f8791d2894a66d7bf9 /drivers/gpu/drm/panfrost/panfrost_gem.h
parentdrm/mst: Fix possible NULL pointer dereference in drm_dp_mst_process_up_req() (diff)
downloadlinux-dev-7e0cf7e9936c4358b0863357b90aa12afe6489da.tar.xz
linux-dev-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_gem.h')
-rw-r--r--drivers/gpu/drm/panfrost/panfrost_gem.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.h b/drivers/gpu/drm/panfrost/panfrost_gem.h
index ca1bc9019600..b3517ff9630c 100644
--- a/drivers/gpu/drm/panfrost/panfrost_gem.h
+++ b/drivers/gpu/drm/panfrost/panfrost_gem.h
@@ -30,6 +30,12 @@ struct panfrost_gem_object {
struct mutex lock;
} mappings;
+ /*
+ * Count the number of jobs referencing this BO so we don't let the
+ * shrinker reclaim this object prematurely.
+ */
+ atomic_t gpu_usecount;
+
bool noexec :1;
bool is_heap :1;
};