[PATCH i-g-t] lib/xe_gt: Assertion related to xe_gt_stats_get_count

Sharma, Nishit nishit.sharma at intel.com
Wed Jul 30 13:41:29 UTC 2025


On 7/30/2025 12:28 PM, Sharma, Nishit wrote:
>
> On 7/29/2025 11:17 AM, priyanka.dandamudi at intel.com wrote:
>> From: Priyanka Dandamudi <priyanka.dandamudi at intel.com>
>>
>> Currently, when the specific gt stats file is not found, it fails with
>> an assertion. Due to this the test using this function also fails.
>> In general, this lib function is just to count the stats count, test
>> using this need not fail.So, now the function will warn the failure
>> when file not found and return -1 as count.
>>
>> Signed-off-by: Priyanka Dandamudi <priyanka.dandamudi at intel.com>
>> ---
>>   lib/xe/xe_gt.c | 7 +++++--
>>   1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/xe/xe_gt.c b/lib/xe/xe_gt.c
>> index afb757bfa..ed19bec74 100644
>> --- a/lib/xe/xe_gt.c
>> +++ b/lib/xe/xe_gt.c
>> @@ -185,8 +185,11 @@ int xe_gt_stats_get_count(int fd, int gt, const 
>> char *stat)
>>           minor(st.st_rdev), gt);
>>       f = fopen(path, "r");
>>   -    igt_assert_f(f, "Failed to open 
>> /sys/kernel/debug/dri/%d/gt%d/stats",
>> -             minor(st.st_rdev), gt);
>> +    if (!f) {
>> +        igt_warn("Failed to open /sys/kernel/debug/dri/%d/gt%d/stats",
>> +             minor(st.st_rdev), gt);
>> +        return -1;
>> +    }
> Looks fine!

Reviewed-by: Nishit Sharma <nishit.sharma at intel.com>


>>         while (fgets(tlb_path, sizeof(tlb_path), f)) {
>>           if (strstr(tlb_path, stat) != NULL) {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/igt-dev/attachments/20250730/afa2e122/attachment-0001.htm>


More information about the igt-dev mailing list