[igt-dev] [PATCH i-g-t] i915/i915_pm_rps: Don't use gem_write in batch_create

Karolina Drobnik karolina.drobnik at intel.com
Fri Aug 5 08:21:18 UTC 2022


Hi Kamil,

Thanks for your swift review.

On 04.08.2022 21:59, Kamil Konieczny wrote:
> Hi,
> 
> On 2022-08-04 at 15:26:17 +0200, Karolina Drobnik wrote:
>> From: Chris Wilson <chris at chris-wilson.co.uk>
>>
>> In fence_order and engine_order we are repeatedly creating big mmaps
>> that are very slow when done via gem_write, causing test timeouts.
>> Rewrite batch_create to mmap the buffer directly instead of using
>> gem_write.
>>
>> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
>> Signed-off-by: Karolina Drobnik <karolina.drobnik at intel.com>
>> ---
>>   tests/i915/i915_pm_rps.c | 10 +++++++---
>>   1 file changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/tests/i915/i915_pm_rps.c b/tests/i915/i915_pm_rps.c
>> index a45a6905..d06ade27 100644
>> --- a/tests/i915/i915_pm_rps.c
>> +++ b/tests/i915/i915_pm_rps.c
>> @@ -621,11 +621,15 @@ static uint32_t batch_create(int i915, uint64_t sz)
>>   	const uint32_t bbe = MI_BATCH_BUFFER_END;
>>   	const uint32_t chk = 0x5 << 23;
>>   	uint32_t handle = gem_create(i915, sz);
>> +	uint32_t *map;
>>   
>> -	for (uint64_t pg = 4096; pg + 4096 < sz; pg += 4096)
>> -		gem_write(i915, handle, pg, &chk, sizeof(chk));
>> +	map = gem_mmap__device_coherent(i915, handle, 0, sz, PROT_WRITE);
>>   
>> -	gem_write(i915, handle, sz - sizeof(bbe), &bbe, sizeof(bbe));
>> +	for (uint64_t pg = 1; pg * 4096 < sz; pg++)
>> +		map[(pg * 4096) / sizeof(*map)] = chk;
>> +
>> +	map[sz / sizeof(*map) - 1] = bbe;
> 
> Are there any arch where we run igt/i915 and sizeof(*map) == 4 ?
> Just curious.

Do you mean the size of the pointer or the actual value? iiuc, we test 
igts on x86_64, arm64, armhf (which is 32 bit) and mips, so there is at
least one platform with 4 byte-wide pointers; uint32_t is size-fixed

All the best,
Karolina

>> +	munmap(map, sz);
> 
> Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> 
>>   
>>   	return handle;
>>   }
>> -- 
>> 2.25.1
>>


More information about the igt-dev mailing list