[PATCH i-g-t v2 1/5] tests/intel/xe_pmu: Add a helper function to check and end cork

Riana Tauro riana.tauro at intel.com
Fri May 9 14:12:00 UTC 2025



On 5/9/2025 4:10 AM, Umesh Nerlige Ramappa wrote:
> On Thu, May 08, 2025 at 11:20:02AM +0530, Riana Tauro wrote:
>> Add a helper function to check if cork is active and
>> end cork
>>
>> Signed-off-by: Riana Tauro <riana.tauro at intel.com>
>> ---
>> tests/intel/xe_pmu.c | 10 ++++++++--
>> 1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/tests/intel/xe_pmu.c b/tests/intel/xe_pmu.c
>> index 094dc0c6c..03a966708 100644
>> --- a/tests/intel/xe_pmu.c
>> +++ b/tests/intel/xe_pmu.c
>> @@ -134,6 +134,12 @@ static uint64_t get_event_config_fn(unsigned int 
>> gt, int function,
>>     return get_event_config(gt, eci, event) | 
>> add_format_config("function", function);
>> }
>>
>> +static void check_and_end_cork(int fd, struct xe_cork *cork)
> 
> I thought xe_cork_sync_end was handling this internally, but I see a log 
> message now and not sure why that was added.
yeah but there is a warn which will cause CI to report. Will replace 
with one function

Thanks
Riana>
> You could just call this end_cork() and use it everywhere in this file 
> rather than calling 2 different flavors - xe_cork_sync_end and 
> check_and_end_cork.
> 
> Regards,
> Umesh
> 
>> +{
>> +    if (cork && !cork->ended)
>> +        xe_cork_sync_end(fd, cork);
>> +}
>> +
>> /**
>>  * SUBTEST: engine-activity-idle
>>  * Description: Test to validate engine activity shows no load when idle
>> @@ -172,8 +178,8 @@ static void engine_activity(int fd, struct 
>> drm_xe_engine_class_instance *eci, un
>>         xe_cork_sync_end(fd, cork);
>>     pmu_read_multi(pmu_fd[0], 2, after);
>>
>> -    if ((flags & TEST_LOAD) && !cork->ended)
>> -        xe_cork_sync_end(fd, cork);
>> +    if (flags & TEST_LOAD)
>> +        check_and_end_cork(fd, cork);
>>
>>     engine_active_ticks = after[0] - before[0];
>>     engine_total_ticks = after[1] - before[1];
>> -- 
>> 2.47.1
>>



More information about the igt-dev mailing list