[PATCH] drm/amdkfd: fix the wrong no space return while acquires packet buffer

Huang Rui ray.huang at amd.com
Thu Mar 19 10:51:39 UTC 2020


The queue buffer index starts from position 0, so the available buffer size
which starts from position 0 to rptr should be "rptr" index value. While the
packet_size_in_dwords == rptr, the available buffer is just good enough.

Signed-off-by: Huang Rui <ray.huang at amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
index bae7064..4667c8f 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
@@ -263,7 +263,7 @@ int kq_acquire_packet_buffer(struct kernel_queue *kq,
 		/* make sure after rolling back to position 0, there is
 		 * still enough space.
 		 */
-		if (packet_size_in_dwords >= rptr)
+		if (packet_size_in_dwords > rptr)
 			goto err_no_space;
 
 		/* fill nops, roll back and start at position 0 */
-- 
2.7.4



More information about the amd-gfx mailing list