[igt-dev] [PATCH i-g-t] tests/i915_query: fix cache type iteration

Das, Nirmoy nirmoy.das at linux.intel.com
Tue Jul 12 13:49:15 UTC 2022


On 7/12/2022 2:27 PM, Andrzej Hajda wrote:
>
>
> On 11.07.2022 14:07, Nirmoy Das wrote:
>> Iterate over each cache types otherwise this will get
>> stuck in infinite loop if the value starts with 0 1st bit.
>>
>> Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6249
>> Suggested-by: Chris Wilson <chris.p.wilson at intel.com>
>> Signed-off-by: Nirmoy Das <nirmoy.das at intel.com>
>> ---
>>   tests/i915/i915_query.c | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/tests/i915/i915_query.c b/tests/i915/i915_query.c
>> index b33ffecff..ca500d2be 100644
>> --- a/tests/i915/i915_query.c
>> +++ b/tests/i915/i915_query.c
>> @@ -1348,8 +1348,7 @@ static void 
>> query_parse_and_validate_hwconfig_table(int i915)
>>               if (!value)
>>                   igt_info("-\n");
>>   -            j = 0;
>> -            while (value) {
>> +            for (j = 0; value; j++) {
>>                   if (value & BIT(j)) {
>>                       value &= ~BIT(j);
>>                       igt_assert(j < __INTEL_HWCONFIG_CACHE_TYPE_LIMIT);
>
> Personally I would put "j < __INTEL_HWCONFIG_CACHE_TYPE_LIMIT" to 
> 'for' condition check, then add igt_assert(!value) after loop


Sounds good, I will resend.


>
> Anyway:
> Reviewed-by: Andrzej Hajda <andrzej.hajda at intel.com>


I will carry this to the next rev.


Thanks,

Nirmoy

>
> Regards
> Andrzej


More information about the igt-dev mailing list