[RFC 01/14] drm/xe: Make exec_queue_kill safe to call twice

Daniele Ceraolo Spurio daniele.ceraolospurio at intel.com
Fri Jul 12 22:22:43 UTC 2024



On 7/12/2024 3:11 PM, Matthew Brost wrote:
> On Fri, Jul 12, 2024 at 02:28:45PM -0700, Daniele Ceraolo Spurio wrote:
>> An upcoming PXP patch will kill queues at runtime when a PXP
>> invalidation event occurs, so we need exec_queue_kill to be safe to call
>> multiple times.
>>
>> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
>> Cc: Matthew Brost <matthew.brost at intel.com>
> Not opposed this patch but is this really required for PXP as PXP queue
> are not in LR mode are they?
>
> Either way, I'm open to accepting this as xe_exec_queue_kill probably
> should be safe to call twice anyways.

Not required for PXP, no. I just really didn't like the idea of calling 
a function twice when it wasn't designed to support multiple calls, even 
if it didn't apply to my specific case.

Daniele

>
> Matt
>
>> ---
>>   drivers/gpu/drm/xe/xe_vm.c | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
>> index 5b166fa03684..02f684c0330d 100644
>> --- a/drivers/gpu/drm/xe/xe_vm.c
>> +++ b/drivers/gpu/drm/xe/xe_vm.c
>> @@ -280,8 +280,10 @@ void xe_vm_remove_compute_exec_queue(struct xe_vm *vm, struct xe_exec_queue *q)
>>   		return;
>>   
>>   	down_write(&vm->lock);
>> -	list_del(&q->lr.link);
>> -	--vm->preempt.num_exec_queues;
>> +	if (!list_empty(&q->lr.link)) {
>> +		list_del_init(&q->lr.link);
>> +		--vm->preempt.num_exec_queues;
>> +	}
>>   	if (q->lr.pfence) {
>>   		dma_fence_enable_sw_signaling(q->lr.pfence);
>>   		dma_fence_put(q->lr.pfence);
>> -- 
>> 2.43.0
>>



More information about the Intel-xe mailing list