drm/amdgpu: add work function for GPU reset
Subsystems (2)
PATCH 2/4 drm/amdgpu: add work function for GPU reset
From c598dd586dd15fc5ae0a883a2e6f4094ec024085 Mon Sep 17 00:00:00 2001
From: Shashank Sharma <[email protected]>
Date: Fri, 21 Jan 2022 17:33:10 +0100
Subject: [PATCH 2/4] drm/amdgpu: add work function for GPU reset
This patch adds a new work function, which will get scheduled in event of a GPU reset, and will send a uevent to indicate the same. The userspace can do some post-processing work like collecting data from a trace event.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
@@ -1057,6 +1057,8 @@ struct amdgpu_device {struct work_struct xgmi_reset_work;struct list_head reset_list; +struct work_struct gpu_reset_work; +long gfx_timeout;long sdma_timeout;long video_timeout;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +14 -0
@@ -72,6 +72,7 @@#include <linux/pm_runtime.h> #include <drm/drm_drv.h> +#include <drm/drm_sysfs.h> MODULE_FIRMWARE ("amdgpu/vega10_gpu_info.bin" );MODULE_FIRMWARE ("amdgpu/vega12_gpu_info.bin" );
@@ -3274,6 +3275,18 @@ bool amdgpu_device_has_dc_support(struct amdgpu_device *adev)return amdgpu_device_asic_has_dc_support (adev->asic_type); } +static void amdgpu_device_gpu_reset_func (struct work_struct *__work) +{ +struct amdgpu_device *adev = + container_of(__work, struct amdgpu_device, gpu_reset_work); + +/* +* Inform userspace that a GPU reset happened, and it should collect +* data from the trace event. +*/ +drm_sysfs_gpu_reset_event (&adev->ddev); +} +static void amdgpu_device_xgmi_reset_func (struct work_struct *__work) { struct amdgpu_device *adev =
@@ -3506,6 +3519,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, amdgpu_device_delay_enable_gfx_off);INIT_WORK (&adev->xgmi_reset_work, amdgpu_device_xgmi_reset_func); +INIT_WORK (&adev->gpu_reset_work, amdgpu_device_gpu_reset_func); adev->gfx.gfx_off_req_count =1 ; adev->pm.ac_power =power_supply_is_system_supplied () >0 ;
Signature · 1 line
2.32.0
Christian König
maintainerAm 21.01.22 um 21:37 schrieb Sharma, Shashank:
Quoted 23 lines
From
c598dd586dd15fc5ae0a883a2e6f4094ec024085Mon Sep 17 00:00:00 2001
From: Shashank Sharma <[email protected]>
Date: Fri, 21 Jan 2022 17:33:10 +0100
Subject: [PATCH 2/4] drm/amdgpu: add work function for GPU resetThis patch adds a new work function, which will get scheduled in event of a GPU reset, and will send a uevent to indicate the same. The userspace can do some post-processing work like collecting data from a trace event.
Cc Alexander Deucher <[email protected]>Cc Christian Koenig <[email protected]>Signed-off-by Shashank Sharma <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++drivers/gpu/drm/amd/amdgpu/amdgpu_device.c| 14 ++++++++++++++2 files changed, 16 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_device { · line 1060
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -1057,6 +1057,8 @@ struct amdgpu_device { struct work_struct xgmi_reset_work; struct list_head reset_list; + struct work_struct gpu_reset_work;
This needs a different name. "gpu_reset_work" would indicate that it does the GPU reset, but this really only signals the reset to userspace.
Christian.
Quoted 44 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0+ long gfx_timeout; long sdma_timeout; long video_timeout;drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +13
-0@@ -72,6 +72,7 @@ #include <linux/pm_runtime.h> #include <drm/drm_drv.h> +#include <drm/drm_sysfs.h> MODULE_FIRMWARE("amdgpu/vega10_gpu_info.bin"); MODULE_FIRMWARE("amdgpu/vega12_gpu_info.bin");@@ -3274,6 +3275,18 @@ bool amdgpu_device_has_dc_support(struct amdgpu_device *adev) return amdgpu_device_asic_has_dc_support(adev->asic_type); } +static void amdgpu_device_gpu_reset_func (struct work_struct *__work) +{ + struct amdgpu_device *adev = + container_of(__work, struct amdgpu_device, gpu_reset_work); + + /* + * Inform userspace that a GPU reset happened, and it should collect + * data from the trace event. + */ + drm_sysfs_gpu_reset_event(&adev->ddev); +} + static void amdgpu_device_xgmi_reset_func(struct work_struct *__work) {struct
amdgpu_device*adev =drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-0@@ -3506,6 +3519,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, amdgpu_device_delay_enable_gfx_off); INIT_WORK(&adev->xgmi_reset_work, amdgpu_device_xgmi_reset_func); + INIT_WORK(&adev->gpu_reset_work, amdgpu_device_gpu_reset_func); adev->gfx.gfx_off_req_count = 1; adev->pm.ac_power = power_supply_is_system_supplied() > 0;
Quoted 27 lines · Christian König
Am 21.01.22 um 21:37 schrieb Sharma, Shashank:
Quoted 26 lines
From
c598dd586dd15fc5ae0a883a2e6f4094ec024085Mon Sep 17 00:00:00 2001
From: Shashank Sharma <[email protected]>
Date: Fri, 21 Jan 2022 17:33:10 +0100
Subject: [PATCH 2/4] drm/amdgpu: add work function for GPU resetThis patch adds a new work function, which will get scheduled in event of a GPU reset, and will send a uevent to indicate the same. The userspace can do some post-processing work like collecting data from a trace event.
Cc Alexander Deucher <[email protected]>Cc Christian Koenig <[email protected]>Signed-off-by Shashank Sharma <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++drivers/gpu/drm/amd/amdgpu/amdgpu_device.c| 14 ++++++++++++++2 files changed, 16 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0@@ -1057,6 +1057,8 @@ struct amdgpu_device { struct work_struct xgmi_reset_work; struct list_head reset_list;
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_device { · line 1060
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0+ struct work_struct gpu_reset_work;This needs a different name. "
gpu_reset_work" would indicate that it does the GPU reset, but this really only signals the reset to userspace.
Agree, let me come back with something like gpu_reset_housekeeping or something less weird that that :)
Quoted 47 lines
Christian.
Quoted 44 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0+ long gfx_timeout; long sdma_timeout; long video_timeout;drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +13
-0@@ -72,6 +72,7 @@ #include <linux/pm_runtime.h> #include <drm/drm_drv.h> +#include <drm/drm_sysfs.h> MODULE_FIRMWARE("amdgpu/vega10_gpu_info.bin"); MODULE_FIRMWARE("amdgpu/vega12_gpu_info.bin");@@ -3274,6 +3275,18 @@ bool amdgpu_device_has_dc_support(struct amdgpu_device *adev) return amdgpu_device_asic_has_dc_support(adev->asic_type); } +static void amdgpu_device_gpu_reset_func (struct work_struct *__work) +{ + struct amdgpu_device *adev = + container_of(__work, struct amdgpu_device, gpu_reset_work); + + /* + * Inform userspace that a GPU reset happened, and it should collect + * data from the trace event. + */ + drm_sysfs_gpu_reset_event(&adev->ddev); +} + static void amdgpu_device_xgmi_reset_func(struct work_struct *__work) {struct
amdgpu_device*adev =drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-0@@ -3506,6 +3519,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, amdgpu_device_delay_enable_gfx_off); INIT_WORK(&adev->xgmi_reset_work, amdgpu_device_xgmi_reset_func); + INIT_WORK(&adev->gpu_reset_work, amdgpu_device_gpu_reset_func); adev->gfx.gfx_off_req_count = 1; adev->pm.ac_power = power_supply_is_system_supplied() > 0;
Christian König
maintainerAm 24.01.22 um 17:46 schrieb Sharma, Shashank:
Quoted 30 lines · Christian König
Quoted 27 lines
Am 21.01.22 um 21:37 schrieb Sharma, Shashank:
Quoted 26 lines
From
c598dd586dd15fc5ae0a883a2e6f4094ec024085Mon Sep 17 00:00:00 2001
From: Shashank Sharma <[email protected]>
Date: Fri, 21 Jan 2022 17:33:10 +0100
Subject: [PATCH 2/4] drm/amdgpu: add work function for GPU resetThis patch adds a new work function, which will get scheduled in event of a GPU reset, and will send a uevent to indicate the same. The userspace can do some post-processing work like collecting data from a trace event.
Cc Alexander Deucher <[email protected]>Cc Christian Koenig <[email protected]>Signed-off-by Shashank Sharma <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++drivers/gpu/drm/amd/amdgpu/amdgpu_device.c| 14 ++++++++++++++2 files changed, 16 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0@@ -1057,6 +1057,8 @@ struct amdgpu_device { struct work_struct xgmi_reset_work; struct list_head reset_list;
Quoted 5 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_device { · line 1060
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0+ struct work_struct gpu_reset_work;This needs a different name. "
gpu_reset_work" would indicate that it does the GPU reset, but this really only signals the reset to userspace.Agree, let me come back with something like
gpu_reset_housekeepingor something less weird that that :)
How about send_gpu_reset_signal ?
Christian.
Quoted 50 lines
Quoted 50 lines
Christian.
Quoted 46 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0+ long gfx_timeout; long sdma_timeout; long video_timeout;drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8
-0@@ -72,6 +72,7 @@ #include <linux/pm_runtime.h> #include <drm/drm_drv.h> +#include <drm/drm_sysfs.h> MODULE_FIRMWARE("amdgpu/vega10_gpu_info.bin"); MODULE_FIRMWARE("amdgpu/vega12_gpu_info.bin");@@ -3274,6 +3275,18 @@ bool amdgpu_device_has_dc_support(struct amdgpu_device *adev) return amdgpu_device_asic_has_dc_support(adev->asic_type); } +static void amdgpu_device_gpu_reset_func (struct work_struct *__work) +{ + struct amdgpu_device *adev = + container_of(__work, struct amdgpu_device, gpu_reset_work); + + /* +* Inform userspace that a GPU reset happened, and it should collect
+ * data from the trace event.
+ */
+drm_sysfs_gpu_reset_event(&adev->ddev);drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-0+} +static void
amdgpu_device_xgmi_reset_func(struct work_struct *__work){
structamdgpu_device*adev =drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-0@@ -3506,6 +3519,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, amdgpu_device_delay_enable_gfx_off); INIT_WORK(&adev->xgmi_reset_work, amdgpu_device_xgmi_reset_func); + INIT_WORK(&adev->gpu_reset_work, amdgpu_device_gpu_reset_func); adev->gfx.gfx_off_req_count = 1;
adev->pm.ac_power=power_supply_is_system_supplied()> 0;
Quoted 33 lines · Christian König
Am 24.01.22 um 17:46 schrieb Sharma, Shashank:
Quoted 30 lines · Christian König
Quoted 27 lines
Am 21.01.22 um 21:37 schrieb Sharma, Shashank:
Quoted 26 lines
From
c598dd586dd15fc5ae0a883a2e6f4094ec024085Mon Sep 17 00:00:00 2001
From: Shashank Sharma <[email protected]>
Date: Fri, 21 Jan 2022 17:33:10 +0100
Subject: [PATCH 2/4] drm/amdgpu: add work function for GPU resetThis patch adds a new work function, which will get scheduled in event of a GPU reset, and will send a uevent to indicate the same. The userspace can do some post-processing work like collecting data from a trace event.
Cc Alexander Deucher <[email protected]>Cc Christian Koenig <[email protected]>Signed-off-by Shashank Sharma <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++drivers/gpu/drm/amd/amdgpu/amdgpu_device.c| 14 ++++++++++++++2 files changed, 16 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0@@ -1057,6 +1057,8 @@ struct amdgpu_device { struct work_struct xgmi_reset_work; struct list_head reset_list;
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_device { · line 1060
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0+ struct work_struct gpu_reset_work;This needs a different name. "
gpu_reset_work" would indicate that it does the GPU reset, but this really only signals the reset to userspace.Agree, let me come back with something like
gpu_reset_housekeepingor something less weird that that :)How about
send_gpu_reset_signal?
Yes, sure, that is exactly what is is supposed to do. I will accommodate this in next version.
- Shashank
Quoted 54 lines
Christian.
Quoted 50 lines
Quoted 50 lines
Christian.
Quoted 46 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0+ long gfx_timeout; long sdma_timeout; long video_timeout;drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8
-0@@ -72,6 +72,7 @@ #include <linux/pm_runtime.h> #include <drm/drm_drv.h> +#include <drm/drm_sysfs.h> MODULE_FIRMWARE("amdgpu/vega10_gpu_info.bin"); MODULE_FIRMWARE("amdgpu/vega12_gpu_info.bin");@@ -3274,6 +3275,18 @@ bool amdgpu_device_has_dc_support(struct amdgpu_device *adev) return amdgpu_device_asic_has_dc_support(adev->asic_type); } +static void amdgpu_device_gpu_reset_func (struct work_struct *__work) +{ + struct amdgpu_device *adev = + container_of(__work, struct amdgpu_device, gpu_reset_work); + + /* +* Inform userspace that a GPU reset happened, and it should collect
+ * data from the trace event.
+ */
+drm_sysfs_gpu_reset_event(&adev->ddev);drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-0+} +static void
amdgpu_device_xgmi_reset_func(struct work_struct *__work){
structamdgpu_device*adev =drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-0@@ -3506,6 +3519,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, amdgpu_device_delay_enable_gfx_off); INIT_WORK(&adev->xgmi_reset_work, amdgpu_device_xgmi_reset_func); + INIT_WORK(&adev->gpu_reset_work, amdgpu_device_gpu_reset_func); adev->gfx.gfx_off_req_count = 1;
adev->pm.ac_power=power_supply_is_system_supplied()> 0;