[PATCH 3/3] drm/amdkfd: Fix a bug when calculating save_area_used_size

Felix Kuehling felix.kuehling at amd.com
Tue Nov 12 21:43:41 UTC 2019


On 2019-11-11 6:25 p.m., Yong Zhao wrote:
> 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.


>
> Change-Id: I5252e25662c3b8221f451c39115bf084d1911eae
> Signed-off-by: Yong Zhao <Yong.Zhao at amd.com>
> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
> index d3380c5bdbde..3a2ee1f01aae 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
> @@ -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

Reviewed-by: Felix Kuehling <Felix.Kuehling at amd.com>


>   
>   	if (copy_to_user(ctl_stack, mqd_ctl_stack, m->cp_hqd_cntl_stack_size))
>   		return -EFAULT;


More information about the amd-gfx mailing list