Skip to contentSkip to conversation

drm/amdkfd: Allow device error to be logged

PATCH In review Sunday Clement 2 participants 2 messages Aug 20, 2025 – Aug 21, 2025

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

PATCH 1/1 drm/amdkfd: Allow device error to be logged

The addition of a WARN_ON() check in order to return early in the kq_initialize function retroactively causes the default case in the following switch statement to never be executed, preventing dev_err from logging device errors in the kernel. Both logs are now checked in the default case.

---
 drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c +2 -5
index 2b0a830f5b29..fb3129883a4c 100644
@@ -46,11 +46,7 @@ static bool kq_initialize(struct kernel_queue *kq, struct kfd_node *dev,
 	int retval;
 	union PM4_MES_TYPE_3_HEADER nop;
 
-	if (WARN_ON(type != KFD_QUEUE_TYPE_DIQ && type != KFD_QUEUE_TYPE_HIQ))
-		return false;
-
-	pr_debug("Initializing queue type %d size %d\n", KFD_QUEUE_TYPE_HIQ,
-			queue_size);
+	pr_debug("Initializing queue type %d size %d\n", type, queue_size);
 
 	memset(&prop, 0, sizeof(prop));
 	memset(&nop, 0, sizeof(nop));
@@ -69,6 +65,7 @@ static bool kq_initialize(struct kernel_queue *kq, struct kfd_node *dev,
 		kq->mqd_mgr = dev->dqm->mqd_mgrs[KFD_MQD_TYPE_HIQ];
 		break;
 	default:
+		WARN(1, "Invalid queue type %d\n", type);
 		dev_err(dev->adev->dev, "Invalid queue type %d\n", type);
 		return false;
 	}
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Clement, Sunday <[email protected]>
Sent: Wednesday, August 20, 2025 10:51 AM
To: [email protected]
Cc: Clement, Sunday <[email protected]>; Kuehling, Felix <[email protected]>; Kasiviswanathan, Harish <[email protected]>
Subject: [PATCH] drm/amdkfd: Allow device error to be logged

The addition of a WARN_ON() check in order to return early in the kq_initialize function retroactively causes the default case in the following switch statement to never be executed, preventing dev_err from logging device errors in the kernel. Both logs are now checked in the default case.

---
 drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c +2 -5
index 2b0a830f5b29..fb3129883a4c 100644
@@ -46,11 +46,7 @@ static bool kq_initialize(struct kernel_queue *kq, struct kfd_node *dev,
        int retval;
        union PM4_MES_TYPE_3_HEADER nop;
 
-       if (WARN_ON(type != KFD_QUEUE_TYPE_DIQ && type != KFD_QUEUE_TYPE_HIQ))
-               return false;
-
-       pr_debug("Initializing queue type %d size %d\n", KFD_QUEUE_TYPE_HIQ,
-                       queue_size);
+       pr_debug("Initializing queue type %d size %d\n", type, queue_size);
 
        memset(&prop, 0, sizeof(prop));
        memset(&nop, 0, sizeof(nop));
@@ -69,6 +65,7 @@ static bool kq_initialize(struct kernel_queue *kq, struct kfd_node *dev,
                kq->mqd_mgr = dev->dqm->mqd_mgrs[KFD_MQD_TYPE_HIQ];
                break;
        default:
+               WARN(1, "Invalid queue type %d\n", type);
                dev_err(dev->adev->dev, "Invalid queue type %d\n", type);
                return false;
        }

--
2.43.0