[PATCH 3/3] drm/amdkfd: Remove the control stack workaround for GFX10

Zhao, Yong Yong.Zhao at amd.com
Wed Sep 25 18:34:35 UTC 2019


Yes. I confirmed with CP guys and they said the behavior on GFX10 is the 
same as GFX8 now. I remember that the workaround on GFX9 was to help 
with a HW bug, but not too sure.

Regards,

Yong

On 2019-09-25 2:25 p.m., Kuehling, Felix wrote:
> On 2019-09-25 2:15 p.m., Zhao, Yong wrote:
>> The GFX10 does not have this hardware bug any more, so remove it.
> I wouldn't call this a bug and a workaround. More like a change in the
> HW or FW behaviour and a corresponding driver change. I.e. in GFXv8 the
> control stack was in the user mode CWSR allocation. In GFXv9 it moved
> into a kernel mode buffer next to the MQD. So in GFXv10 the control
> stack moved back into the user mode CWSR buffer?
>
> Regards,
>     Felix
>
>> Change-Id: I446c9685549a09ac8846a42ee22d86cfb93fd98c
>> Signed-off-by: Yong Zhao <Yong.Zhao at amd.com>
>> ---
>>    .../gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c  | 37 ++-----------------
>>    1 file changed, 4 insertions(+), 33 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c
>> index 9cd3eb2d90bd..4a236b2c2354 100644
>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c
>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c
>> @@ -69,35 +69,13 @@ static void update_cu_mask(struct mqd_manager *mm, void *mqd,
>>    static struct kfd_mem_obj *allocate_mqd(struct kfd_dev *kfd,
>>    		struct queue_properties *q)
>>    {
>> -	int retval;
>> -	struct kfd_mem_obj *mqd_mem_obj = NULL;
>> +	struct kfd_mem_obj *mqd_mem_obj;
>>    
>> -	/* From V9,  for CWSR, the control stack is located on the next page
>> -	 * boundary after the mqd, we will use the gtt allocation function
>> -	 * instead of sub-allocation function.
>> -	 */
>> -	if (kfd->cwsr_enabled && (q->type == KFD_QUEUE_TYPE_COMPUTE)) {
>> -		mqd_mem_obj = kzalloc(sizeof(struct kfd_mem_obj), GFP_NOIO);
>> -		if (!mqd_mem_obj)
>> -			return NULL;
>> -		retval = amdgpu_amdkfd_alloc_gtt_mem(kfd->kgd,
>> -			ALIGN(q->ctl_stack_size, PAGE_SIZE) +
>> -				ALIGN(sizeof(struct v10_compute_mqd), PAGE_SIZE),
>> -			&(mqd_mem_obj->gtt_mem),
>> -			&(mqd_mem_obj->gpu_addr),
>> -			(void *)&(mqd_mem_obj->cpu_ptr), true);
>> -	} else {
>> -		retval = kfd_gtt_sa_allocate(kfd, sizeof(struct v10_compute_mqd),
>> -				&mqd_mem_obj);
>> -	}
>> -
>> -	if (retval) {
>> -		kfree(mqd_mem_obj);
>> +	if (kfd_gtt_sa_allocate(kfd, sizeof(struct v10_compute_mqd),
>> +			&mqd_mem_obj))
>>    		return NULL;
>> -	}
>>    
>>    	return mqd_mem_obj;
>> -
>>    }
>>    
>>    static void init_mqd(struct mqd_manager *mm, void **mqd,
>> @@ -250,14 +228,7 @@ static int destroy_mqd(struct mqd_manager *mm, void *mqd,
>>    static void free_mqd(struct mqd_manager *mm, void *mqd,
>>    			struct kfd_mem_obj *mqd_mem_obj)
>>    {
>> -	struct kfd_dev *kfd = mm->dev;
>> -
>> -	if (mqd_mem_obj->gtt_mem) {
>> -		amdgpu_amdkfd_free_gtt_mem(kfd->kgd, mqd_mem_obj->gtt_mem);
>> -		kfree(mqd_mem_obj);
>> -	} else {
>> -		kfd_gtt_sa_free(mm->dev, mqd_mem_obj);
>> -	}
>> +	kfd_gtt_sa_free(mm->dev, mqd_mem_obj);
>>    }
>>    
>>    static bool is_occupied(struct mqd_manager *mm, void *mqd,


More information about the amd-gfx mailing list