[PATCH 2/9] drm/xe/pat: Always call xe_force_wake_put/get in pairs

Nirmoy Das nirmoy.das at linux.intel.com
Tue Jun 4 13:06:05 UTC 2024


Hi Michal,

On 6/4/2024 2:54 PM, Michal Wajdeczko wrote:
>
> On 04.06.2024 13:02, Nirmoy Das wrote:
>> xe_force_wake_get() increments the domain ref regardless of success
>> or failure so call xe_force_wake_put() even on failure to keep ref
>> count accurate.
>>
>> Signed-off-by: Nirmoy Das <nirmoy.das at intel.com>
>> ---
>>   drivers/gpu/drm/xe/xe_pat.c | 10 +++++-----
>>   1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_pat.c b/drivers/gpu/drm/xe/xe_pat.c
>> index 4ee32ee1cc88..a5bdf4de845c 100644
>> --- a/drivers/gpu/drm/xe/xe_pat.c
>> +++ b/drivers/gpu/drm/xe/xe_pat.c
>> @@ -190,9 +190,9 @@ static void xelp_dump(struct xe_gt *gt, struct drm_printer *p)
>>   			   XELP_MEM_TYPE_STR_MAP[mem_type], pat);
>>   	}
>>   
>> -	err = xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
>>   err_fw:
>>   	xe_assert(xe, !err);
>> +	xe_assert(xe, !xe_force_wake_put(gt_to_fw(gt), XE_FW_GT));
> this is wrong as xe_assert() will be compiled out on the production
> builds, see [1]
>
> [1]
> https://www.kernel.org/doc/html/latest/gpu/xe/xe_debugging.html?highlight=xe_assert#debugging

Ah, yes! thanks for catching this.


Regards,

Nirmoy

>
>>   }
>>   
>>   static const struct xe_pat_ops xelp_pat_ops = {
>> @@ -221,9 +221,9 @@ static void xehp_dump(struct xe_gt *gt, struct drm_printer *p)
>>   			   XELP_MEM_TYPE_STR_MAP[mem_type], pat);
>>   	}
>>   
>> -	err = xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
>>   err_fw:
>>   	xe_assert(xe, !err);
>> +	xe_assert(xe, !xe_force_wake_put(gt_to_fw(gt), XE_FW_GT));
>>   }
>>   
>>   static const struct xe_pat_ops xehp_pat_ops = {
>> @@ -250,9 +250,9 @@ static void xehpc_dump(struct xe_gt *gt, struct drm_printer *p)
>>   			   REG_FIELD_GET(XEHPC_CLOS_LEVEL_MASK, pat), pat);
>>   	}
>>   
>> -	err = xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
>>   err_fw:
>>   	xe_assert(xe, !err);
>> +	xe_assert(xe, !xe_force_wake_put(gt_to_fw(gt), XE_FW_GT));
>>   }
>>   
>>   static const struct xe_pat_ops xehpc_pat_ops = {
>> @@ -284,9 +284,9 @@ static void xelpg_dump(struct xe_gt *gt, struct drm_printer *p)
>>   			   REG_FIELD_GET(XELPG_INDEX_COH_MODE_MASK, pat), pat);
>>   	}
>>   
>> -	err = xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
>>   err_fw:
>>   	xe_assert(xe, !err);
>> +	xe_assert(xe, !xe_force_wake_put(gt_to_fw(gt), XE_FW_GT));
>>   }
>>   
>>   /*
>> @@ -366,9 +366,9 @@ static void xe2_dump(struct xe_gt *gt, struct drm_printer *p)
>>   		   REG_FIELD_GET(XE2_COH_MODE, pat),
>>   		   pat);
>>   
>> -	err = xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
>>   err_fw:
>>   	xe_assert(xe, !err);
>> +	xe_assert(xe, !xe_force_wake_put(gt_to_fw(gt), XE_FW_GT));
>>   }
>>   
>>   static const struct xe_pat_ops xe2_pat_ops = {


More information about the Intel-xe mailing list