summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/include
diff options
context:
space:
mode:
authorJonathan Kim <jonathan.kim@amd.com>2023-12-05 12:22:07 -0500
committerAlex Deucher <alexander.deucher@amd.com>2023-12-13 16:07:43 -0500
commitbd33bb1409b494558a2935f7bbc7842def957fcd (patch)
tree1d729238f2e40845a1fbf93cda1fa6429f30b908 /drivers/gpu/drm/amd/include
parentc01b9be7b20999bfeaacc1e574be0db93c14c478 (diff)
downloadlinux-stable-bd33bb1409b494558a2935f7bbc7842def957fcd.tar.gz
linux-stable-bd33bb1409b494558a2935f7bbc7842def957fcd.tar.bz2
linux-stable-bd33bb1409b494558a2935f7bbc7842def957fcd.zip
drm/amdkfd: fix mes set shader debugger process management
MES provides the driver a call to explicitly flush stale process memory within the MES to avoid a race condition that results in a fatal memory violation. When SET_SHADER_DEBUGGER is called, the driver passes a memory address that represents a process context address MES uses to keep track of future per-process calls. Normally, MES will purge its process context list when the last queue has been removed. The driver, however, can call SET_SHADER_DEBUGGER regardless of whether a queue has been added or not. If SET_SHADER_DEBUGGER has been called with no queues as the last call prior to process termination, the passed process context address will still reside within MES. On a new process call to SET_SHADER_DEBUGGER, the driver may end up passing an identical process context address value (based on per-process gpu memory address) to MES but is now pointing to a new allocated buffer object during KFD process creation. Since the MES is unaware of this, access of the passed address points to the stale object within MES and triggers a fatal memory violation. The solution is for KFD to explicitly flush the process context address from MES on process termination. Note that the flush call and the MES debugger calls use the same MES interface but are separated as KFD calls to avoid conflicting with each other. Signed-off-by: Jonathan Kim <jonathan.kim@amd.com> Tested-by: Alice Wong <shiwei.wong@amd.com> Reviewed-by: Eric Huang <jinhuieric.huang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/include')
-rw-r--r--drivers/gpu/drm/amd/include/mes_v11_api_def.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/include/mes_v11_api_def.h b/drivers/gpu/drm/amd/include/mes_v11_api_def.h
index 1fbfd1aa987e..ec5b9ab67c5e 100644
--- a/drivers/gpu/drm/amd/include/mes_v11_api_def.h
+++ b/drivers/gpu/drm/amd/include/mes_v11_api_def.h
@@ -572,7 +572,8 @@ struct SET_SHADER_DEBUGGER {
struct {
uint32_t single_memop : 1; /* SQ_DEBUG.single_memop */
uint32_t single_alu_op : 1; /* SQ_DEBUG.single_alu_op */
- uint32_t reserved : 30;
+ uint32_t reserved : 29;
+ uint32_t process_ctx_flush : 1;
};
uint32_t u32all;
} flags;