Skip to contentSkip to conversation

drm/panthor: Kill the faulty_slots variable in panthor_sched_suspend()

PATCH In review Boris Brezillon 4 participants 5 messages Apr 25, 2024 – May 2, 2024

Subsystems (3)
lore
Share & tools
lore

Boris Brezillon

author maintainer
#0 lore raw

PATCH 1/1 drm/panthor: Kill the faulty_slots variable in panthor_sched_suspend()

We can use upd_ctx.timedout_mask directly, and the faulty_slots update in the flush_caches_failed situation is never used.

---
 drivers/gpu/drm/panthor/panthor_sched.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/gpu/drm/panthor/panthor_sched.c +3 -7
index fad4678ca4c8..fed28c16d5d1 100644
@@ -2584,8 +2584,8 @@ void panthor_sched_suspend(struct panthor_device *ptdev)
 {
 	struct panthor_scheduler *sched = ptdev->scheduler;
 	struct panthor_csg_slots_upd_ctx upd_ctx;
-	u32 suspended_slots, faulty_slots;
 	struct panthor_group *group;
+	u32 suspended_slots;
 	u32 i;
 
 	mutex_lock(&sched->lock);
@@ -2605,10 +2605,9 @@ void panthor_sched_suspend(struct panthor_device *ptdev)
 
 	csgs_upd_ctx_apply_locked(ptdev, &upd_ctx);
 	suspended_slots &= ~upd_ctx.timedout_mask;
-	faulty_slots = upd_ctx.timedout_mask;
 
-	if (faulty_slots) {
-		u32 slot_mask = faulty_slots;
+	if (upd_ctx.timedout_mask) {
+		u32 slot_mask = upd_ctx.timedout_mask;
 
 		drm_err(&ptdev->base, "CSG suspend failed, escalating to termination");
 		csgs_upd_ctx_init(&upd_ctx);
@@ -2659,9 +2658,6 @@ void panthor_sched_suspend(struct panthor_device *ptdev)
 
 			slot_mask &= ~BIT(csg_id);
 		}
-
-		if (flush_caches_failed)
-			faulty_slots |= suspended_slots;
 	}
 
 	for (i = 0; i < sched->csg_slot_count; i++) {
Signature · 1 line
2.44.0
#1 lore raw
Quoted 5 lines · Boris Brezillon

We can use upd_ctx.timedout_mask directly, and the faulty_slots update
in the flush_caches_failed situation is never used.

Whoops? :)

Quoted 47 lines

---
 drivers/gpu/drm/panthor/panthor_sched.c | 10 +++-------

 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/gpu/drm/panthor/panthor_sched.c +1 -1
index fad4678ca4c8..fed28c16d5d1 100644
@@ -2584,8 +2584,8 @@ void panthor_sched_suspend(struct
 panthor_device *ptdev)
  {
  	struct panthor_scheduler *sched = ptdev->scheduler;
  	struct panthor_csg_slots_upd_ctx upd_ctx;
-	u32 suspended_slots, faulty_slots;
  	struct panthor_group *group;
+	u32 suspended_slots;
  	u32 i;


  mutex_lock(&sched->lock);

drivers/gpu/drm/panthor/panthor_sched.c +0 -0
@@ -2605,10 +2605,9 @@ void panthor_sched_suspend(struct
 panthor_device *ptdev)


  csgs_upd_ctx_apply_locked(ptdev, &upd_ctx); suspended_slots &= ~upd_ctx.timedout_mask;

drivers/gpu/drm/panthor/panthor_sched.c +0 -1
-	faulty_slots = upd_ctx.timedout_mask;

drivers/gpu/drm/panthor/panthor_sched.c +2 -2
-	if (faulty_slots) {
-		u32 slot_mask = faulty_slots;
+	if (upd_ctx.timedout_mask) {
+		u32 slot_mask = upd_ctx.timedout_mask;


  drm_err(&ptdev->base, "CSG suspend failed, escalating to termination"); csgs_upd_ctx_init(&upd_ctx);

drivers/gpu/drm/panthor/panthor_sched.c +0 -0
@@ -2659,9 +2658,6 @@ void panthor_sched_suspend(struct
 panthor_device *ptdev)


  slot_mask &= ~BIT(csg_id); }

drivers/gpu/drm/panthor/panthor_sched.c +0 -3
-
-		if (flush_caches_failed)
-			faulty_slots |= suspended_slots;

  }

  for (i = 0; i < sched->csg_slot_count; i++) {

maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Boris Brezillon
Quoted 4 lines · Boris Brezillon

We can use upd_ctx.timedout_mask directly, and the faulty_slots update in the flush_caches_failed situation is never used.

I'm obviously too full of suggestions! ;)

And you're doing a much better job of my todo list than I am!

Quoted 1 line
Quoted 41 lines
---
 drivers/gpu/drm/panthor/panthor_sched.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/gpu/drm/panthor/panthor_sched.c +3 -7
index fad4678ca4c8..fed28c16d5d1 100644
@@ -2584,8 +2584,8 @@ void panthor_sched_suspend(struct panthor_device *ptdev)
 {
 	struct panthor_scheduler *sched = ptdev->scheduler;
 	struct panthor_csg_slots_upd_ctx upd_ctx;
-	u32 suspended_slots, faulty_slots;
 	struct panthor_group *group;
+	u32 suspended_slots;
 	u32 i;
 
 	mutex_lock(&sched->lock);
@@ -2605,10 +2605,9 @@ void panthor_sched_suspend(struct panthor_device *ptdev)
 
 	csgs_upd_ctx_apply_locked(ptdev, &upd_ctx);
 	suspended_slots &= ~upd_ctx.timedout_mask;
-	faulty_slots = upd_ctx.timedout_mask;
 
-	if (faulty_slots) {
-		u32 slot_mask = faulty_slots;
+	if (upd_ctx.timedout_mask) {
+		u32 slot_mask = upd_ctx.timedout_mask;
 
 		drm_err(&ptdev->base, "CSG suspend failed, escalating to termination");
 		csgs_upd_ctx_init(&upd_ctx);
@@ -2659,9 +2658,6 @@ void panthor_sched_suspend(struct panthor_device *ptdev)
 
 			slot_mask &= ~BIT(csg_id);
 		}
-
-		if (flush_caches_failed)
-			faulty_slots |= suspended_slots;
 	}
 
 	for (i = 0; i < sched->csg_slot_count; i++) {
author maintainer Applied
#3 lore raw
Quoted 7 lines · On Thu, 25 Apr 2024 12:18:29 +0100 Steven Price <[email protected]> wrote:
Quoted 4 lines · Boris Brezillon

We can use upd_ctx.timedout_mask directly, and the faulty_slots update in the flush_caches_failed situation is never used.

I'm obviously too full of suggestions! ;)

Pushed to drm-misc-next-fixes, but I realize I forgot to drop the extra Suggested-by. Oh well.

Quoted 49 lines

And you're doing a much better job of my todo list than I am!

Quoted 1 line
Quoted 41 lines
---
 drivers/gpu/drm/panthor/panthor_sched.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/gpu/drm/panthor/panthor_sched.c +3 -7
index fad4678ca4c8..fed28c16d5d1 100644
@@ -2584,8 +2584,8 @@ void panthor_sched_suspend(struct panthor_device *ptdev)
 {
 	struct panthor_scheduler *sched = ptdev->scheduler;
 	struct panthor_csg_slots_upd_ctx upd_ctx;
-	u32 suspended_slots, faulty_slots;
 	struct panthor_group *group;
+	u32 suspended_slots;
 	u32 i;
 
 	mutex_lock(&sched->lock);
@@ -2605,10 +2605,9 @@ void panthor_sched_suspend(struct panthor_device *ptdev)
 
 	csgs_upd_ctx_apply_locked(ptdev, &upd_ctx);
 	suspended_slots &= ~upd_ctx.timedout_mask;
-	faulty_slots = upd_ctx.timedout_mask;
 
-	if (faulty_slots) {
-		u32 slot_mask = faulty_slots;
+	if (upd_ctx.timedout_mask) {
+		u32 slot_mask = upd_ctx.timedout_mask;
 
 		drm_err(&ptdev->base, "CSG suspend failed, escalating to termination");
 		csgs_upd_ctx_init(&upd_ctx);
@@ -2659,9 +2658,6 @@ void panthor_sched_suspend(struct panthor_device *ptdev)
 
 			slot_mask &= ~BIT(csg_id);
 		}
-
-		if (flush_caches_failed)
-			faulty_slots |= suspended_slots;
 	}
 
 	for (i = 0; i < sched->csg_slot_count; i++) {  
maintainer Reviewed-by on v1 1/1
#4 lore raw
In reply to Boris Brezillon
Quoted 5 lines · Boris Brezillon

We can use upd_ctx.timedout_mask directly, and the faulty_slots update in the flush_caches_failed situation is never used.

Best regards,
Liviu

Quoted 44 lines
---
 drivers/gpu/drm/panthor/panthor_sched.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/gpu/drm/panthor/panthor_sched.c +3 -7
index fad4678ca4c8..fed28c16d5d1 100644
@@ -2584,8 +2584,8 @@ void panthor_sched_suspend(struct panthor_device *ptdev)
 {
 	struct panthor_scheduler *sched = ptdev->scheduler;
 	struct panthor_csg_slots_upd_ctx upd_ctx;
-	u32 suspended_slots, faulty_slots;
 	struct panthor_group *group;
+	u32 suspended_slots;
 	u32 i;
 
 	mutex_lock(&sched->lock);
@@ -2605,10 +2605,9 @@ void panthor_sched_suspend(struct panthor_device *ptdev)
 
 	csgs_upd_ctx_apply_locked(ptdev, &upd_ctx);
 	suspended_slots &= ~upd_ctx.timedout_mask;
-	faulty_slots = upd_ctx.timedout_mask;
 
-	if (faulty_slots) {
-		u32 slot_mask = faulty_slots;
+	if (upd_ctx.timedout_mask) {
+		u32 slot_mask = upd_ctx.timedout_mask;
 
 		drm_err(&ptdev->base, "CSG suspend failed, escalating to termination");
 		csgs_upd_ctx_init(&upd_ctx);
@@ -2659,9 +2658,6 @@ void panthor_sched_suspend(struct panthor_device *ptdev)
 
 			slot_mask &= ~BIT(csg_id);
 		}
-
-		if (flush_caches_failed)
-			faulty_slots |= suspended_slots;
 	}
 
 	for (i = 0; i < sched->csg_slot_count; i++) {
Signature · 1 line
2.44.0
Signature · 8 lines
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯