[PATCH i-g-t v2] tests/intel/xe_pmu: Skip tests if the engine-active-ticks event is not present
Riana Tauro
riana.tauro at intel.com
Thu Jul 31 09:06:57 UTC 2025
On 7/31/2025 1:13 PM, Soham Purkait wrote:
> Skip the tests and subtests involving the engine activity if the
> engine-active-ticks event is not present for the respective
> device.
>
> v1:
> - Add a variable has_engine_active_ticks to check for the
> existence of engine-active-ticks event. (Riana)
> v2:
> - Refactor commit title. (Jakub)
>
> Signed-off-by: Soham Purkait <soham.purkait at intel.com>
> ---
> tests/intel/xe_pmu.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/tests/intel/xe_pmu.c b/tests/intel/xe_pmu.c
> index 0e5a7360f..b0bd235e6 100644
> --- a/tests/intel/xe_pmu.c
> +++ b/tests/intel/xe_pmu.c
> @@ -106,6 +106,7 @@ const double tolerance = 0.1;
> static char xe_device[NAME_MAX];
> static bool autoprobe;
> static int total_exec_quantum;
> +static bool has_engine_active_ticks;
>
> #define test_each_engine(test, fd, hwe) \
> igt_subtest_with_dynamic(test) \
> @@ -113,6 +114,17 @@ static int total_exec_quantum;
> igt_dynamic_f("engine-%s%d", xe_engine_class_string(hwe->engine_class), \
> hwe->engine_instance)
>
> +static bool _has_engine_active_ticks(const char *device)
use a generic function supports_event or has_event with event name as
parameter. Can be reused for other events too
Thanks
Riana
> +{
> + char buf[512];
> +
> + snprintf(buf, sizeof(buf),
> + "/sys/bus/event_source/devices/%s/events/%s",
> + device,
> + "engine-active-ticks");
> + return (!!access(buf, F_OK));
> +}
> +
> static int open_pmu(int xe, uint64_t config)
> {
> int fd;
> @@ -191,6 +203,8 @@ static uint64_t get_event_config(unsigned int gt, struct drm_xe_engine_class_ins
> uint64_t pmu_config = 0;
> int ret;
>
> + igt_skip_on(has_engine_active_ticks);
> +
> ret = perf_event_config(xe_device, event, &pmu_config);
> igt_assert(ret >= 0);
> pmu_config |= add_format_config("gt", gt);
> @@ -907,6 +921,7 @@ igt_main
> fd = drm_open_driver(DRIVER_XE);
> xe_perf_device(fd, xe_device, sizeof(xe_device));
> num_engines = xe_number_engines(fd);
> + has_engine_active_ticks = _has_engine_active_ticks(xe_device);
> }
>
> igt_describe("Validate PMU gt-c6 residency counters when idle");
More information about the igt-dev
mailing list