From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8C124CD98CE for ; Fri, 12 Jun 2026 11:08:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3DCAC10F43B; Fri, 12 Jun 2026 11:08:06 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="XpEx7FXG"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) by gabe.freedesktop.org (Postfix) with ESMTPS id CD57810F463 for ; Fri, 12 Jun 2026 11:07:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1781262423; x=1812798423; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=exfTIHE28fmdSyUNYk14cH7l90JAXtzshmVcxbunxDw=; b=XpEx7FXGi8EpGpeJHEpxMc18b1/xOFd/6nVdbzEa8Wr0B19cpoyefocN iceKNFGGyL2NeQjVmzU5SIiO3PPcxD62oNm7SID0Lft31tb6p8CdFOu5Q G9+V/9dQloNya7V4Hj9bs8Yc8ksNSHnWwVZqmCi8ZsXXC8FhfG1VUUcGS eGKOTD3Nqf0wUNHtPr648rETg0h6ggUL35BTjlydjsz/Ocr2MF7nWdUQw dp18pkibqk/Cg91eTCKfmAhe6JcnNGk+CNvjwGYT1Yjry4v3dyH3VB0cf KD29J7oZuv8p6cpMalFFv5HIIOAsJFr2OILlRmbaTJl0CB2u+lsMTjyho w==; X-CSE-ConnectionGUID: 8cjUZy6ZTDCuXd3p9n+qWQ== X-CSE-MsgGUID: ONMhGlYEQoa8BJMb+AmGjA== X-IronPort-AV: E=McAfee;i="6800,10657,11813"; a="81997613" X-IronPort-AV: E=Sophos;i="6.24,200,1774335600"; d="scan'208";a="81997613" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2026 04:07:03 -0700 X-CSE-ConnectionGUID: ryRBigR4TD+/NVbMqFqMnw== X-CSE-MsgGUID: 9WWmKFa9RZ6ntmcECLeXzg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.24,200,1774335600"; d="scan'208";a="250717757" Received: from slindbla-desk.ger.corp.intel.com (HELO fedora) ([10.245.245.68]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2026 04:07:01 -0700 From: =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= To: igt-dev@lists.freedesktop.org Cc: =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Matthew Brost , Maarten Lankhorst , Michal Mrozek , John Falkowski , Rodrigo Vivi , Lahtinen Joonas Subject: [PATCH i-g-t 3/4] tests/intel/xe_exec_compute_mode: Add a listener for file events Date: Fri, 12 Jun 2026 13:06:18 +0200 Message-ID: <20260612110619.103198-4-thomas.hellstrom@linux.intel.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260612110619.103198-1-thomas.hellstrom@linux.intel.com> References: <20260612110619.103198-1-thomas.hellstrom@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: igt-dev@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development mailing list for IGT GPU Tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" Using the new xe_watch library functionality, add a listener for file events. The listener gets notified on * File close, * Lost event, * Rebind worker error. But doesn't take any action. Assisted-by: GitHub Copilot:claude-sonnet-4.6 Signed-off-by: Thomas Hellström --- tests/intel/xe_exec_compute_mode.c | 63 +++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/tests/intel/xe_exec_compute_mode.c b/tests/intel/xe_exec_compute_mode.c index 438ea163f..5bab971b0 100644 --- a/tests/intel/xe_exec_compute_mode.c +++ b/tests/intel/xe_exec_compute_mode.c @@ -19,9 +19,14 @@ #include #include "xe_drm.h" +/* Don't include linux/fcntl.h since we already included */ +#define _LINUX_FCNTL_H +#include "xe_drm_events.h" + #include "xe/xe_ioctl.h" #include "xe/xe_query.h" #include "xe/xe_spin.h" +#include "xe/xe_watch.h" #include #define MAX_N_EXECQUEUES 16 @@ -35,6 +40,52 @@ #define FREE_MAPPPING (0x1 << 7) #define UNMAP_MAPPPING (0x1 << 8) +static void xe_event_fn(struct xe_watch_event *event) +{ + const struct watch_notification *notif = event->notif; + const struct drm_xe_watch_notification_vm_err *err_event = + igt_container_of(notif, err_event, base); + + switch (notif->type) { + case WATCH_TYPE_META: + switch (notif->subtype) { + case WATCH_META_REMOVAL_NOTIFICATION: + igt_info("The device file was closed.\n"); + break; + case WATCH_META_LOSS_NOTIFICATION: + igt_warn("The listener lost a message.\n"); + break; + default: + igt_warn("Unknown META subtype.\n"); + break; + } + break; + + case WATCH_TYPE_DRM_XE_NOTIFY: + switch (notif->subtype) { + case DRM_XE_WATCH_EVENT_VM_ERR: + igt_info("VM with id %u saw an error: %d\n", + (unsigned int) err_event->vm_id, + (int) err_event->error_code); + break; + default: + igt_warn("Unknown XE watch subtype %u\n", + (unsigned int) notif->subtype); + break; + } + + break; + + default: + igt_warn("Unknown watch type %u.\n", notif->type); + break; + } +} + +const struct xe_watch_event_ops event_ops = { + .event_deliver = xe_event_fn, +}; + /** * SUBTEST: twice-%s * Description: Run %arg[1] compute machine test twice @@ -430,9 +481,15 @@ int igt_main() { NULL }, }; int fd; + struct xe_watch_event watch_event = { + .ops = &event_ops, + }; + struct xe_watch_listener *listener; - igt_fixture() + igt_fixture() { fd = drm_open_driver(DRIVER_XE); + listener = xe_watch_listener_create(fd, &watch_event); + } for (const struct section *s = sections; s->name; s++) { igt_subtest_f("once-%s", s->name) @@ -465,6 +522,8 @@ int igt_main() lr_mode_workload(fd); - igt_fixture() + igt_fixture() { drm_close_driver(fd); + xe_watch_listener_destroy(listener); + } } -- 2.54.0