public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: adam.miszczak@linux.intel.com, jakub1.kolakowski@intel.com,
	lukasz.laguna@intel.com, michal.wajdeczko@intel.com,
	Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Subject: [PATCH v3 i-g-t 07/10] tests/intel/xe_sriov_scheduling: Avoid assert on scheduling params restore in cleanup
Date: Wed, 28 Jan 2026 19:08:13 +0100	[thread overview]
Message-ID: <20260128180819.1373376-8-marcin.bernatowicz@linux.intel.com> (raw)
In-Reply-To: <20260128180819.1373376-1-marcin.bernatowicz@linux.intel.com>

Add __set_vfs_scheduling_params() that returns error instead of asserting.
Use the non-asserting helper in cleanup paths to ensure VFs are properly
disabled before aborting.

Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Reviewed-by: Lukasz Laguna <lukasz.laguna@intel.com>
Cc: Adam Miszczak <adam.miszczak@linux.intel.com>
Cc: Jakub Kolakowski <jakub1.kolakowski@intel.com>
Cc: Lukasz Laguna <lukasz.laguna@intel.com>
---
 tests/intel/xe_sriov_scheduling.c | 41 ++++++++++++++++++++++++-------
 1 file changed, 32 insertions(+), 9 deletions(-)

diff --git a/tests/intel/xe_sriov_scheduling.c b/tests/intel/xe_sriov_scheduling.c
index fad3cbb04..117737d5f 100644
--- a/tests/intel/xe_sriov_scheduling.c
+++ b/tests/intel/xe_sriov_scheduling.c
@@ -371,17 +371,36 @@ struct vf_sched_params {
 	uint32_t preempt_timeout_us;
 };
 
-static void set_vfs_scheduling_params(int pf_fd, int num_vfs,
-				      const struct vf_sched_params *p)
+static int __set_vfs_scheduling_params(int pf_fd, int num_vfs,
+				       const struct vf_sched_params *p)
 {
 	unsigned int gt;
+	int vf, ret;
 
 	xe_for_each_gt(pf_fd, gt) {
-		for (int vf = 0; vf <= num_vfs; ++vf) {
-			xe_sriov_set_exec_quantum_ms(pf_fd, vf, gt, p->exec_quantum_ms);
-			xe_sriov_set_preempt_timeout_us(pf_fd, vf, gt, p->preempt_timeout_us);
+		for (vf = 0; vf <= num_vfs; ++vf) {
+			ret = __xe_sriov_set_exec_quantum_ms(pf_fd, vf, gt,
+							     p->exec_quantum_ms);
+			if (igt_warn_on_f(ret,
+					  "Failed to set exec_quantum_ms=%u (VF%d GT%u): %d\n",
+					  p->exec_quantum_ms, vf, gt, ret))
+				return ret;
+
+			ret = __xe_sriov_set_preempt_timeout_us(pf_fd, vf, gt,
+								p->preempt_timeout_us);
+			if (igt_warn_on_f(ret,
+					  "Failed to set preempt_timeout_us=%u (VF%d GT%u): %d\n",
+					  p->preempt_timeout_us, vf, gt, ret))
+				return ret;
 		}
 	}
+	return 0;
+}
+
+static void set_vfs_scheduling_params(int pf_fd, int num_vfs,
+				      const struct vf_sched_params *p)
+{
+	igt_assert_eq(0, __set_vfs_scheduling_params(pf_fd, num_vfs, p));
 }
 
 static bool check_within_epsilon(const double x, const double ref, const double tol)
@@ -729,7 +748,7 @@ static void throughput_ratio(int pf_fd, int num_vfs, const struct subm_opts *opt
 
 	/* cleanup */
 	subm_set_fini(set);
-	set_vfs_scheduling_params(pf_fd, num_vfs, &(struct vf_sched_params){});
+	__set_vfs_scheduling_params(pf_fd, num_vfs, &(struct vf_sched_params){});
 	xe_sriov_disable_vfs_restore_auto_provisioning(pf_fd);
 }
 
@@ -815,7 +834,7 @@ static void nonpreempt_engine_resets(int pf_fd, int num_vfs,
 
 	/* cleanup */
 	subm_set_fini(set);
-	set_vfs_scheduling_params(pf_fd, num_vfs, &(struct vf_sched_params){});
+	__set_vfs_scheduling_params(pf_fd, num_vfs, &(struct vf_sched_params){});
 	xe_sriov_disable_vfs_restore_auto_provisioning(pf_fd);
 }
 
@@ -923,8 +942,10 @@ int igt_main_args("", long_opts, help_str, subm_opts_handler, NULL)
 	}
 
 	igt_fixture() {
-		set_vfs_scheduling_params(pf_fd, igt_sriov_get_total_vfs(pf_fd),
-					  &(struct vf_sched_params){});
+		int ret;
+
+		ret = __set_vfs_scheduling_params(pf_fd, igt_sriov_get_total_vfs(pf_fd),
+						  &(struct vf_sched_params){});
 		xe_sriov_disable_vfs_restore_auto_provisioning(pf_fd);
 		/* abort to avoid execution of next tests with enabled VFs */
 		igt_abort_on_f(igt_sriov_get_enabled_vfs(pf_fd) > 0,
@@ -933,6 +954,8 @@ int igt_main_args("", long_opts, help_str, subm_opts_handler, NULL)
 			    igt_sriov_disable_driver_autoprobe(pf_fd);
 		igt_abort_on_f(autoprobe != igt_sriov_is_driver_autoprobe_enabled(pf_fd),
 			       "Failed to restore sriov_drivers_autoprobe value\n");
+		igt_abort_on_f(ret,
+			       "Failed to restore scheduling params\n");
 		drm_close_driver(pf_fd);
 	}
 }
-- 
2.43.0


  parent reply	other threads:[~2026-01-28 18:09 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-28 18:08 [PATCH v3 i-g-t 00/10] Xe SR-IOV admin scheduling helpers and test updates Marcin Bernatowicz
2026-01-28 18:08 ` [PATCH v3 i-g-t 01/10] lib/igt_sysfs_choice: Add helpers for sysfs enumerated choice attributes Marcin Bernatowicz
2026-01-29  8:19   ` Laguna, Lukasz
2026-01-28 18:08 ` [PATCH v3 i-g-t 02/10] lib/tests/igt_sysfs_choice: Add test coverage Marcin Bernatowicz
2026-01-29  8:19   ` Laguna, Lukasz
2026-01-28 18:08 ` [PATCH v3 i-g-t 03/10] lib/xe/xe_sriov_provisioning: Add string conversion helpers for scheduling priority Marcin Bernatowicz
2026-01-28 18:08 ` [PATCH v3 i-g-t 04/10] lib/xe/xe_sriov_provisioning: Add sched priority mask to string helper Marcin Bernatowicz
2026-01-29  8:19   ` Laguna, Lukasz
2026-01-28 18:08 ` [PATCH v3 i-g-t 05/10] lib/igt_sriov_device: Add helper for PF/VF sysfs path formatting Marcin Bernatowicz
2026-01-28 18:08 ` [PATCH v3 i-g-t 06/10] lib/xe/xe_sriov_admin: Add SR-IOV admin sysfs accessors Marcin Bernatowicz
2026-01-29  8:21   ` Laguna, Lukasz
2026-01-28 18:08 ` Marcin Bernatowicz [this message]
2026-01-28 18:08 ` [PATCH v3 i-g-t 08/10] tests/intel/xe_sriov_scheduling: Prefer " Marcin Bernatowicz
2026-01-28 18:08 ` [PATCH v3 i-g-t 09/10] tests/intel/xe_pmu: " Marcin Bernatowicz
2026-01-28 18:08 ` [PATCH v3 i-g-t 10/10] tests/intel/xe_sriov_admin: Add SR-IOV admin sysfs scheduling attributes tests Marcin Bernatowicz
2026-01-29  8:21   ` Laguna, Lukasz
2026-01-28 20:32 ` ✓ Xe.CI.BAT: success for Xe SR-IOV admin scheduling helpers and test updates (rev3) Patchwork
2026-01-28 20:47 ` ✗ i915.CI.BAT: failure " Patchwork
2026-01-29 10:11   ` Bernatowicz, Marcin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260128180819.1373376-8-marcin.bernatowicz@linux.intel.com \
    --to=marcin.bernatowicz@linux.intel.com \
    --cc=adam.miszczak@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jakub1.kolakowski@intel.com \
    --cc=lukasz.laguna@intel.com \
    --cc=michal.wajdeczko@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox