[PATCH 12/12] accel/ivpu: Share NPU busy time in sysfs

Jacek Lawrynowicz jacek.lawrynowicz at linux.intel.com
Mon May 13 11:39:40 UTC 2024


Hi,

On 13.05.2024 12:45, Tvrtko Ursulin wrote:
> 
> On 13/05/2024 11:22, Jacek Lawrynowicz wrote:
>> Hi,
>>
>> On 10.05.2024 18:55, Jeffrey Hugo wrote:
>>> On 5/8/2024 7:29 AM, Jacek Lawrynowicz wrote:
>>>> From: Tomasz Rusinowicz <tomasz.rusinowicz at intel.com>
>>>>
>>>> The driver tracks the time spent by NPU executing jobs
>>>> and shares it through sysfs `npu_busy_time_us` file.
>>>> It can be then used by user space applications to monitor device
>>>> utilization.
>>>>
>>>> NPU is considered 'busy' starting with a first job submitted
>>>> to firmware and ending when there is no more jobs pending/executing.
>>>>
>>>> Signed-off-by: Tomasz Rusinowicz <tomasz.rusinowicz at intel.com>
>>>> Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz at linux.intel.com>
>>>
>>> This feels like something that would normally be handled by perf. Why not use that mechanism?
>>
>> Yeah, probably but we had several request to provide easy to use interface for this metric that
>> could be integrated in various user space apps/tools that do not use ftrace.
> 
> Probably more Perf/PMU aka performance counters? Which would be scriptable via $kernel/tools/perf or directly via perf_event_open(2) and read(2).
> 
> Note it is not easy to get right and in the i915 implementation (see i915_pmu.c) we have a known issue with PCI hot unplug and use after free which needs input from perf core folks.

OK, we will consider using perf/pmu for NPU but for the moment I would like to keep this sysfs interface.
It so simple it can be used from bash and it always can be removed if obsoleted by something fancier.


More information about the dri-devel mailing list