diff options
author | Rob Clark <robdclark@chromium.org> | 2023-03-20 17:43:30 +0300 |
---|---|---|
committer | Rob Clark <robdclark@chromium.org> | 2023-03-26 02:31:44 +0300 |
commit | 6c7c8fb863f7c3137ce5fc4b435af3891083abeb (patch) | |
tree | bd9d2960eac290a05d57e67ac84c0b6ef894937f /drivers/gpu/drm/msm/msm_gem.h | |
parent | 4a02a376cbc839b89bbd1109f98b461e26337236 (diff) | |
download | linux-6c7c8fb863f7c3137ce5fc4b435af3891083abeb.tar.xz |
drm/msm/gem: Protect pin_count/madv by LRU lock
Since the LRU lock is already acquired when moving an obj between LRUs,
we can use it to protect pin_count and madv, without any significant
change in locking (ie. it just expands the scope of the lock by a hand-
ful of instructions). This prepares the way to decrement the pin_count
in the job_run() path without needing to hold the obj lock, to avoid a
potential deadlock (or rather stall) caused by the fence-signaling path
(job_run()) blocking on shrinker/reclaim. (Only a stall because the
wait for fence signaling wait_for_idle() is not infinite.)
Signed-off-by: Rob Clark <robdclark@chromium.org>
Patchwork: https://patchwork.freedesktop.org/patch/527843/
Link: https://lore.kernel.org/r/20230320144356.803762-9-robdclark@gmail.com
Diffstat (limited to 'drivers/gpu/drm/msm/msm_gem.h')
-rw-r--r-- | drivers/gpu/drm/msm/msm_gem.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gpu/drm/msm/msm_gem.h b/drivers/gpu/drm/msm/msm_gem.h index 1929f09c5b0d..0057e8e8fa13 100644 --- a/drivers/gpu/drm/msm/msm_gem.h +++ b/drivers/gpu/drm/msm/msm_gem.h @@ -86,7 +86,9 @@ struct msm_gem_object { uint32_t flags; /** - * Advice: are the backing pages purgeable? + * madv: are the backing pages purgeable? + * + * Protected by obj lock and LRU lock */ uint8_t madv; @@ -114,6 +116,11 @@ struct msm_gem_object { char name[32]; /* Identifier to print for the debugfs files */ + /** + * pin_count: Number of times the pages are pinned + * + * Protected by LRU lock. + */ int pin_count; }; #define to_msm_bo(x) container_of(x, struct msm_gem_object, base) |