From db1d6d92abec4f657ced2306f8d7d7982c1d1ec9 Mon Sep 17 00:00:00 2001 From: Yifan Zhang Date: Tue, 14 Sep 2021 16:19:46 +0800 Subject: [PATCH] libhsakmt: dump errno the queue destroy fails. to faciliate debugging, print errno when queue destroy fail current log give very little information when fail: [ RUN ] KFDQMTest.AllSdmaQueues [ ] Regular SDMA engines number: 1 SDMA queues per engine: 2 [ OK ] KFDQMTest.AllSdmaQueues (11 ms) [ RUN ] KFDQMTest.AllXgmiSdmaQueues [ ] XGMI SDMA engines number: 0 SDMA queues per engine: 2 [ OK ] KFDQMTest.AllXgmiSdmaQueues (6 ms) [ RUN ] KFDQMTest.AllQueues /home/foreman/build/hsakmt-roct-amdgpu-1.0.9.40500/sources/libhsakmt/tests/kfdtest/src/KFDQMTest.cpp:381: Failure Value of: (cpQueues[i].Destroy()) Actual: 1 Expected: HSAKMT_STATUS_SUCCESS Which is: 0 Signed-off-by: Yifan Zhang Change-Id: I5b1b5b616a5fd7ff198360c893a7aeed685022bd --- src/queues.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/queues.c b/src/queues.c index 1615aa9d93..51fc0bebd9 100644 --- a/src/queues.c +++ b/src/queues.c @@ -637,8 +637,10 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtDestroyQueue(HSA_QUEUEID QueueId) int err = kmtIoctl(kfd_fd, AMDKFD_IOC_DESTROY_QUEUE, &args); - if (err == -1) + if (err == -1) { + pr_err("Failed to destroy queue: %s\n", strerror(errno)); return HSAKMT_STATUS_ERROR; + } free_queue(q); return HSAKMT_STATUS_SUCCESS;