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 0CED9C56201 for ; Fri, 20 Feb 2026 15:38:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AE98110E80D; Fri, 20 Feb 2026 15:38:20 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="lzSDNL2X"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7939910E80D for ; Fri, 20 Feb 2026 15:38:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1771601900; x=1803137900; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DvAGNUCQG9NHbc2bsV63F9g8pRq+JLPEp7UokV0gjUs=; b=lzSDNL2X0AbnvaZvY7M7S07e0a7pzHhZbWEHaEAP5n3InlqR5NzMsIRL PEoKGFwkAxRNMjRSl7LKaKA9C6Fmsbpm1z8pf6fEUXMUQbwBOzrJH4dfc 5Ld4XQph62uz3YnfP8TwxfGmNR5BxuGU5fZ54DkmesnvuI/r+16YMiNZ3 aeyXrMtW8mTqE2w3um2uJJSD9mZMuSBKsGZEUUR0LeMRvGsI5gTvNhs42 ebKkOKxtC4aJEyxd3SrOCAMSM+AC8PpF1DBbUqtK97aR6hFgIhGxI3ctq 36U9jfEZwOmMQum+b4EqgVPBSALylli62GvlScbkdvN9EkhaV6r59B683 w==; X-CSE-ConnectionGUID: uNBrW36hS+agSDs8d/Krew== X-CSE-MsgGUID: qokq4U30TGWTdXVFj2zMvQ== X-IronPort-AV: E=McAfee;i="6800,10657,11707"; a="90105379" X-IronPort-AV: E=Sophos;i="6.21,302,1763452800"; d="scan'208";a="90105379" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Feb 2026 07:38:20 -0800 X-CSE-ConnectionGUID: m5YyHZOPRNWHhiH2D1RBaw== X-CSE-MsgGUID: vMHMdWknQDiyQOnGjOeOEg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,302,1763452800"; d="scan'208";a="215007696" Received: from cmanszew-dev.igk.intel.com ([10.91.214.222]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Feb 2026 07:38:17 -0800 From: Christoph Manszewski To: igt-dev@lists.freedesktop.org Cc: Rudnicki@freedesktop.org, Piotr , Piatkowski@freedesktop.org, Dominik Karol , Jan Sokolowski , Christoph Manszewski Subject: [PATCH i-g-t v4 2/5] lib/xe/xe_eudebug: Modify toggle error handling Date: Fri, 20 Feb 2026 16:37:51 +0100 Message-ID: <20260220153748.210381-9-christoph.manszewski@intel.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20260220153748.210381-7-christoph.manszewski@intel.com> References: <20260220153748.210381-7-christoph.manszewski@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Organization: Intel Technology Poland sp. z o.o. - ul. Slowackiego 173, 80-298 Gdansk - KRS 101882 - NIP 957-07-52-316 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" From: Dominik Karol PiÄ…tkowski Convert __xe_eudebug_enable_getset to use errno. Abort in xe_eudebug_enable on error (other than -ENOENT) to not leave the environment in potentially dirty state. Signed-off-by: Dominik Karol PiÄ…tkowski Signed-off-by: Christoph Manszewski --- lib/xe/xe_eudebug.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/lib/xe/xe_eudebug.c b/lib/xe/xe_eudebug.c index 2387b74f8..41eed7614 100644 --- a/lib/xe/xe_eudebug.c +++ b/lib/xe/xe_eudebug.c @@ -1829,6 +1829,7 @@ static void metadata_event(struct xe_eudebug_client *c, uint32_t flags, xe_eudebug_event_log_write(c->log, (void *)&em); } +#define EU_DEBUG_TOGGLE "device/enable_eudebug" /** * __xe_eudebug_enable_getset * @fd: xe client @@ -1838,13 +1839,12 @@ static void metadata_event(struct xe_eudebug_client *c, uint32_t flags, * Stores current eudebug feature state in @old if not NULL. Sets new eudebug * feature state to @new if not NULL. Asserts if both @old and @new are NULL. * - * Returns: 0 on success, -1 on failure. + * Returns: 0 on success, -errno on failure. */ int __xe_eudebug_enable_getset(int fd, bool *old, bool *new) { - static const char * const fname = "enable_eudebug"; int ret = 0; - int sysfs, device_fd; + int sysfs; bool val_before; struct stat st; @@ -1853,15 +1853,10 @@ int __xe_eudebug_enable_getset(int fd, bool *old, bool *new) sysfs = igt_sysfs_open(fd); if (sysfs < 0) - return -1; - - device_fd = openat(sysfs, "device", O_DIRECTORY | O_RDONLY); - close(sysfs); - if (device_fd < 0) - return -1; + return -errno; - if (!__igt_sysfs_get_boolean(device_fd, fname, &val_before)) { - ret = -1; + if (!__igt_sysfs_get_boolean(sysfs, EU_DEBUG_TOGGLE, &val_before)) { + ret = -errno; goto out; } @@ -1871,14 +1866,14 @@ int __xe_eudebug_enable_getset(int fd, bool *old, bool *new) *old = val_before; if (new) { - if (__igt_sysfs_set_boolean(device_fd, fname, *new)) - igt_assert_eq(igt_sysfs_get_boolean(device_fd, fname), *new); + if (__igt_sysfs_set_boolean(sysfs, EU_DEBUG_TOGGLE, *new)) + igt_assert_eq(igt_sysfs_get_boolean(sysfs, EU_DEBUG_TOGGLE), *new); else - ret = -1; + ret = -errno; } out: - close(device_fd); + close(sysfs); return ret; } @@ -1896,10 +1891,18 @@ out: */ bool xe_eudebug_enable(int fd, bool enable) { + char sysfs_path[PATH_MAX]; bool old = false; int ret = __xe_eudebug_enable_getset(fd, &old, &enable); - igt_skip_on(ret); + if (ret == -ENOENT) { + igt_assert(igt_sysfs_path(fd, sysfs_path, sizeof(sysfs_path))); + igt_skip("'%s/" EU_DEBUG_TOGGLE + "' sysfs attribute not found, EU DEBUG not supported\n", sysfs_path); + } + + igt_abort_on_f(ret, "xe_eudebug_enable: Failed to %s eudebug\n", + enable ? "enable" : "disable"); return old; } -- 2.47.1