From a2eebbf43cda57bcd496ce3b8aa09cfaba7e837d Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 Aug 2023 08:53:12 +0200 Subject: [PATCH] 5.10-stable patches added patches: drm-ttm-make-ttm_bo_unpin-more-defensive.patch --- ...ttm-make-ttm_bo_unpin-more-defensive.patch | 38 +++++++++++++++++++ queue-5.10/series | 1 + 2 files changed, 39 insertions(+) create mode 100644 queue-5.10/drm-ttm-make-ttm_bo_unpin-more-defensive.patch diff --git a/queue-5.10/drm-ttm-make-ttm_bo_unpin-more-defensive.patch b/queue-5.10/drm-ttm-make-ttm_bo_unpin-more-defensive.patch new file mode 100644 index 00000000000..fad5405498c --- /dev/null +++ b/queue-5.10/drm-ttm-make-ttm_bo_unpin-more-defensive.patch @@ -0,0 +1,38 @@ +From 6c5403173a13a08ff61dbdafa4c0ed4a9dedbfe0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Christian=20K=C3=B6nig?= +Date: Fri, 12 Mar 2021 09:34:39 +0100 +Subject: drm/ttm: make ttm_bo_unpin more defensive +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Christian König + +commit 6c5403173a13a08ff61dbdafa4c0ed4a9dedbfe0 upstream. + +We seem to have some more driver bugs than thought. + +Signed-off-by: Christian König +Fixes: deb0814b43f3 ("drm/ttm: add ttm_bo_pin()/ttm_bo_unpin() v2") +Acked-by: Matthew Auld +Link: https://patchwork.freedesktop.org/patch/msgid/20210312093810.2202-1-christian.koenig@amd.com +Signed-off-by: Greg Kroah-Hartman +--- + include/drm/ttm/ttm_bo_api.h | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/include/drm/ttm/ttm_bo_api.h ++++ b/include/drm/ttm/ttm_bo_api.h +@@ -628,8 +628,10 @@ static inline void ttm_bo_pin(struct ttm + static inline void ttm_bo_unpin(struct ttm_buffer_object *bo) + { + dma_resv_assert_held(bo->base.resv); +- WARN_ON_ONCE(!bo->pin_count); +- --bo->pin_count; ++ if (bo->pin_count) ++ --bo->pin_count; ++ else ++ WARN_ON_ONCE(true); + } + + int ttm_mem_evict_first(struct ttm_bo_device *bdev, diff --git a/queue-5.10/series b/queue-5.10/series index 9a74107e1ce..20f97d6b748 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -103,3 +103,4 @@ s390-dasd-fix-hanging-device-after-quiesce-resume.patch asoc-wm8904-fill-the-cache-for-wm8904_adc_test_0-register.patch ceph-never-send-metrics-if-disable_send_metrics-is-set.patch dm-cache-policy-smq-ensure-io-doesn-t-prevent-cleaner-policy-progress.patch +drm-ttm-make-ttm_bo_unpin-more-defensive.patch -- 2.47.3