summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
diff options
context:
space:
mode:
authorCe Sun <cesun102@amd.com>2025-08-19 09:47:05 +0300
committerAlex Deucher <alexander.deucher@amd.com>2025-08-27 20:57:47 +0300
commit0989b764f43d4de2c6665c15165c251d9cfde9c0 (patch)
treee7d49f88e5d3a8480892aafdcab618666350ac2a /drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
parent907813e5d7cadfeafab12467d748705a5309efb0 (diff)
downloadlinux-0989b764f43d4de2c6665c15165c251d9cfde9c0.tar.xz
drm/amdgpu: Add a mutex lock to protect poison injection
When poison is triggered multiple times, competition will occur. Add a mutex lock to protect poison injection Signed-off-by: Ce Sun <cesun102@amd.com> Reviewed-by: Yang Wang <kevinyang.wang@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index e6b8c2cf80ea..ff2b522d86c6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -3512,6 +3512,7 @@ static int amdgpu_ras_page_retirement_thread(void *param)
if (kthread_should_stop())
break;
+ mutex_lock(&con->poison_lock);
gpu_reset = 0;
do {
@@ -3568,6 +3569,7 @@ static int amdgpu_ras_page_retirement_thread(void *param)
/* Wake up work to save bad pages to eeprom */
schedule_delayed_work(&con->page_retirement_dwork, 0);
}
+ mutex_unlock(&con->poison_lock);
}
return 0;
@@ -3648,6 +3650,7 @@ int amdgpu_ras_recovery_init(struct amdgpu_device *adev, bool init_bp_info)
}
mutex_init(&con->recovery_lock);
+ mutex_init(&con->poison_lock);
INIT_WORK(&con->recovery_work, amdgpu_ras_do_recovery);
atomic_set(&con->in_recovery, 0);
atomic_set(&con->rma_in_recovery, 0);