Skip to contentSkip to conversation

drm/ttm: soften TTM warnings

PATCH In review Christian König 3 participants 6 messages Mar 3, 2021 – Mar 4, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/ttm: soften TTM warnings

QXL indeed unrefs pinned BOs and the warnings are spamming peoples log files.

Make sure we warn only once until the QXL driver is fixed.

---
 drivers/gpu/drm/ttm/ttm_bo.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +3 -2
index 20a25660b35b..245fa2c05927 100644
@@ -136,7 +136,8 @@ void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo,
 	struct ttm_bo_device *bdev = bo->bdev;
 	struct ttm_resource_manager *man;
 
-	dma_resv_assert_held(bo->base.resv);
+	if (!bo->deleted)
+		dma_resv_assert_held(bo->base.resv);
 
 	if (bo->pin_count) {
 		ttm_bo_del_from_lru(bo);
@@ -509,7 +510,7 @@ static void ttm_bo_release(struct kref *kref)
 		 * shrinkers, now that they are queued for
 		 * destruction.
 		 */
-		if (WARN_ON(bo->pin_count)) {
+		if (WARN_ON_ONCE(bo->pin_count)) {
 			bo->pin_count = 0;
 			ttm_bo_move_to_lru_tail(bo, &bo->mem, NULL);
 		}
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 6 lines · Christian König

QXL indeed unrefs pinned BOs and the warnings are spamming peoples log files.

Make sure we warn only once until the QXL driver is fixed.

Can you pls add FIXME comments to each that qxl is broken and needs to be fixed first? Also please add a References: link to the bug report on lore.kernel.org or wherever it was.

With that: r-b: me
-Daniel

Quoted 30 lines
---
 drivers/gpu/drm/ttm/ttm_bo.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +3 -3
index 20a25660b35b..245fa2c05927 100644
@@ -136,7 +136,8 @@ void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo,
        struct ttm_bo_device *bdev = bo->bdev;
        struct ttm_resource_manager *man;
 
-       dma_resv_assert_held(bo->base.resv);
+       if (!bo->deleted)
+               dma_resv_assert_held(bo->base.resv);
 
        if (bo->pin_count) {
                ttm_bo_del_from_lru(bo);
@@ -509,7 +510,7 @@ static void ttm_bo_release(struct kref *kref)
                 * shrinkers, now that they are queued for
                 * destruction.
                 */
-               if (WARN_ON(bo->pin_count)) {
+               if (WARN_ON_ONCE(bo->pin_count)) {
                        bo->pin_count = 0;
                        ttm_bo_move_to_lru_tail(bo, &bo->mem, NULL);
                }
--

2.25.1

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

Am 03.03.21 um 18:19 schrieb Daniel Vetter:

Quoted 10 lines
Quoted 5 lines · Christian König

QXL indeed unrefs pinned BOs and the warnings are spamming peoples log files.

Make sure we warn only once until the QXL driver is fixed.

Can you pls add FIXME comments to each that qxl is broken and needs to be fixed first? Also please add a References: link to the bug report on lore.kernel.org or wherever it was.

Was there a bug report? I only got notifications by mail so far.

Christian.

Quoted 20 lines

With that: r-b: me
-Daniel

Quoted 16 lines
---
  drivers/gpu/drm/ttm/ttm_bo.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +2 -1
index 20a25660b35b..245fa2c05927 100644
@@ -136,7 +136,8 @@ void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo,
         struct ttm_bo_device *bdev = bo->bdev;
         struct ttm_resource_manager *man;
 
-       dma_resv_assert_held(bo->base.resv);
+       if (!bo->deleted)
+               dma_resv_assert_held(bo->base.resv);
 
Quoted 15 lines
Quoted 12 lines
drivers/gpu/drm/ttm/ttm_bo.c +1 -2
         if (bo->pin_count) {
                 ttm_bo_del_from_lru(bo);
@@ -509,7 +510,7 @@ static void ttm_bo_release(struct kref *kref)
                  * shrinkers, now that they are queued for
                  * destruction.
                  */
-               if (WARN_ON(bo->pin_count)) {
+               if (WARN_ON_ONCE(bo->pin_count)) {
                         bo->pin_count = 0;
                         ttm_bo_move_to_lru_tail(bo, &bo->mem, NULL);
                 }
--
Quoted 2 lines

2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 8 lines · Christian König

Am 03.03.21 um 18:19 schrieb Daniel Vetter:

Quoted 4 lines
Quoted 2 lines · Christian König

QXL indeed unrefs pinned BOs and the warnings are spamming peoples log files.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Make sure we warn only once until the QXL driver is fixed.

Can you pls add FIXME comments to each that qxl is broken and needs to be fixed first? Also please add a References: link to the bug report on lore.kernel.org or wherever it was.

Was there a bug report? I only got notifications by mail so far.

Well that's how bug reports work in the wider kernel community. You need to fish out the right link from mail archives and link to those.

Yes it's not great, but it's imo better to reference these bug reports than have nothing at all.
-Daniel

Quoted 39 lines

Christian.

Quoted 35 lines

With that: r-b: me
-Daniel

Quoted 30 lines
---
  drivers/gpu/drm/ttm/ttm_bo.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +3 -3
index 20a25660b35b..245fa2c05927 100644
@@ -136,7 +136,8 @@ void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo,
         struct ttm_bo_device *bdev = bo->bdev;
         struct ttm_resource_manager *man;
 
-       dma_resv_assert_held(bo->base.resv);
+       if (!bo->deleted)
+               dma_resv_assert_held(bo->base.resv);
 
         if (bo->pin_count) {
                 ttm_bo_del_from_lru(bo);
@@ -509,7 +510,7 @@ static void ttm_bo_release(struct kref *kref)
                  * shrinkers, now that they are queued for
                  * destruction.
                  */
-               if (WARN_ON(bo->pin_count)) {
+               if (WARN_ON_ONCE(bo->pin_count)) {
                         bo->pin_count = 0;
                         ttm_bo_move_to_lru_tail(bo, &bo->mem, NULL);
                 }
--

2.25.1

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 1/1
#4 lore raw
In reply to Christian König

drivers/gpu/drm/ttm/ttm_bo.c void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo, · line 140

Quoted 7 lines · Christian König

QXL indeed unrefs pinned BOs and the warnings are spamming peoples log files.

Make sure we warn only once until the QXL driver is fixed.

drivers/gpu/drm/ttm/ttm_bo.c +2 -1
-	dma_resv_assert_held(bo->base.resv);
+	if (!bo->deleted)
+		dma_resv_assert_held(bo->base.resv);

Hmm? I'm not aware of qxl having problems with this one. Did I miss something?

drivers/gpu/drm/ttm/ttm_bo.c static void ttm_bo_release(struct kref *kref) · line 513

Quoted 2 lines
drivers/gpu/drm/ttm/ttm_bo.c +1 -1
-		if (WARN_ON(bo->pin_count)) {
+		if (WARN_ON_ONCE(bo->pin_count)) {

Well, as temporary thing this is rather pointless, qxl fix for this one is already queued in drm-misc-fixes so this would only land after the qxl fixes ...

But I think using WARN_ON_ONCE() is a good idea in general, especially in a code path like this where a single bug can easily cause a flood of stack traces.

take care,
Gerd

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw

Am 04.03.21 um 15:05 schrieb Gerd Hoffmann:

Quoted 9 lines · Christian König

drivers/gpu/drm/ttm/ttm_bo.c void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo, · line 140

Quoted 6 lines

QXL indeed unrefs pinned BOs and the warnings are spamming peoples log files.

Make sure we warn only once until the QXL driver is fixed.

drivers/gpu/drm/ttm/ttm_bo.c +2 -1
-	dma_resv_assert_held(bo->base.resv);
+	if (!bo->deleted)
+		dma_resv_assert_held(bo->base.resv);

Hmm? I'm not aware of qxl having problems with this one. Did I miss something?

See the mail from Peter, but asserts were triggered when the pin_count was non zero and destruction.

Quoted 10 lines

drivers/gpu/drm/ttm/ttm_bo.c static void ttm_bo_release(struct kref *kref) · line 513

Quoted 3 lines
drivers/gpu/drm/ttm/ttm_bo.c +1 -1
-		if (WARN_ON(bo->pin_count)) {
+		if (WARN_ON_ONCE(bo->pin_count)) {

Well, as temporary thing this is rather pointless, qxl fix for this one is already queued in drm-misc-fixes so this would only land after the qxl fixes ...

But I think using WARN_ON_ONCE() is a good idea in general, especially in a code path like this where a single bug can easily cause a flood of stack traces.

Well that flood of stack traces can also be helpful, cause it makes people report such kind of issues immediately.

Anyway I'm going to keep that WARN_ON_ONCE for a cycle or two and if I don't hear any more complains I'm going to completely remove this "feature" and just always warn when we see a non zero pin_count on destruction.

Christian.

Quoted 6 lines

take care,
Gerd

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel