Skip to contentSkip to conversation

drm/amdkfd: fix the kdf debugger issue

PATCH In review Jesse Zhang 2 participants 2 messages May 30, 2024

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

PATCH 2/8 drm/amdkfd: fix the kdf debugger issue

the expression caps | HSA_CAP_TRAP_DEBUG_PRECISE_MEMORY_OPERATIONS_SUPPORTED is always 1/true regardless of the values of its operand.

---
 drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_debug.c +1 -1
index 3f27bab7a502..4abd275056d6 100644
@@ -503,7 +503,7 @@ int kfd_dbg_trap_set_flags(struct kfd_process *target, uint32_t *flags)
 				kfd_topology_device_by_id(target->pdds[i]->dev->id);
 		uint32_t caps = topo_dev->node_props.capability;
 
-		if (!(caps | HSA_CAP_TRAP_DEBUG_PRECISE_MEMORY_OPERATIONS_SUPPORTED) &&
+		if (!(caps & HSA_CAP_TRAP_DEBUG_PRECISE_MEMORY_OPERATIONS_SUPPORTED) &&
 			(*flags & KFD_DBG_TRAP_FLAG_SINGLE_MEM_OP)) {
 			*flags = prev_flags;
 			return -EACCES;
Signature · 1 line
2.25.1
maintainer Tested-by Lancelot Six Reviewed-by Eric Huang on v1 2/8
#1 lore raw
Quoted 4 lines · Jesse Zhang

the expression caps | HSA_CAP_TRAP_DEBUG_PRECISE_MEMORY_OPERATIONS_SUPPORTED is always 1/true regardless of the values of its operand.

Please add a Fixes tag. I think this is the commit that introduced the problem:

commit 75de8428c3d632eacc7890b7cb39dbec04d286c3
Author: Jonathan Kim <[email protected]>
Date:   Mon Aug 21 11:47:47 2023 -0400

    drm/amdkfd: enable single alu ops for gfx12

    GFX12 debugging requires setting up precise ALU operation for catching ALU exceptions.

Quoted 9 lines
---
  drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_debug.c +0 -0
index 3f27bab7a502..4abd275056d6 100644

drivers/gpu/drm/amd/amdkfd/kfd_debug.c int kfd_dbg_trap_set_flags(struct kfd_process *target, uint32_t *flags) · line 506

Quoted 5 lines
drivers/gpu/drm/amd/amdkfd/kfd_debug.c +1 -1
@@ -503,7 +503,7 @@ int kfd_dbg_trap_set_flags(struct kfd_process *target, uint32_t *flags)
  				kfd_topology_device_by_id(target->pdds[i]->dev->id);
  		uint32_t caps = topo_dev->node_props.capability;
 
-		if (!(caps | HSA_CAP_TRAP_DEBUG_PRECISE_MEMORY_OPERATIONS_SUPPORTED) &&
+		if (!(caps & HSA_CAP_TRAP_DEBUG_PRECISE_MEMORY_OPERATIONS_SUPPORTED) &&

Looks like the same mistake was copied and pasted for HSA_CAP_TRAP_DEBUG_PRECISE_ALU_OPERATIONS_SUPPORTED a few lines below. Please fix that as well while you're at it.

Thanks,
  Felix

Quoted 3 lines
drivers/gpu/drm/amd/amdkfd/kfd_debug.c +0 -0
  			(*flags & KFD_DBG_TRAP_FLAG_SINGLE_MEM_OP)) {
  			*flags = prev_flags;
  			return -EACCES;