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 5F8A5CCF9ED for ; Mon, 27 Oct 2025 14:43:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 123F410E4C0; Mon, 27 Oct 2025 14:43:07 +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="h0JzYByB"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id C9BBF10E4C0 for ; Mon, 27 Oct 2025 14:43:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1761576187; x=1793112187; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4sWm9xzuJBcqGWIW9JAniE5pptQHQBu9brDO/IFF/Fo=; b=h0JzYByBVRIr0ou4kWesFDEZZc3jjTU01eIoHxqU1Fsrdiq5dTHaOknO T/HQqh+jLxktWPnJ5kfbEUYQPM5/EfHv7M1z1AmPAtjfHiikvRY6CHLNp ChqWW2a3jQM5heFYUm2T7xi7GdBhllMmsSqHwqN7KL0clq6UQoALsnFvW L63YARKr4gVlcqru0vQ8Czd30YFlKSOR71ddEHJQTPI3swHTEAD+sWhmj XEzQM4+y2p+nqjKrx9DGNYC/CQ8ZpGmYg7XYggkM/kzT/vCuGq8VBCinr iI5ZdVU4LlradYMwaxzCHhtvgCnIvuIK6eHVkPW4X074Kr9bHLk3FYoR6 Q==; X-CSE-ConnectionGUID: tJjpYAn5Qqa8SUo77DE4Rw== X-CSE-MsgGUID: pXedPqKqTCiHGiKxmKhKFw== X-IronPort-AV: E=McAfee;i="6800,10657,11586"; a="67299860" X-IronPort-AV: E=Sophos;i="6.19,259,1754982000"; d="scan'208";a="67299860" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2025 07:43:07 -0700 X-CSE-ConnectionGUID: oR20ppaATqWguhvdUexARg== X-CSE-MsgGUID: K/jFq/RsQlikJA5Rn9FT9Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,259,1754982000"; d="scan'208";a="184683879" Received: from anirban-z690i-a-ultra-plus.iind.intel.com ([10.190.216.83]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2025 07:43:04 -0700 From: Sk Anirban To: igt-dev@lists.freedesktop.org Cc: anshuman.gupta@intel.com, badal.nilawar@intel.com, riana.tauro@intel.com, karthik.poosa@intel.com, raag.jadav@intel.com, soham.purkait@intel.com, mallesh.koujalagi@intel.com, Sk Anirban Subject: [i-g-t, v7, 2/3] tests/intel/xe_survivability: Add new test runtime survivability Date: Mon, 27 Oct 2025 20:08:46 +0530 Message-ID: <20251027143846.3149322-7-sk.anirban@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251027143846.3149322-5-sk.anirban@intel.com> References: <20251027143846.3149322-5-sk.anirban@intel.com> MIME-Version: 1.0 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" Inject CSC error using debugfs to test vendor-specific device wedged state and runtime survivability mode. To return the device to a normal state, reload the driver, as the wedged state can only be resolved by rebinding/reprobing the driver. v3: Update commit message (Riana) Modify the uevents interrupt handling (Riana) v4: Move test to xe_survivability (Riana) v5: Use separate function for sysfs (Riana) Cosmetic changes (Riana) Use basic spinner (Riana) v6: Move VF check (Riana) Modify commit message (Riana) Add test description (Riana) v7: Modify igt fixture (Riana) Update the uevent_intercept function (Riana) Signed-off-by: Sk Anirban --- tests/intel-ci/xe-fast-feedback.testlist | 2 + tests/intel/xe_survivability.c | 105 +++++++++++++++++++++++ 2 files changed, 107 insertions(+) diff --git a/tests/intel-ci/xe-fast-feedback.testlist b/tests/intel-ci/xe-fast-feedback.testlist index 017e3ba2a..5f27baafb 100644 --- a/tests/intel-ci/xe-fast-feedback.testlist +++ b/tests/intel-ci/xe-fast-feedback.testlist @@ -185,6 +185,8 @@ igt@xe_sysfs_scheduler@timeslice_duration_us-invalid igt@xe_sysfs_scheduler@timeslice_duration_us-min-max igt@xe_sysfs_scheduler@job_timeout_ms-invalid igt@xe_sysfs_scheduler@job_timeout_ms-min-max +igt@xe_survivability@i2c-functionality +igt@xe_survivability@runtime-survivability #igt@xe_vm@bind-once #igt@xe_vm@scratch igt@xe_vm@shared-pte-page diff --git a/tests/intel/xe_survivability.c b/tests/intel/xe_survivability.c index 432220a35..8961d95db 100644 --- a/tests/intel/xe_survivability.c +++ b/tests/intel/xe_survivability.c @@ -4,6 +4,7 @@ */ #include #include +#include #include #include "igt.h" @@ -13,7 +14,11 @@ #include "igt_kmod.h" #include "igt_sriov_device.h" #include "igt_sysfs.h" +#include "intel_allocator.h" +#include "xe/xe_gt.h" +#include "xe/xe_ioctl.h" #include "xe/xe_query.h" +#include "xe/xe_spin.h" /** * TEST: Comprehensive survivability mode testing @@ -26,10 +31,24 @@ * * SUBTEST: i2c-functionality * Description: Validate i2c adapter functionality in survivability mode + * + * SUBTEST: runtime-survivability + * Description: Force Xe device wedged after injecting a failure in CSC + * to test runtime survivability mode */ static char bus_addr[NAME_MAX]; +static void ignore_wedged_in_dmesg(void) +{ + /* this is needed for igt_runner so it will ignore it */ + igt_emit_ignore_dmesg_regex("CRITICAL: Xe has declared device [0-9A-Fa-f:.]* as wedged" + "|GT[0-9A-Fa-f]*: reset failed .-ECANCELED" + "|GT[0-9A-Fa-f]*: Failed to submit" + "|Modules linked in:" + "|__pfx___drm_"); +} + static bool check_survivability_mode_sysfs(void) { char path[PATH_MAX]; @@ -42,6 +61,55 @@ static bool check_survivability_mode_sysfs(void) return true; } +static void check_survivability_and_uevents(int fd, struct udev_monitor *mon) +{ + struct udev_device *dev; + const char *prop_val; + const char *dev_path; + struct pollfd poll_fd = { + .fd = udev_monitor_get_fd(mon), + .events = POLLIN + }; + bool event_received = false; + int timeout_secs = 10; + + check_survivability_mode_sysfs(); + + while (!event_received && poll(&poll_fd, 1, timeout_secs * 1000)) { + dev = udev_monitor_receive_device(mon); + if (!dev) + continue; + + prop_val = udev_device_get_property_value(dev, "WEDGED"); + dev_path = udev_device_get_property_value(dev, "DEVPATH"); + seqnum = udev_device_get_property_value(dev, "SEQNUM"); + + if (prop_val && !strcmp(prop_val, "vendor-specific")) { + event_received = true; + igt_assert_f(dev_path && strstr(dev_path, bus_addr), + "Expected bus address '%s' to be part of DEVPATH '%s'", + bus_addr, dev_path); + } + + udev_device_unref(dev); + } + + igt_cleanup_uevents(mon); + + igt_assert_f(event_received, + "Timeout waiting for vendor-specific wedged event after %d seconds", + timeout_secs); +} + +static void force_wedged_csc_error(int fd) +{ + igt_debugfs_write(fd, "inject_csc_hw_error/probability", "100"); + igt_debugfs_write(fd, "inject_csc_hw_error/times", "1"); + + xe_force_gt_reset_sync(fd, 0); + sleep(1); +} + static int find_i2c_adapter(struct pci_device *pci_xe) { char device_path[PATH_MAX]; @@ -121,6 +189,18 @@ static int create_device_configfs_group(int configfs_fd) return configfs_device_fd; } +static void test_spinner_after_recovery(int fd) +{ + uint64_t ahnd; + igt_spin_t *spin; + + ahnd = intel_allocator_open(fd, 0, INTEL_ALLOCATOR_RELOC); + spin = igt_spin_new(fd, .ahnd = ahnd); + + igt_spin_free(fd, spin); + put_ahnd(ahnd); +} + igt_main { int fd, configfs_fd, configfs_device_fd; @@ -148,6 +228,31 @@ igt_main fd = drm_open_driver(DRIVER_XE); } + igt_describe("Inject CSC error to test device wedge and runtime survivability"); + igt_subtest("runtime-survivability") { + struct udev_monitor *mon; + + igt_require(igt_debugfs_exists(fd, "inject_csc_hw_error/probability", + O_RDWR)); + + igt_debugfs_write(fd, "inject_csc_hw_error/verbose", "1"); + + ignore_wedged_in_dmesg(); + mon = igt_watch_uevents(); + force_wedged_csc_error(fd); + + check_survivability_and_uevents(fd, mon); + + drm_close_driver(fd); + igt_kmod_rebind("xe", bus_addr); + fd = drm_open_driver(DRIVER_XE); + + test_spinner_after_recovery(fd); + + igt_debugfs_write(fd, "inject_csc_hw_error/probability", "0"); + igt_debugfs_write(fd, "inject_csc_hw_error/times", "1"); + } + igt_fixture { igt_fs_remove_dir(configfs_fd, bus_addr); close(configfs_device_fd); -- 2.43.0