[Public]

-----Original Message-----
From: Clement, Sunday <sunday.clem...@amd.com>
Sent: Friday, May 30, 2025 11:17 AM
To: amd-gfx@lists.freedesktop.org
Cc: Tudor, Alexandru <alexandru.tu...@amd.com>; Kasiviswanathan, Harish 
<harish.kasiviswanat...@amd.com>; Clement, Sunday <sunday.clem...@amd.com>
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.

Signed-off-by: Sunday Clement <sunday.clem...@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
index 2b0a830f5b29..fb3129883a4c 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
@@ -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;
[HKI] If you want the dev_err to be printed it might be better to move the 
following statement inside the if condition

dev_err(dev->adev->dev, "Invalid queue type %d\n", type);

-
-       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

Reply via email to