Igt-dev Archive on lore.kernel.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,
	Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Subject: [PATCH i-g-t 2/8] tests/intel/xe_sriov_scheduling: Add scheduling priority support
Date: Wed, 27 May 2026 22:56:35 +0200	[thread overview]
Message-ID: <20260527205644.2801165-3-marcin.bernatowicz@linux.intel.com> (raw)
In-Reply-To: <20260527205644.2801165-1-marcin.bernatowicz@linux.intel.com>

Extend vf_sched_params with scheduling priority and program it together
with exec quantum and preempt timeout. Also print the selected priority
in the test logs.

Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.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 | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/tests/intel/xe_sriov_scheduling.c b/tests/intel/xe_sriov_scheduling.c
index 509d6fd00..f4e674fe2 100644
--- a/tests/intel/xe_sriov_scheduling.c
+++ b/tests/intel/xe_sriov_scheduling.c
@@ -370,6 +370,7 @@ static void init_vf_ids(uint8_t *array, size_t n,
 struct vf_sched_params {
 	uint32_t exec_quantum_ms;
 	uint32_t preempt_timeout_us;
+	enum xe_sriov_sched_priority priority;
 };
 
 static int __set_vfs_scheduling_params(int pf_fd, int num_vfs,
@@ -389,6 +390,12 @@ static int __set_vfs_scheduling_params(int pf_fd, int num_vfs,
 			  p->preempt_timeout_us, ret))
 		return ret;
 
+	ret = __xe_sriov_admin_bulk_set_sched_priority(pf_fd, p->priority);
+	if (igt_warn_on_f(ret,
+			  "Failed to bulk set sched priority=%d: %d\n",
+			  p->priority, ret))
+		return ret;
+
 	return ret;
 }
 
@@ -607,10 +614,12 @@ static unsigned int select_inflight_k(unsigned int duration_ms,
 static struct vf_sched_params prepare_vf_sched_params(int num_threads,
 						      int min_num_repeats,
 						      int job_timeout_ms,
-						      const struct subm_opts *opts)
+						      const struct subm_opts *opts,
+						      enum xe_sriov_sched_priority priority)
 {
 	struct vf_sched_params params = { MIN_EXEC_QUANTUM_MS,
-					  derive_preempt_timeout_us(MIN_EXEC_QUANTUM_MS) };
+					  derive_preempt_timeout_us(MIN_EXEC_QUANTUM_MS),
+						  priority };
 
 	if (opts->exec_quantum_ms || opts->preempt_timeout_us) {
 		if (opts->exec_quantum_ms)
@@ -638,12 +647,13 @@ static struct vf_sched_params prepare_vf_sched_params(int num_threads,
 }
 
 static struct job_sched_params
-prepare_job_sched_params(int num_threads, int job_timeout_ms, const struct subm_opts *opts)
+prepare_job_sched_params(int num_threads, int job_timeout_ms, const struct subm_opts *opts,
+			 enum xe_sriov_sched_priority priority)
 {
 	struct job_sched_params params = { };
 
 	params.sched_params = prepare_vf_sched_params(num_threads, MIN_NUM_REPEATS,
-						      job_timeout_ms, opts);
+							      job_timeout_ms, opts, priority);
 	params.duration_ms = calculate_job_duration_ms(params.sched_params.exec_quantum_ms);
 	params.num_repeats = adjust_num_repeats(params.duration_ms, num_threads);
 
@@ -663,13 +673,15 @@ static void throughput_ratio(int pf_fd, int num_vfs, const struct subm_opts *opt
 	uint32_t job_timeout_ms = sysfs_get_job_timeout_ms(pf_fd, &xe_engine(pf_fd, 0)->instance);
 	struct job_sched_params job_sched_params = prepare_job_sched_params(num_vfs + 1,
 									    job_timeout_ms,
-									    opts);
+								    opts,
+								    XE_SRIOV_SCHED_PRIORITY_LOW);
 	const unsigned int k = select_inflight_k(job_sched_params.duration_ms,
 						 opts->inflight, false);
 
-	igt_info("eq=%ums pt=%uus duration=%ums repeats=%d inflight=%u num_vfs=%d job_timeout=%ums\n",
+	igt_info("eq=%ums pt=%uus prio=%s duration=%ums repeats=%d inflight=%u num_vfs=%d job_timeout=%ums\n",
 		 job_sched_params.sched_params.exec_quantum_ms,
 		 job_sched_params.sched_params.preempt_timeout_us,
+		 xe_sriov_sched_priority_to_string(job_sched_params.sched_params.priority),
 		 job_sched_params.duration_ms, job_sched_params.num_repeats,
 		 k, num_vfs + 1, job_timeout_ms);
 
@@ -759,16 +771,19 @@ static void nonpreempt_engine_resets(int pf_fd, int num_vfs,
 {
 	struct subm_set set_ = {}, *set = &set_;
 	uint32_t job_timeout_ms = sysfs_get_job_timeout_ms(pf_fd, &xe_engine(pf_fd, 0)->instance);
+	enum xe_sriov_sched_priority priority = XE_SRIOV_SCHED_PRIORITY_LOW;
 	struct vf_sched_params vf_sched_params = prepare_vf_sched_params(num_vfs, 1,
-									 job_timeout_ms, opts);
+									 job_timeout_ms, opts,
+									 priority);
 	uint64_t duration_ms = 2 * vf_sched_params.exec_quantum_ms +
 			       vf_sched_params.preempt_timeout_us / USEC_PER_MSEC;
 	int preemptible_end = 1;
 	uint8_t vf_ids[num_vfs + 1 /*PF*/];
 	const unsigned int k = select_inflight_k(duration_ms, opts->inflight, true);
 
-	igt_info("eq=%ums pt=%uus duration=%" PRIu64 "ms inflight=%u num_vfs=%d job_timeout=%ums\n",
+	igt_info("eq=%ums pt=%uus prio=%s duration=%" PRIu64 "ms inflight=%u num_vfs=%d job_timeout=%ums\n",
 		 vf_sched_params.exec_quantum_ms, vf_sched_params.preempt_timeout_us,
+		 xe_sriov_sched_priority_to_string(vf_sched_params.priority),
 		 duration_ms, k, num_vfs, job_timeout_ms);
 
 	init_vf_ids(vf_ids, ARRAY_SIZE(vf_ids),
-- 
2.43.0


  parent reply	other threads:[~2026-05-27 20:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-27 20:56 [PATCH i-g-t 0/8] tests/intel/xe_sriov_scheduling: improve scheduling coverage Marcin Bernatowicz
2026-05-27 20:56 ` [PATCH i-g-t 1/8] tests/intel/xe_sriov_scheduling: Use timestamp helper Marcin Bernatowicz
2026-05-28 10:43   ` Kamil Konieczny
2026-05-27 20:56 ` Marcin Bernatowicz [this message]
2026-05-27 20:56 ` [PATCH i-g-t 3/8] tests/intel/xe_sriov_scheduling: Make sysfs_get_job_timeout_ms take const eci Marcin Bernatowicz
2026-05-27 20:56 ` [PATCH i-g-t 4/8] tests/intel/xe_sriov_scheduling: Add PMU-based verification helpers Marcin Bernatowicz
2026-05-27 20:56 ` [PATCH i-g-t 5/8] tests/intel/xe_sriov_scheduling: Raise min exec quantum to 2ms Marcin Bernatowicz
2026-05-27 20:56 ` [PATCH i-g-t 6/8] tests/intel/xe_sriov_scheduling: Refactor throughput_ratio and nonpreempt-engine-resets test Marcin Bernatowicz
2026-05-27 20:56 ` [PATCH i-g-t 7/8] tests/intel/xe_sriov_scheduling: Remove unused log_sample_values helper Marcin Bernatowicz
2026-05-27 20:56 ` [PATCH i-g-t 8/8] tests/intel/xe_sriov_scheduling: Add default fair scheduling test Marcin Bernatowicz
2026-05-28  0:01 ` ✓ Xe.CI.BAT: success for tests/intel/xe_sriov_scheduling: improve scheduling coverage Patchwork
2026-05-28  0:04 ` ✗ i915.CI.BAT: failure " Patchwork
2026-05-28 12:15 ` ✓ Xe.CI.FULL: success " Patchwork

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=20260527205644.2801165-3-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 \
    /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