drm/amdkfd: Implement queue priority controls for gfx10
Subsystems (3)
PATCH 1/3 drm/amdkfd: Implement queue priority controls for gfx10
Ported from gfx9.
--- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +7 -3
@@ -66,6 +66,12 @@ static void update_cu_mask(struct mqd_manager *mm, void *mqd, m->compute_static_thread_mgmt_se3); } +static void set_priority (struct v10_compute_mqd *m,struct queue_properties *q) +{ + m->cp_hqd_pipe_priority = pipe_priority_map[q->priority]; + m->cp_hqd_queue_priority = q->priority; +} +static struct kfd_mem_obj *allocate_mqd (struct kfd_dev *kfd,struct queue_properties *q) {
@@ -109,9 +115,6 @@ static void init_mqd(struct mqd_manager *mm, void **mqd,1 <<CP_HQD_QUANTUM__QUANTUM_SCALE__SHIFT |10 <<CP_HQD_QUANTUM__QUANTUM_DURATION__SHIFT ; - m->cp_hqd_pipe_priority =1 ; - m->cp_hqd_queue_priority =15 ; -if (q->format ==KFD_QUEUE_FORMAT_AQL ) { m->cp_hqd_aql_control =1 <<CP_HQD_AQL_CONTROL__CONTROL0__SHIFT ;
@@ -208,6 +211,7 @@ static void update_mqd(struct mqd_manager *mm, void *mqd, m->cp_hqd_ctx_save_control =0 ;update_cu_mask (mm, mqd, q); +set_priority (m, q); q->is_active = (q->queue_size > 0 && q->queue_address != 0 &&
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 2/3 drm/amdkfd: Update get_wave_state() for GFX10
Given control stack is now in the userspace context save restore area on GFX10, the same as GFX8, it is not needed to copy it back to userspace.
--- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +9 -5
@@ -251,18 +251,22 @@ static int get_wave_state(struct mqd_manager *mm, void *mqd, {struct v10_compute_mqd *m; -/* Control stack is located one page after MQD. */ -void *mqd_ctl_stack = (void *)((uintptr_t )mqd +PAGE_SIZE ); - m =get_mqd (mqd); +/* Control stack is written backwards, while workgroup context data +* is written forwards. Both starts from m->cp_hqd_cntl_stack_size. +* Current position is at m->cp_hqd_cntl_stack_offset and +* m->cp_hqd_wg_state_offset, respectively. +*/ *ctl_stack_used_size = m->cp_hqd_cntl_stack_size - m->cp_hqd_cntl_stack_offset; *save_area_used_size = m->cp_hqd_wg_state_offset - m->cp_hqd_cntl_stack_size; -if (copy_to_user (ctl_stack, mqd_ctl_stack, m->cp_hqd_cntl_stack_size)) -return -EFAULT ; +/* Control stack is not copied to user mode for GFXv10 because +* it's part of the context save area that is already +* accessible to user mode +*/ return 0 ; }
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
Felix Kuehling
Reviewed-byRe: [PATCH 2/3] drm/amdkfd: Update get_wave_state() for GFX10
Quoted 5 lines · Yong Zhao
Given control stack is now in the userspace context save restore area on GFX10, the same as GFX8, it is not needed to copy it back to userspace.
Change-Id I063ddc3026eefa57713ec47b466a90f9bf9d49b8Signed-off-by Yong Zhao <[email protected]>
Patches 1 and 2 are
Patch 3 should arguably not be part of this series, because it does not affect GFXv10.
Regards,
Felix
Quoted 26 lines
--- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +5
-3@@ -251,18 +251,22 @@ static int get_wave_state(struct mqd_manager *mm, void *mqd, {struct v10_compute_mqd *m; -/* Control stack is located one page after MQD. */ -void *mqd_ctl_stack = (void *)((uintptr_t )mqd +PAGE_SIZE ); - m =get_mqd (mqd); +/* Control stack is written backwards, while workgroup context data +* is written forwards. Both starts from m->cp_hqd_cntl_stack_size. +* Current position is at m->cp_hqd_cntl_stack_offset and +* m->cp_hqd_wg_state_offset, respectively. +*/ *ctl_stack_used_size = m->cp_hqd_cntl_stack_size - m->cp_hqd_cntl_stack_offset; *save_area_used_size = m->cp_hqd_wg_state_offset - m->cp_hqd_cntl_stack_size;
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c static int get_wave_state(struct mqd_manager *mm, void *mqd, · line 272
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +4
-2-if (copy_to_user (ctl_stack, mqd_ctl_stack, m->cp_hqd_cntl_stack_size)) -return -EFAULT ; +/* Control stack is not copied to user mode for GFXv10 because +* it's part of the context save area that is already +* accessible to user mode +*/ return 0 ; }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/3 drm/amdkfd: Fix a bug when calculating save_area_used_size
In reply to a message not in the archiveworkgroup context data writes from m->cp_hqd_cntl_stack_size, so we should deduct it when calculating the used size.
--- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +2 -1
@@ -302,7 +302,8 @@ static int get_wave_state(struct mqd_manager *mm, void *mqd, *ctl_stack_used_size = m->cp_hqd_cntl_stack_size - m->cp_hqd_cntl_stack_offset; - *save_area_used_size = m->cp_hqd_wg_state_offset; + *save_area_used_size = m->cp_hqd_wg_state_offset - + m->cp_hqd_cntl_stack_size;;if (copy_to_user (ctl_stack, mqd_ctl_stack, m->cp_hqd_cntl_stack_size))return -EFAULT ;
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 3/3] drm/amdkfd: Fix a bug when calculating save_area_used_size
+ Laurent
________________________________
From: Zhao, Yong <[email protected]>
Sent: Monday, November 11, 2019 6:25 PM
To: [email protected] <[email protected]>; Cornwall, Jay <[email protected]>
Cc: Zhao, Yong <[email protected]>
Subject: [PATCH 3/3] drm/amdkfd: Fix a bug when calculating save_area_used_size
workgroup context data writes from m->cp_hqd_cntl_stack_size, so we should deduct it when calculating the used size.
--- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +2 -1
@@ -302,7 +302,8 @@ static int get_wave_state(struct mqd_manager *mm, void *mqd, *ctl_stack_used_size = m->cp_hqd_cntl_stack_size - m->cp_hqd_cntl_stack_offset; - *save_area_used_size = m->cp_hqd_wg_state_offset; + *save_area_used_size = m->cp_hqd_wg_state_offset - + m->cp_hqd_cntl_stack_size;;if (copy_to_user (ctl_stack, mqd_ctl_stack, m->cp_hqd_cntl_stack_size))return -EFAULT ;
--
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Felix Kuehling
Reviewed-byRe: [PATCH 3/3] drm/amdkfd: Fix a bug when calculating save_area_used_size
In reply to a message not in the archiveQuoted 2 lines · Yong Zhao
workgroup context data writes from
m->cp_hqd_cntl_stack_size, so we should deduct it when calculating the used size.
Looks like something I missed in upstreaming. As far as I can tell this was originally part of a commit by Jay on amd-kfd-staging. Another part of his commit seems to be upstream. Not sure how this got lost.
See one comment inline.
Quoted 12 lines
Change-Id I5252e25662c3b8221f451c39115bf084d1911eaeSigned-off-by Yong Zhao <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +0
-0
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c static int get_wave_state(struct mqd_manager *mm, void *mqd, · line 306
Quoted 6 lines
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +2
-1@@ -302,7 +302,8 @@ static int get_wave_state(struct mqd_manager *mm, void *mqd, *ctl_stack_used_size = m->cp_hqd_cntl_stack_size - m->cp_hqd_cntl_stack_offset; - *save_area_used_size = m->cp_hqd_wg_state_offset; + *save_area_used_size = m->cp_hqd_wg_state_offset - + m->cp_hqd_cntl_stack_size;;
Please fix the double-semicolon. With that fixed this change is
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c static int get_wave_state(struct mqd_manager *mm, void *mqd, · line 309
Quoted 3 lines
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +0
-0if (copy_to_user (ctl_stack, mqd_ctl_stack, m->cp_hqd_cntl_stack_size))return -EFAULT ;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx