diff mbox series

[3/4] drm/sched: always keep selecetd ring sched list in ctx entity

Message ID 20220907205705.934688-3-James.Zhu@amd.com (mailing list archive)
State New, archived
Headers show
Series [1/4] drm/sched: returns struct drm_gpu_scheduler ** for drm_sched_pick_best | expand

Commit Message

James Zhu Sept. 7, 2022, 8:57 p.m. UTC
Always keep selecetd ring sched list in ctx entity.

Signed-off-by: James Zhu <James.Zhu@amd.com>
---
 drivers/gpu/drm/scheduler/sched_entity.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Christian König Sept. 8, 2022, 6:15 a.m. UTC | #1
Am 07.09.22 um 22:57 schrieb James Zhu:
> Always keep selecetd ring sched list in ctx entity.

I have no idea what you are doing here, but this certainly doesn't make 
sense.

Please explain a bit more.

Thanks,
Christian.

>
> Signed-off-by: James Zhu <James.Zhu@amd.com>
> ---
>   drivers/gpu/drm/scheduler/sched_entity.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
> index f5595607995b..39dca9cb8e0d 100644
> --- a/drivers/gpu/drm/scheduler/sched_entity.c
> +++ b/drivers/gpu/drm/scheduler/sched_entity.c
> @@ -71,7 +71,7 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,
>   	entity->guilty = guilty;
>   	entity->num_sched_list = num_sched_list;
>   	entity->priority = priority;
> -	entity->sched_list = num_sched_list > 1 ? sched_list : NULL;
> +	entity->sched_list = sched_list;
>   	entity->last_scheduled = NULL;
>   
>   	if(num_sched_list)
> @@ -453,7 +453,7 @@ void drm_sched_entity_select_rq(struct drm_sched_entity *entity)
>   	struct drm_sched_rq *rq;
>   
>   	/* single possible engine and already selected */
> -	if (!entity->sched_list)
> +	if (entity->num_sched_list <= 1)
>   		return;
>   
>   	/* queue non-empty, stay on the same engine */
> @@ -482,9 +482,6 @@ void drm_sched_entity_select_rq(struct drm_sched_entity *entity)
>   		entity->rq = rq;
>   	}
>   	spin_unlock(&entity->rq_lock);
> -
> -	if (entity->num_sched_list == 1)
> -		entity->sched_list = NULL;
>   }
>   
>   /**
James Zhu Sept. 8, 2022, 1:19 p.m. UTC | #2
Hi Christian

I need use entity->sched_list to track ring (ring = container_of(sched, 
struct amdgpu_ring, sched))

during amdgpu_ctx_fini_entity.

I think change here to keep selected ring sched list in 
entity->sched_list won't change the original logic too much.

Best Regards!

James


On 2022-09-08 2:15 a.m., Christian König wrote:
> Am 07.09.22 um 22:57 schrieb James Zhu:
>> Always keep selecetd ring sched list in ctx entity.
>
> I have no idea what you are doing here, but this certainly doesn't 
> make sense.
>
> Please explain a bit more.
>
> Thanks,
> Christian.
>
>>
>> Signed-off-by: James Zhu <James.Zhu@amd.com>
>> ---
>>   drivers/gpu/drm/scheduler/sched_entity.c | 7 ++-----
>>   1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/scheduler/sched_entity.c 
>> b/drivers/gpu/drm/scheduler/sched_entity.c
>> index f5595607995b..39dca9cb8e0d 100644
>> --- a/drivers/gpu/drm/scheduler/sched_entity.c
>> +++ b/drivers/gpu/drm/scheduler/sched_entity.c
>> @@ -71,7 +71,7 @@ int drm_sched_entity_init(struct drm_sched_entity 
>> *entity,
>>       entity->guilty = guilty;
>>       entity->num_sched_list = num_sched_list;
>>       entity->priority = priority;
>> -    entity->sched_list = num_sched_list > 1 ? sched_list : NULL;
>> +    entity->sched_list = sched_list;
>>       entity->last_scheduled = NULL;
>>         if(num_sched_list)
>> @@ -453,7 +453,7 @@ void drm_sched_entity_select_rq(struct 
>> drm_sched_entity *entity)
>>       struct drm_sched_rq *rq;
>>         /* single possible engine and already selected */
>> -    if (!entity->sched_list)
>> +    if (entity->num_sched_list <= 1)
>>           return;
>>         /* queue non-empty, stay on the same engine */
>> @@ -482,9 +482,6 @@ void drm_sched_entity_select_rq(struct 
>> drm_sched_entity *entity)
>>           entity->rq = rq;
>>       }
>>       spin_unlock(&entity->rq_lock);
>> -
>> -    if (entity->num_sched_list == 1)
>> -        entity->sched_list = NULL;
>>   }
>>     /**
>
Christian König Sept. 9, 2022, 11:18 a.m. UTC | #3
Hi James,

please use to_amdgpu_ring(entity->rq->sched) for this.

That's the scheduler which was actually picked for this entity.

Regards,
Christian.

Am 08.09.22 um 15:19 schrieb James Zhu:
> Hi Christian
>
> I need use entity->sched_list to track ring (ring = 
> container_of(sched, struct amdgpu_ring, sched))
>
> during amdgpu_ctx_fini_entity.
>
> I think change here to keep selected ring sched list in 
> entity->sched_list won't change the original logic too much.
>
> Best Regards!
>
> James
>
>
> On 2022-09-08 2:15 a.m., Christian König wrote:
>> Am 07.09.22 um 22:57 schrieb James Zhu:
>>> Always keep selecetd ring sched list in ctx entity.
>>
>> I have no idea what you are doing here, but this certainly doesn't 
>> make sense.
>>
>> Please explain a bit more.
>>
>> Thanks,
>> Christian.
>>
>>>
>>> Signed-off-by: James Zhu <James.Zhu@amd.com>
>>> ---
>>>   drivers/gpu/drm/scheduler/sched_entity.c | 7 ++-----
>>>   1 file changed, 2 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/scheduler/sched_entity.c 
>>> b/drivers/gpu/drm/scheduler/sched_entity.c
>>> index f5595607995b..39dca9cb8e0d 100644
>>> --- a/drivers/gpu/drm/scheduler/sched_entity.c
>>> +++ b/drivers/gpu/drm/scheduler/sched_entity.c
>>> @@ -71,7 +71,7 @@ int drm_sched_entity_init(struct drm_sched_entity 
>>> *entity,
>>>       entity->guilty = guilty;
>>>       entity->num_sched_list = num_sched_list;
>>>       entity->priority = priority;
>>> -    entity->sched_list = num_sched_list > 1 ? sched_list : NULL;
>>> +    entity->sched_list = sched_list;
>>>       entity->last_scheduled = NULL;
>>>         if(num_sched_list)
>>> @@ -453,7 +453,7 @@ void drm_sched_entity_select_rq(struct 
>>> drm_sched_entity *entity)
>>>       struct drm_sched_rq *rq;
>>>         /* single possible engine and already selected */
>>> -    if (!entity->sched_list)
>>> +    if (entity->num_sched_list <= 1)
>>>           return;
>>>         /* queue non-empty, stay on the same engine */
>>> @@ -482,9 +482,6 @@ void drm_sched_entity_select_rq(struct 
>>> drm_sched_entity *entity)
>>>           entity->rq = rq;
>>>       }
>>>       spin_unlock(&entity->rq_lock);
>>> -
>>> -    if (entity->num_sched_list == 1)
>>> -        entity->sched_list = NULL;
>>>   }
>>>     /**
>>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
index f5595607995b..39dca9cb8e0d 100644
--- a/drivers/gpu/drm/scheduler/sched_entity.c
+++ b/drivers/gpu/drm/scheduler/sched_entity.c
@@ -71,7 +71,7 @@  int drm_sched_entity_init(struct drm_sched_entity *entity,
 	entity->guilty = guilty;
 	entity->num_sched_list = num_sched_list;
 	entity->priority = priority;
-	entity->sched_list = num_sched_list > 1 ? sched_list : NULL;
+	entity->sched_list = sched_list;
 	entity->last_scheduled = NULL;
 
 	if(num_sched_list)
@@ -453,7 +453,7 @@  void drm_sched_entity_select_rq(struct drm_sched_entity *entity)
 	struct drm_sched_rq *rq;
 
 	/* single possible engine and already selected */
-	if (!entity->sched_list)
+	if (entity->num_sched_list <= 1)
 		return;
 
 	/* queue non-empty, stay on the same engine */
@@ -482,9 +482,6 @@  void drm_sched_entity_select_rq(struct drm_sched_entity *entity)
 		entity->rq = rq;
 	}
 	spin_unlock(&entity->rq_lock);
-
-	if (entity->num_sched_list == 1)
-		entity->sched_list = NULL;
 }
 
 /**