drm/amdgpu: add ring timeout information in devcoredump
Subsystems (2)
PATCH 1/1 drm/amdgpu: add ring timeout information in devcoredump
Add ring timeout related information in the amdgpu devcoredump file for debugging purposes.
During the gpu recovery process the registered call is triggered and add the debug information in data file created by devcoredump framework under the directory /sys/class/devcoredump/devcdx/
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 15 +++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 11 +++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c | 12 +++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h | 1 + 4 files changed, 38 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +15 -0
@@ -816,6 +816,17 @@ struct amdgpu_reset_info {#endif }; +/* +* IP and Queue information during timeout +*/ +struct amdgpu_ring_timeout_info { +bool timeout; +char ring_name[32 ]; +enum amdgpu_ring_type ip_type; +bool soft_recovery; +}; + +/* * Non-zero (true) if the GPU has VRAM. Zero (false) otherwise. */
@@ -1150,6 +1161,10 @@ struct amdgpu_device {bool debug_largebar;bool debug_disable_soft_recovery;bool debug_use_vram_fw_buf; + +#ifdef CONFIG_DEV_COREDUMP +struct amdgpu_ring_timeout_info ring_timeout_info; +#endif }; static inline uint32_t amdgpu_ip_version(const struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +11 -0
@@ -51,8 +51,19 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job)memset (&ti,0 ,sizeof (struct amdgpu_task_info )); adev->job_hang = true; +#ifdef CONFIG_DEV_COREDUMP +/* Update the ring timeout info for coredump*/ + adev->ring_timeout_info.timeout = TRUE; +sprintf (adev->ring_timeout_info.ring_name, s_job->sched->name); + adev->ring_timeout_info.ip_type = ring->funcs->type; + adev->ring_timeout_info.soft_recovery = FALSE; +#endif +if (amdgpu_gpu_recovery &&amdgpu_ring_soft_recovery (ring, job->vmid, s_job->s_fence->parent)) { +#ifdef CONFIG_DEV_COREDUMP + adev->ring_timeout_info.soft_recovery = TRUE; +#endif DRM_ERROR ("ring %s timeout, but soft recovered\n" , s_job->sched->name); goto exit;
drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c +11 -1
@@ -196,8 +196,16 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count, coredump->reset_task_info.process_name, coredump->reset_task_info.pid); +if (coredump->timeout_info.timeout) { +drm_printf (&p,"\nRing timed out details\n" ); +drm_printf (&p,"IP Type: %d Ring Name: %s Soft Recovery: %s\n" , + coredump->timeout_info.ip_type, + coredump->timeout_info.ring_name, + coredump->timeout_info.soft_recovery ?"Successful" :"Failed" ); + } +if (coredump->reset_vram_lost) -drm_printf (&p,"VRAM is lost due to GPU reset!\n" ); +drm_printf (&p,"\nVRAM is lost due to GPU reset!\n" );if (coredump->adev->reset_info.num_regs) {drm_printf (&p,"AMDGPU register dumps:\nOffset: Value:\n" );
@@ -228,6 +236,7 @@ void amdgpu_coredump(struct amdgpu_device *adev, bool vram_lost,return ; } + coredump->timeout_info = adev->ring_timeout_info; coredump->reset_vram_lost = vram_lost;if (reset_context->job && reset_context->job->vm)
@@ -236,6 +245,7 @@ void amdgpu_coredump(struct amdgpu_device *adev, bool vram_lost, coredump->adev = adev;ktime_get_ts64 (&coredump->reset_time); +memset (&adev->ring_timeout_info,0 ,sizeof (adev->ring_timeout_info));dev_coredumpm (dev->dev,THIS_MODULE , coredump,0 ,GFP_NOWAIT , amdgpu_devcoredump_read, amdgpu_devcoredump_free);
drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h +1 -0
@@ -97,6 +97,7 @@ struct amdgpu_coredump_info {struct amdgpu_task_info reset_task_info;struct timespec64 reset_time;bool reset_vram_lost; + struct amdgpu_ring_timeout_info timeout_info; };#endif
Signature · 1 line
2.34.1
Am 01.03.24 um 13:43 schrieb Sunil Khatri:
Quoted 21 lines
Add ring timeout related information in the amdgpu devcoredump file for debugging purposes.
During the gpu recovery process the registered call is triggered and add the debug information in data file created by devcoredump framework under the directory
/sys/class/devcoredump/devcdx/Signed-off-by Sunil Khatri <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 15 +++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 11 +++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c | 12 +++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h | 1 + 4 files changed, 38 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_reset_info { · line 823
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +5
-0@@ -816,6 +816,17 @@ struct amdgpu_reset_info {#endif }; +/* +* IP and Queue information during timeout +*/ +struct amdgpu_ring_timeout_info { +bool timeout;
What should that be good for?
drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_reset_info { · line 825
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2
-0+char ring_name[32 ]; +enum amdgpu_ring_type ip_type;
Those information should already be available in the core dump.
drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_reset_info { · line 826
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0+bool soft_recovery;
That doesn't make sense since we don't do a core dump in case of a soft recovery.
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +3
-0+}; + +/* * Non-zero (true) if the GPU has VRAM. Zero (false) otherwise. */
drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_device { · line 1167
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +4
-0@@ -1150,6 +1161,10 @@ struct amdgpu_device {bool debug_largebar;bool debug_disable_soft_recovery;bool debug_use_vram_fw_buf; + +#ifdef CONFIG_DEV_COREDUMP +struct amdgpu_ring_timeout_info ring_timeout_info; +#endif
Please never store core dump related information in the amdgpu_device structure.
Regards,
Christian.
Quoted 77 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0}; static inline uint32_t amdgpu_ip_version(const struct amdgpu_device *adev,drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +11
-0@@ -51,8 +51,19 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job)memset (&ti,0 ,sizeof (struct amdgpu_task_info )); adev->job_hang = true; +#ifdef CONFIG_DEV_COREDUMP +/* Update the ring timeout info for coredump*/ + adev->ring_timeout_info.timeout = TRUE; +sprintf (adev->ring_timeout_info.ring_name, s_job->sched->name); + adev->ring_timeout_info.ip_type = ring->funcs->type; + adev->ring_timeout_info.soft_recovery = FALSE; +#endif +if (amdgpu_gpu_recovery &&amdgpu_ring_soft_recovery (ring, job->vmid, s_job->s_fence->parent)) { +#ifdef CONFIG_DEV_COREDUMP + adev->ring_timeout_info.soft_recovery = TRUE; +#endif DRM_ERROR ("ring %s timeout, but soft recovered\n" , s_job->sched->name); goto exit;drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c +11
-1@@ -196,8 +196,16 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count, coredump->reset_task_info.process_name, coredump->reset_task_info.pid); +if (coredump->timeout_info.timeout) { +drm_printf (&p,"\nRing timed out details\n" ); +drm_printf (&p,"IP Type: %d Ring Name: %s Soft Recovery: %s\n" , + coredump->timeout_info.ip_type, + coredump->timeout_info.ring_name, + coredump->timeout_info.soft_recovery ?"Successful" :"Failed" ); + } +if (coredump->reset_vram_lost) -drm_printf (&p,"VRAM is lost due to GPU reset!\n" ); +drm_printf (&p,"\nVRAM is lost due to GPU reset!\n" );if (coredump->adev->reset_info.num_regs) {drm_printf (&p,"AMDGPU register dumps:\nOffset: Value:\n" );@@ -228,6 +236,7 @@ void amdgpu_coredump(struct amdgpu_device *adev, bool vram_lost,return ; } + coredump->timeout_info = adev->ring_timeout_info; coredump->reset_vram_lost = vram_lost;if (reset_context->job && reset_context->job->vm)@@ -236,6 +245,7 @@ void amdgpu_coredump(struct amdgpu_device *adev, bool vram_lost, coredump->adev = adev;ktime_get_ts64 (&coredump->reset_time); +memset (&adev->ring_timeout_info,0 ,sizeof (adev->ring_timeout_info));dev_coredumpm (dev->dev,THIS_MODULE , coredump,0 ,GFP_NOWAIT , amdgpu_devcoredump_read, amdgpu_devcoredump_free);drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h +1
-0@@ -97,6 +97,7 @@ struct amdgpu_coredump_info {struct amdgpu_task_info reset_task_info;struct timespec64 reset_time;bool reset_vram_lost; + struct amdgpu_ring_timeout_info timeout_info; };#endif
Quoted 36 lines · Christian König
Am 01.03.24 um 13:43 schrieb Sunil Khatri:
Quoted 24 lines
Add ring timeout related information in the amdgpu devcoredump file for debugging purposes.
During the gpu recovery process the registered call is triggered and add the debug information in data file created by devcoredump framework under the directory
/sys/class/devcoredump/devcdx/Signed-off-by Sunil Khatri <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 15 +++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 11 +++++++++++drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c| 12 +++++++++++-drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h| 1 +4 files changed, 38 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0@@ -816,6 +816,17 @@ struct amdgpu_reset_info { #endif };Quoted 5 lines
+/*
+ * IP and Queue information during timeout
+ */
+structamdgpu_ring_timeout_info{
+ bool timeout;What should that be good for?
In case of page fault or gpu reset due to other reasons there is no time out. In that case we are not adding any information and we are using this flag while dumping information.
Quoted 4 lines
Quoted 2 lines
+ char ring_name[32];
+ enumamdgpu_ring_typeip_type;Those information should already be available in the core dump.
Will update.
Quoted 5 lines
Quoted 2 lines
+ bool
soft_recovery;That doesn't make sense since we don't do a core dump in case of a soft recovery.
Noted, this can be removed.
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +3
-0+}; + +/*
* Non-zero (true) if the GPU has VRAM. Zero (false) otherwise. */drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0@@ -1150,6 +1161,10 @@ struct amdgpu_device { bool debug_largebar; bool debug_disable_soft_recovery;
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_device { · line 1167
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +4
-0bool debug_use_vram_fw_buf; + +#ifdef CONFIG_DEV_COREDUMP + struct amdgpu_ring_timeout_info ring_timeout_info; +#endif Please never store core dump related information in the
amdgpu_devicestructure.
Let me see to it. Point taken
Thanks
Sunil
Quoted 85 lines
Regards,
Christian.Quoted 80 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0};static inline
uint32_tamdgpu_ip_version(const structamdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +0
-0@@ -51,8 +51,19 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job) memset(&ti, 0, sizeof(struct amdgpu_task_info)); adev->job_hang = true;+#ifdef
CONFIG_DEV_COREDUMP
+ /* Update the ring timeout info for coredump*/
+adev->ring_timeout_info.timeout= TRUE;
+sprintf(adev->ring_timeout_info.ring_name, s_job->sched->name); +adev->ring_timeout_info.ip_type=ring->funcs->type; +adev->ring_timeout_info.soft_recovery= FALSE;drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +2
-0+#endif +if (
amdgpu_gpu_recovery&&amdgpu_ring_soft_recovery(ring, job->vmid, s_job->s_fence->parent)) {drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +3
-0+#ifdef CONFIG_DEV_COREDUMP + adev->ring_timeout_info.soft_recovery = TRUE; +#endif
DRM_ERROR("ring %s timeout, but soft recovered\n", s_job->sched->name);
goto exit;drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c +8
-1@@ -196,8 +196,16 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count, coredump->reset_task_info.process_name, coredump->reset_task_info.pid); + if (coredump->timeout_info.timeout) { + drm_printf(&p, "\nRing timed out details\n"); + drm_printf(&p, "IP Type: %d Ring Name: %s Soft Recovery: %s\n", + coredump->timeout_info.ip_type, + coredump->timeout_info.ring_name, + coredump->timeout_info.soft_recovery ?"Successful" :"Failed" ); + } + if (coredump->reset_vram_lost) - drm_printf(&p, "VRAM is lost due to GPU reset!\n"); + drm_printf(&p, "\nVRAM is lost due to GPU reset!\n"); if (coredump->adev->reset_info.num_regs) {drm_printf(&p, "AMDGPU register dumps:\nOffset:
Value:\n");
@@ -228,6 +236,7 @@ void amdgpu_coredump(structamdgpu_device*adev, boolvram_lost,
return;
}
+coredump->timeout_info=adev->ring_timeout_info;coredump->reset_vram_lost=vram_lost;
if (reset_context->job&&reset_context->job->vm)drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c +1
-0@@ -236,6 +245,7 @@ void amdgpu_coredump(struct amdgpu_device *adev,bool vram_lost, coredump->adev = adev; ktime_get_ts64(&coredump->reset_time); + memset(&adev->ring_timeout_info, 0,sizeof (adev->ring_timeout_info)); dev_coredumpm(dev->dev, THIS_MODULE, coredump, 0, GFP_NOWAIT, amdgpu_devcoredump_read, amdgpu_devcoredump_free);drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h +1
-0@@ -97,6 +97,7 @@ struct amdgpu_coredump_info { struct amdgpu_task_info reset_task_info; struct timespec64 reset_time; bool reset_vram_lost; + struct amdgpu_ring_timeout_info timeout_info; }; #endif