Skip to contentSkip to conversation

drm/ttm: Should to return the evict error

PATCH In review Emily Deng 3 participants 5 messages Jun 3, 2025 – Jun 10, 2025

Subsystems (3)
lore
Share & tools
lore

Emily Deng

author
#0 lore raw

PATCH v3 1/1 drm/ttm: Should to return the evict error

For the evict fail case, the evict error should be returned.

v2: Consider ENOENT case.

v3: Abort directly when the eviction failed for some reason (except for -ENOENT)
and not wait for the move to finish

---
 drivers/gpu/drm/ttm/ttm_resource.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/ttm/ttm_resource.c +3 -0
index 7e5a60c55813..bb84528276cd 100644
@@ -558,6 +558,9 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev,
 		cond_resched();
 	} while (!ret);
 
+	if (ret && ret != -ENOENT)
+		return ret;
+
 	spin_lock(&man->move_lock);
 	fence = dma_fence_get(man->move);
 	spin_unlock(&man->move_lock);
Signature · 1 line
2.34.1
#1 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Hi Christian,
Could you help to review again?

Emily Deng
Best Wishes

Quoted 35 lines

-----Original Message-----
From: Emily Deng <[email protected]>
Sent: Tuesday, June 3, 2025 5:12 PM
To: [email protected]
Cc: Deng, Emily <[email protected]>
Subject: [PATCH v3] drm/ttm: Should to return the evict error

For the evict fail case, the evict error should be returned.

v2: Consider ENOENT case.

v3: Abort directly when the eviction failed for some reason (except for -ENOENT) and not wait for the move to finish

---
drivers/gpu/drm/ttm/ttm_resource.c | 3 +++

1 file changed, 3 insertions(+)
drivers/gpu/drm/ttm/ttm_resource.c +3 -1
index 7e5a60c55813..bb84528276cd 100644
@@ -558,6 +558,9 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev,
              cond_resched();
      } while (!ret);
 
+      if (ret && ret != -ENOENT)
+              return ret;
+
      spin_lock(&man->move_lock);
      fence = dma_fence_get(man->move);
      spin_unlock(&man->move_lock);
--

2.34.1

Reviewed-by on v3 1/1
#2 lore raw
In reply to Emily Deng
Quoted 8 lines · Emily Deng

For the evict fail case, the evict error should be returned.

v2: Consider ENOENT case.

v3: Abort directly when the eviction failed for some reason (except for -ENOENT)
and not wait for the move to finish

Quoted 18 lines
---
 drivers/gpu/drm/ttm/ttm_resource.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/ttm/ttm_resource.c +3 -0
index 7e5a60c55813..bb84528276cd 100644
@@ -558,6 +558,9 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev,
 		cond_resched();
 	} while (!ret);
 
+	if (ret && ret != -ENOENT)
+		return ret;
+
 	spin_lock(&man->move_lock);
 	fence = dma_fence_get(man->move);
 	spin_unlock(&man->move_lock);
#3 lore raw
Quoted 4 lines · Christian König
Quoted 2 lines · Emily Deng

For the evict fail case, the evict error should be returned.

Quoted 8 lines
Quoted 6 lines

v2: Consider ENOENT case.

v3: Abort directly when the eviction failed for some reason (except for -ENOENT)
and not wait for the move to finish

Did you push this to drm-misc?

Alex

Quoted 20 lines
Quoted 19 lines
---
 drivers/gpu/drm/ttm/ttm_resource.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/ttm/ttm_resource.c +3 -0
index 7e5a60c55813..bb84528276cd 100644
@@ -558,6 +558,9 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev,
              cond_resched();
      } while (!ret);
 
+     if (ret && ret != -ENOENT)
+             return ret;
+
      spin_lock(&man->move_lock);
      fence = dma_fence_get(man->move);
      spin_unlock(&man->move_lock);
#4 lore raw
Quoted 7 lines · Alex Deucher
Quoted 6 lines · Christian König
Quoted 4 lines · Emily Deng

For the evict fail case, the evict error should be returned.

v2: Consider ENOENT case.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

v3: Abort directly when the eviction failed for some reason (except for -ENOENT)
and not wait for the move to finish

Did you push this to drm-misc?

Not yet, I wanted to take care of it this morning.

Christian.

Quoted 23 lines

Alex

Quoted 20 lines
Quoted 19 lines
---
 drivers/gpu/drm/ttm/ttm_resource.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/ttm/ttm_resource.c +3 -0
index 7e5a60c55813..bb84528276cd 100644
@@ -558,6 +558,9 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev,
              cond_resched();
      } while (!ret);
 
+     if (ret && ret != -ENOENT)
+             return ret;
+
      spin_lock(&man->move_lock);
      fence = dma_fence_get(man->move);
      spin_unlock(&man->move_lock);