drm/amdgpu: Fix repeatly flr issue
Subsystems (2)
PATCH 1/2 drm/amdgpu: Fix repeatly flr issue
From: jqdeng <[email protected]>
Only for no job running test case need to do recover in flr notification.
For having job in mirror list, then let guest driver to hit job timeout, and then do recover.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 29 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c | 2 +- drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c | 4 +-- 4 files changed, 33 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -1136,6 +1136,7 @@ int emu_soc_asic_init(struct amdgpu_device *adev);#define amdgpu_inc_vram_lost (adev) atomic_inc(&((adev)->vram_lost_counter));/* Common functions */ +bool amdgpu_device_has_job_running (struct amdgpu_device *adev);bool amdgpu_device_should_recover_gpu (struct amdgpu_device *adev);int amdgpu_device_gpu_recover (struct amdgpu_device *adev,struct amdgpu_job * job);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +29 -0
@@ -3925,6 +3925,35 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev,return r; } +/** +* amdgpu_device_has_job_running - check if whether has job in ring mirror list +* +* @adev: amdgpu device pointer +* +* Check whether has job in ring mirror list +*/ +bool amdgpu_device_has_job_running (struct amdgpu_device *adev) +{ +int i; +struct drm_sched_job *job; + +for (i =0 ; i <AMDGPU_MAX_RINGS ; ++i) { +struct amdgpu_ring *ring = adev->rings[i]; + +if (!ring || !ring->sched.thread) +continue ; + +spin_lock (&ring->sched.job_list_lock); + job =list_first_entry_or_null (&ring->sched.ring_mirror_list, + struct drm_sched_job, node); +spin_unlock (&ring->sched.job_list_lock); +if (job) { +return true; + } + } +return false; +} +/** * amdgpu_device_should_recover_gpu - check if we should try GPU recovery *
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +1 -1
@@ -261,7 +261,7 @@ static void xgpu_ai_mailbox_flr_work(struct work_struct *work)/* Trigger recovery for world switch failure if no TDR */ if (amdgpu_device_should_recover_gpu (adev) - && adev->sdma_timeout ==MAX_SCHEDULE_TIMEOUT ) + && (amdgpu_device_has_job_running (adev) || adev->sdma_timeout ==MAX_SCHEDULE_TIMEOUT ))amdgpu_device_gpu_recover (adev,NULL ); }
drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c +2 -2
@@ -281,8 +281,8 @@ static void xgpu_nv_mailbox_flr_work(struct work_struct *work)up_read (&adev->reset_sem);/* Trigger recovery for world switch failure if no TDR */ -if (amdgpu_device_should_recover_gpu (adev) - && (adev->sdma_timeout ==MAX_SCHEDULE_TIMEOUT || +if (amdgpu_device_should_recover_gpu (adev) && (amdgpu_device_has_job_running (adev) || + adev->sdma_timeout ==MAX_SCHEDULE_TIMEOUT || adev->gfx_timeout ==MAX_SCHEDULE_TIMEOUT || adev->compute_timeout ==MAX_SCHEDULE_TIMEOUT || adev->video_timeout ==MAX_SCHEDULE_TIMEOUT ))
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/2 drm/amdgpu: Limit the error info print rate
From: jqdeng <[email protected]>
Use function printk_ratelimit to limit the print rate.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2 -1
@@ -1296,7 +1296,8 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) r =amdgpu_cs_parser_init (&parser, data);if (r) { -DRM_ERROR ("Failed to initialize parser %d!\n" , r); +if (printk_ratelimit ()) +DRM_ERROR ("Failed to initialize parser %d!\n" , r); goto out; }
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 2/2] drm/amdgpu: Limit the error info print rate
[AMD Official Use Only - Internal Distribution Only]
Ping ...
What about this patch.
Quoted 34 lines
-----Original Message-----
From: Emily.Deng <[email protected]>
Sent: Tuesday, August 18, 2020 5:42 PM
To: [email protected]
Cc: Deng, Emily <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: Limit the error info print rateFrom: jqdeng <[email protected]>
Use function
printk_ratelimitto limit the print rate.Signed-off-by jqdeng <[email protected]>Change-Id Ief05debe30d975cbcf88e473c9f486d70b5a202c---
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2
-2@@ -1296,7 +1296,8 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) r =amdgpu_cs_parser_init (&parser, data);if (r) { -DRM_ERROR ("Failed to initialize parser %d!\n" , r); +if (printk_ratelimit ()) +DRM_ERROR ("Failed to initialize parser %d!\n" , r); goto out; } --
Quoted 1 line
2.25.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Nirmoy
Acked-by Nirmoy DasRe: [PATCH 2/2] drm/amdgpu: Limit the error info print rate
Quoted 40 lines · Emily
[AMD Official Use Only - Internal Distribution Only]
[AMD Official Use Only - Internal Distribution Only]
Ping ...
What about this patch.Quoted 33 lines
-----Original Message-----
From: Emily.Deng <[email protected]>
Sent: Tuesday, August 18, 2020 5:42 PM
To: [email protected]
Cc: Deng, Emily <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: Limit the error info print rateFrom: jqdeng <[email protected]>
Use function
printk_ratelimitto limit the print rate.Signed-off-by jqdeng <[email protected]>Change-Id Ief05debe30d975cbcf88e473c9f486d70b5a202c---
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2
-1@@ -1296,7 +1296,8 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) r =amdgpu_cs_parser_init (&parser, data);if (r) { -DRM_ERROR ("Failed to initialize parser %d!\n" , r); +if (printk_ratelimit ()) +DRM_ERROR ("Failed to initialize parser %d!\n" , r); goto out; }
Quoted 6 lines
Quoted 2 lines
--
2.25.1_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cnirmoy.das%40amd.com%7C3dced10477a64f725ec908d8437cbcfe%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637333550337050316&sdata=acJSHuHMYH7THStjQ1QwjPvUbEnQGlwNL%2FaNDbLDT6M%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
With below minor comments fixed, the series is Acked-by: Nirmoy Das <[email protected]>
Quoted 33 lines · Emily.Deng
From: jqdeng <[email protected]>
Only for no job running test case need to do recover in flr notification.
For having job in mirror list, then let guest driver to hit job timeout, and then do recover.Signed-off-by jqdeng <[email protected]>Change-Id Ic6234fce46fa1655ba81c4149235eeac75e75868--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 29 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c | 2 +- drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c | 4 +-- 4 files changed, 33 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -1136,6 +1136,7 @@ int emu_soc_asic_init(struct amdgpu_device *adev);#define amdgpu_inc_vram_lost (adev) atomic_inc(&((adev)->vram_lost_counter));/* Common functions */ +bool amdgpu_device_has_job_running (struct amdgpu_device *adev);bool amdgpu_device_should_recover_gpu (struct amdgpu_device *adev);int amdgpu_device_gpu_recover (struct amdgpu_device *adev,struct amdgpu_job * job);drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_reset_sriov(struct amdgpu_device *adev, · line 3929
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-0@@ -3925,6 +3925,35 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev,return r; } +/** +* amdgpu_device_has_job_running - check if whether has job in ring mirror list
"check if whether has job in ring mirror list" --> "check if there is any job in mirror list"
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +11
-0+* +* @adev: amdgpu device pointer +* +* Check whether has job in ring mirror list +*/ +bool amdgpu_device_has_job_running (struct amdgpu_device *adev) +{ +int i; +struct drm_sched_job *job; + +for (i =0 ; i <AMDGPU_MAX_RINGS ; ++i) {
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_reset_sriov(struct amdgpu_device *adev, · line 3950
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +10
-0+struct amdgpu_ring *ring = adev->rings[i]; + +if (!ring || !ring->sched.thread) +continue ; + +spin_lock (&ring->sched.job_list_lock); + job =list_first_entry_or_null (&ring->sched.ring_mirror_list, + struct drm_sched_job, node); +spin_unlock (&ring->sched.job_list_lock); +if (job) {
No need to have braces for single if statement.
Nirmoy
Quoted 27 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6
-0+return true; + } + } +return false; +} +/** * amdgpu_device_should_recover_gpu - check if we should try GPU recovery * drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +1
-1@@ -261,7 +261,7 @@ static void xgpu_ai_mailbox_flr_work(struct work_struct *work)/* Trigger recovery for world switch failure if no TDR */ if (amdgpu_device_should_recover_gpu (adev) - && adev->sdma_timeout ==MAX_SCHEDULE_TIMEOUT ) + && (amdgpu_device_has_job_running (adev) || adev->sdma_timeout ==MAX_SCHEDULE_TIMEOUT ))amdgpu_device_gpu_recover (adev,NULL ); }drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c +0
-0
drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c static void xgpu_nv_mailbox_flr_work(struct work_struct *work) · line 288
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c +2
-2@@ -281,8 +281,8 @@ static void xgpu_nv_mailbox_flr_work(struct work_struct *work)up_read (&adev->reset_sem);/* Trigger recovery for world switch failure if no TDR */ -if (amdgpu_device_should_recover_gpu (adev) - && (adev->sdma_timeout ==MAX_SCHEDULE_TIMEOUT || +if (amdgpu_device_should_recover_gpu (adev) && (amdgpu_device_has_job_running (adev) || + adev->sdma_timeout ==MAX_SCHEDULE_TIMEOUT || adev->gfx_timeout ==MAX_SCHEDULE_TIMEOUT || adev->compute_timeout ==MAX_SCHEDULE_TIMEOUT || adev->video_timeout ==MAX_SCHEDULE_TIMEOUT ))
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx