[PATCH v2 8/8] drm/xe/pmu: Add PMU support for engine busyness

Riana Tauro riana.tauro at intel.com
Mon Jan 6 14:06:31 UTC 2025


Hi Umesh

On 12/20/2024 12:16 AM, Umesh Nerlige Ramappa wrote:
> On Thu, Dec 19, 2024 at 11:17:16AM +0530, Riana Tauro wrote:
>>
>>
>> On 12/18/2024 8:21 PM, Riana Tauro wrote:
>>>
>>>
>>> On 12/18/2024 7:43 PM, Lucas De Marchi wrote:
>>>> On Wed, Dec 18, 2024 at 10:42:53AM +0530, Riana Tauro wrote:
>>>>> Hi Lucas
>>>>>
>>>>> On 12/13/2024 11:28 AM, Lucas De Marchi wrote:
>>>>>> On Thu, Nov 21, 2024 at 12:09:04PM +0530, Riana Tauro wrote:
>>>>>>> PMU provides two counters (<engine>-busy-ticks-gt<n>,
>>>>>>> <engine>-total-ticks-gt<n>) to calculate engine busyness. When 
>>>>>>> querying
>>>>>>> engine busyness, user must group these 2 counters using the 
>>>>>>> perf_event
>>>>>>> group mechanism to ensure both counters are sampled together.
>>>>>>>
>>>>>>> To list engine busyness counters use the following
>>>>>>>
>>>>>>> ./perf list
>>>>>>>  xe_0000_03_00.0/bcs0-busy-ticks-gt0/               [Kernel PMU 
>>>>>>> event]
>>>>>>
>>>>>> this will need a rebase on latest versions of the pmu patches as we
>>>>>> moved to have gt as a param rather than mangling the event name.
>>>>>
>>>>> In case of multiple gts, there might be different engines for each gt
>>>>> So should we display a common name and unsupported in case the 
>>>>> engine does not belong to the gt?
>>>>>
>>>>> sudo ./perf stat -e xe_0000_00_02.0/vcs0-busy-ticks,gt_id=0/ -I 1000
>>>>
>>>> why is engine not a param, like gt?
>> Wouldn't it be better to have engine name in the event name? Otherwise 
>> anyone using perf tool needs to find the engine class to name mapping
>>
>> @Umesh any inputs here?
> 
> sorry, I am not clear on how even gt_id is being passed here. How does 
> the gt_id fit into the struct perf_event_attr {} that we pass as the 
> event configuration? Are we using the config1/config2 fields to pass 
> these additional params?
> 
The formats(ie bits) are read from the format directory

  	    engine_class    - config:12-19
             engine_instance - config:20-27
             gt_id           - config:60-63

Then the config would be formed like this. Taking the start bit of each 
format.

config = read_pmu_config(fd, "engine-active-ticks") | (eci->gt_id << 
gt_id) | eci->engine_class << engine_class | eci->engine_instance << 
engine_instance;

Here gt_id would be 60, engine_class 12 and so on.


> fwiu, whether we pass engine as a parameter or use the name in the 
> event, we would still need to validate if the engine belongs to that gt.
That would be checked in pmu_init. It will return non-supported if 
engineis not found

Sent v3 with engine_class as parameter
https://patchwork.freedesktop.org/series/143138/

Thanks,
Riana Tauro
> 
> Thanks,
> Umesh
> 
>>> are you suggesting to have both engine and instance too as parameters?
>>> Something like this?
>>>
>>> xe_0000_00_02.0/busy-ticks,engine_class=1,engine_instance=0,gt_id=0/
>>>
>>>
>>>>
>>>> Lucas De Marchi
>>>
>>



More information about the Intel-xe mailing list