[PATCH] drm/xe/client: Check return value of xe_force_wake_get

Nirmoy Das nirmoy.das at linux.intel.com
Thu May 30 21:30:44 UTC 2024


Hi Himal,

On 5/30/2024 10:47 AM, Ghimiray, Himal Prasad wrote:
>
>
> On 28-05-2024 15:41, Nirmoy Das wrote:
>> xe_force_wake_get() can return error so check it's return value
>> before reading gpu_timestamp value.
>>
>> Fixes: 188ced1e0ff8 ("drm/xe/client: Print runtime to fdinfo")
>> Cc: Lucas De Marchi<lucas.demarchi at intel.com>
>> Signed-off-by: Nirmoy Das<nirmoy.das at intel.com>
>> ---
>>   drivers/gpu/drm/xe/xe_drm_client.c | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_drm_client.c b/drivers/gpu/drm/xe/xe_drm_client.c
>> index 4a19b771e3a0..0c13395ffd34 100644
>> --- a/drivers/gpu/drm/xe/xe_drm_client.c
>> +++ b/drivers/gpu/drm/xe/xe_drm_client.c
>> @@ -245,7 +245,7 @@ static void show_run_ticks(struct drm_printer *p, struct drm_file *file)
>>   	struct xe_gt *gt;
>>   	struct xe_hw_engine *hwe;
>>   	struct xe_exec_queue *q;
>> -	u64 gpu_timestamp;
>> +	u64 gpu_timestamp = 0;
>>   
>>   	xe_pm_runtime_get(xe);
>>   
>> @@ -264,7 +264,9 @@ static void show_run_ticks(struct drm_printer *p, struct drm_file *file)
>>   		if (!hwe)
>>   			continue;
>>   
>> -		xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
>
> This is becoming continuous efforts. How about introducing 
> __must_check to xe_force_wake_get ?
>
Yes, this is a good idea.
>
>
>> +		if (xe_force_wake_get(gt_to_fw(gt), XE_FW_GT))
>> +			break;
>> +
>>   		gpu_timestamp = xe_hw_engine_read_timestamp(hwe);
>>   		xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
>
> Handle any errors that may occur if xe_force_wake_put fails, possibly 
> XE_WARN_ON.
>
Will add that.


Regards,

Nirmoy

>
>>   		break;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/intel-xe/attachments/20240530/0ac8d77f/attachment.htm>


More information about the Intel-xe mailing list