drm:amdgpu: check before setting hw priority
Subsystems (2)
PATCH 1/2 drm:amdgpu: check before setting hw priority
Check validity of drm_gpu_scheduler before setting hw priority. Also fix a minor indentation issue.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +6 -3
@@ -504,9 +504,9 @@ struct dma_fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx, }static void amdgpu_ctx_set_entity_priority (struct amdgpu_ctx *ctx, -struct amdgpu_ctx_entity *aentity, -int hw_ip, -enum drm_sched_priority priority) +struct amdgpu_ctx_entity *aentity, +int hw_ip, +enum drm_sched_priority priority) {struct amdgpu_device *adev = ctx->adev;unsigned int hw_prio;
@@ -523,6 +523,9 @@ static void amdgpu_ctx_set_entity_priority(struct amdgpu_ctx *ctx, hw_prio =array_index_nospec (hw_prio,AMDGPU_RING_PRIO_MAX ); scheds = adev->gpu_sched[hw_ip][hw_prio].sched; num_scheds = adev->gpu_sched[hw_ip][hw_prio].num_scheds; +if (!scheds || !num_scheds) +return ; +drm_sched_entity_modify_sched (&aentity->entity, scheds, num_scheds); }
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/2 drm/amdgpu: enable only one compute queue for raven
Because of firmware bug, Raven asics can't handle jobs scheduled to multiple compute queues. So enable only one compute queue till we have a firmware fix.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +4 -0
@@ -195,6 +195,10 @@ static bool amdgpu_gfx_is_multipipe_capable(struct amdgpu_device *adev)bool amdgpu_gfx_is_high_priority_compute_queue (struct amdgpu_device *adev,int queue) { +/* We only enable one compute queue for Raven */ +if (adev->asic_type ==CHIP_RAVEN ) +return false; +/* Policy: make queue 0 of each pipe as high priority compute queue */ return (queue ==0 );
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +10 -1
@@ -4633,7 +4633,16 @@ static int gfx_v9_0_early_init(void *handle) adev->gfx.num_gfx_rings =0 ; else adev->gfx.num_gfx_rings = GFX9_NUM_GFX_RINGS; - adev->gfx.num_compute_rings = amdgpu_num_kcq; + +/* raven firmware currently can not load balance jobs +* among multiple compute queues. Enable only one +* compute queue till we have a firmware fix. +*/ +if (adev->asic_type ==CHIP_RAVEN ) + adev->gfx.num_compute_rings =1 ; +else + adev->gfx.num_compute_rings = amdgpu_num_kcq; +gfx_v9_0_set_kiq_pm4_funcs (adev);gfx_v9_0_set_ring_funcs (adev);gfx_v9_0_set_irq_funcs (adev);
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/2] drm/amdgpu: enable only one compute queue for raven
Please ignore this patch, it didn't workaround the fw bug.
Regards,
Nirmoy
Quoted 37 lines · Nirmoy Das
Because of firmware bug, Raven asics can't handle jobs scheduled to multiple compute queues. So enable only one compute queue till we have a firmware fix.
Signed-off-by Nirmoy Das <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +4
-0@@ -195,6 +195,10 @@ static bool amdgpu_gfx_is_multipipe_capable(struct amdgpu_device *adev)bool amdgpu_gfx_is_high_priority_compute_queue (struct amdgpu_device *adev,int queue) { +/* We only enable one compute queue for Raven */ +if (adev->asic_type ==CHIP_RAVEN ) +return false; +/* Policy: make queue 0 of each pipe as high priority compute queue */ return (queue ==0 );drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3
-1@@ -4633,7 +4633,16 @@ static int gfx_v9_0_early_init(void *handle) adev->gfx.num_gfx_rings =0 ; else adev->gfx.num_gfx_rings = GFX9_NUM_GFX_RINGS; - adev->gfx.num_compute_rings = amdgpu_num_kcq; + +/* raven firmware currently can not load balance jobs +* among multiple compute queues. Enable only one
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_early_init(void *handle) · line 4648
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +7
-0+* compute queue till we have a firmware fix. +*/ +if (adev->asic_type ==CHIP_RAVEN ) + adev->gfx.num_compute_rings =1 ; +else + adev->gfx.num_compute_rings = amdgpu_num_kcq; +gfx_v9_0_set_kiq_pm4_funcs (adev);gfx_v9_0_set_ring_funcs (adev);gfx_v9_0_set_irq_funcs (adev);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/2] drm/amdgpu: enable only one compute queue for raven
In reply to Nirmoy DasQuoted 35 lines · Nirmoy Das
Because of firmware bug, Raven asics can't handle jobs scheduled to multiple compute queues. So enable only one compute queue till we have a firmware fix.
Signed-off-by Nirmoy Das <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +4
-0@@ -195,6 +195,10 @@ static bool amdgpu_gfx_is_multipipe_capable(struct amdgpu_device *adev)bool amdgpu_gfx_is_high_priority_compute_queue (struct amdgpu_device *adev,int queue) { +/* We only enable one compute queue for Raven */ +if (adev->asic_type ==CHIP_RAVEN ) +return false; +/* Policy: make queue 0 of each pipe as high priority compute queue */ return (queue ==0 );drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-1@@ -4633,7 +4633,16 @@ static int gfx_v9_0_early_init(void *handle) adev->gfx.num_gfx_rings =0 ; else adev->gfx.num_gfx_rings = GFX9_NUM_GFX_RINGS; - adev->gfx.num_compute_rings = amdgpu_num_kcq;
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_early_init(void *handle) · line 4645
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +10
-0+ +/* raven firmware currently can not load balance jobs +* among multiple compute queues. Enable only one +* compute queue till we have a firmware fix. +*/ +if (adev->asic_type ==CHIP_RAVEN ) + adev->gfx.num_compute_rings =1 ; +else + adev->gfx.num_compute_rings = amdgpu_num_kcq; +
I would suggest something like this instead so we can override easily for testing:
(quoted diff) +0 -0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index abddcd9dab3d..a2954b41e59d 100644
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
@@ -1376,6 +1376,12 @@ static int amdgpu_device_check_arguments(struct
amdgpu_device *adev)
if (amdgpu_num_kcq == -1) {
amdgpu_num_kcq = 8;
+ /* raven firmware currently can not load balance jobs
+ * among multiple compute queues. Enable only one
+ * compute queue till we have a firmware fix.
+ */
+ if (adev->asic_type == CHIP_RAVEN)
+ amdgpu_num_kcq = 1;
} else if (amdgpu_num_kcq > 8 || amdgpu_num_kcq < 0) {
amdgpu_num_kcq = 8;
dev_warn(adev->dev, "set kernel compute queue numberto 8 due to invalid parameter provided by user\n");
Alex
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-1gfx_v9_0_set_kiq_pm4_funcs (adev);gfx_v9_0_set_ring_funcs (adev);gfx_v9_0_set_irq_funcs (adev); --2.28.0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/2] drm/amdgpu: enable only one compute queue for raven
Quoted 67 lines · Alex Deucher
Quoted 34 lines · Nirmoy Das
Because of firmware bug, Raven asics can't handle jobs scheduled to multiple compute queues. So enable only one compute queue till we have a firmware fix.
Signed-off-by Nirmoy Das <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +4
-0@@ -195,6 +195,10 @@ static bool amdgpu_gfx_is_multipipe_capable(struct amdgpu_device *adev)bool amdgpu_gfx_is_high_priority_compute_queue (struct amdgpu_device *adev,int queue) { +/* We only enable one compute queue for Raven */ +if (adev->asic_type ==CHIP_RAVEN ) +return false; +/* Policy: make queue 0 of each pipe as high priority compute queue */ return (queue ==0 );drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-1@@ -4633,7 +4633,16 @@ static int gfx_v9_0_early_init(void *handle) adev->gfx.num_gfx_rings =0 ; else adev->gfx.num_gfx_rings = GFX9_NUM_GFX_RINGS; - adev->gfx.num_compute_rings = amdgpu_num_kcq;drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_early_init(void *handle) · line 4645
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +10
-0+ +/* raven firmware currently can not load balance jobs +* among multiple compute queues. Enable only one +* compute queue till we have a firmware fix. +*/ +if (adev->asic_type ==CHIP_RAVEN ) + adev->gfx.num_compute_rings =1 ; +else + adev->gfx.num_compute_rings = amdgpu_num_kcq; +I would suggest something like this instead so we can override easily for testing:
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6
-0@@ -1376,6 +1376,12 @@ static int amdgpu_device_check_arguments(struct amdgpu_device *adev)if (amdgpu_num_kcq ==-1 ) { amdgpu_num_kcq =8 ; +/* raven firmware currently can not load balance jobs +* among multiple compute queues. Enable only one +* compute queue till we have a firmware fix. +*/ +if (adev->asic_type ==CHIP_RAVEN ) + amdgpu_num_kcq =1 ; }else if (amdgpu_num_kcq >8 || amdgpu_num_kcq <0 ) { amdgpu_num_kcq =8 ;dev_warn(adev->dev, "set kernel compute queue number
Quoted 2 lines
to 8 due to invalid parameter provided by user\n");
Thanks, this looks much better,
I will update.
Nirmoy
Quoted 12 lines
Alex
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-1gfx_v9_0_set_kiq_pm4_funcs (adev);gfx_v9_0_set_ring_funcs (adev);gfx_v9_0_set_irq_funcs (adev); --2.28.0
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Cnirmoy.das%40amd.com%7Cc3012ca19bf149cb880608d871db5494%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637384534119165172%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Rcd6aMUMxxvDcwi695IYNvvhHfpKAq74KAOT9Vpzvmo%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Public Use]
Series is:
--
Best Regards
Aaron Liu
-----Original Message-----
From: Das, Nirmoy <[email protected]>
Sent: Wednesday, October 14, 2020 9:53 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Chen, Guchun <[email protected]>; Liu, Aaron <[email protected]>; Das, Nirmoy <[email protected]>
Subject: [PATCH 1/2] drm:amdgpu: check before setting hw priority
Check validity of drm_gpu_scheduler before setting hw priority. Also fix a minor indentation issue.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +6 -3
@@ -504,9 +504,9 @@ struct dma_fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx, }static void amdgpu_ctx_set_entity_priority (struct amdgpu_ctx *ctx, -struct amdgpu_ctx_entity *aentity, -int hw_ip, -enum drm_sched_priority priority) +struct amdgpu_ctx_entity *aentity, +int hw_ip, +enum drm_sched_priority priority) {struct amdgpu_device *adev = ctx->adev;unsigned int hw_prio;
@@ -523,6 +523,9 @@ static void amdgpu_ctx_set_entity_priority(struct amdgpu_ctx *ctx, hw_prio =array_index_nospec (hw_prio,AMDGPU_RING_PRIO_MAX ); scheds = adev->gpu_sched[hw_ip][hw_prio].sched; num_scheds = adev->gpu_sched[hw_ip][hw_prio].num_scheds; +if (!scheds || !num_scheds) +return ; +drm_sched_entity_modify_sched (&aentity->entity, scheds, num_scheds); }
--
2.28.0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx