[Intel-xe] [PATCH v9 6/8] drm/xe/ct: drop mem_access_get from g2h_worker_func()

Matthew Auld matthew.auld at intel.com
Tue May 23 13:10:14 UTC 2023


On 23/05/2023 14:04, Rodrigo Vivi wrote:
> On Tue, May 23, 2023 at 10:47:25AM +0100, Matthew Auld wrote:
>> In the next patch we track the current task executing the runtime_pm
>> callbacks, if any, in order to prevent the runtime_pm code waiting for
>> itself and deadlocking when called from the callbacks. However with
>> g2h_worker_func() we are processing g2h packets from a workqueue when
>> receiving an interrupt. The runtime callbacks needs to talk to the GuC
>> and so rely on this, however since these are processed from a workqueue
>> the current task will be different and when calling something like
>> mem_access_get() we deadlock. Callers should
> 
>> in theory
> 
> should we at least add an assert?

If we assert it will trigger in the resume callback, since "current" has 
changed :(

But it seems there are more issues. I need to rethink this patch...

> 
>> already be
>> holding an access.ref when talking to the GuC (CT communication looks to
>> be disabled when suspending the GT).
>>
>> Signed-off-by: Matthew Auld <matthew.auld at intel.com>
>> Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
>> Cc: Thomas Hellström <thomas.hellstrom at linux.intel.com>
>> Cc: Matthew Brost <matthew.brost at intel.com>
>> ---
>>   drivers/gpu/drm/xe/xe_guc_ct.c | 2 --
>>   1 file changed, 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
>> index 7a8c9d6a03f3..6e0d2d06b7f5 100644
>> --- a/drivers/gpu/drm/xe/xe_guc_ct.c
>> +++ b/drivers/gpu/drm/xe/xe_guc_ct.c
>> @@ -1081,7 +1081,6 @@ static void g2h_worker_func(struct work_struct *w)
>>   	struct xe_guc_ct *ct = container_of(w, struct xe_guc_ct, g2h_worker);
>>   	int ret;
>>   
>> -	xe_device_mem_access_get(ct_to_xe(ct));
>>   	do {
>>   		mutex_lock(&ct->lock);
>>   		ret = dequeue_one_g2h(ct);
>> @@ -1095,7 +1094,6 @@ static void g2h_worker_func(struct work_struct *w)
>>   			kick_reset(ct);
>>   		}
>>   	} while (ret == 1);
>> -	xe_device_mem_access_put(ct_to_xe(ct));
>>   }
>>   
>>   static void guc_ctb_snapshot_capture(struct xe_device *xe, struct guc_ctb *ctb,
>> -- 
>> 2.40.1
>>


More information about the Intel-xe mailing list