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>,
Jonathan Cavitt <jonathan.cavitt@intel.com>,
Kamil Konieczny <kamil.konieczny@linux.intel.com>
Subject: [PATCH i-g-t v2 09/10] tests/intel/xe_pmu: Prefer SR-IOV admin sysfs accessors
Date: Tue, 25 Nov 2025 11:23:08 +0100 [thread overview]
Message-ID: <20251125102312.43142-10-marcin.bernatowicz@linux.intel.com> (raw)
In-Reply-To: <20251125102312.43142-1-marcin.bernatowicz@linux.intel.com>
Switch xe_pmu scheduling configuration to the SR-IOV admin sysfs
setters for exec_quantum_ms, preempt_timeout_us and sched_priority,
skipping the test if sriov_admin is not available.
Also adopts the “Tie preempt timeout to exec quantum” change using the
new sriov_admin interface.
Link: https://lore.kernel.org/igt-dev/20251107151251.6323-2-jonathan.cavitt@intel.com/
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: Jonathan Cavitt <jonathan.cavitt@intel.com>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Cc: Lukasz Laguna <lukasz.laguna@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
---
tests/intel/xe_pmu.c | 43 ++++++++++++++++++++++---------------------
1 file changed, 22 insertions(+), 21 deletions(-)
diff --git a/tests/intel/xe_pmu.c b/tests/intel/xe_pmu.c
index 6e91b752a..f8f66ce56 100644
--- a/tests/intel/xe_pmu.c
+++ b/tests/intel/xe_pmu.c
@@ -102,6 +102,7 @@
#include "xe/xe_gt.h"
#include "xe/xe_ioctl.h"
#include "xe/xe_spin.h"
+#include "xe/xe_sriov_admin.h"
#include "xe/xe_sriov_provisioning.h"
#define SLEEP_DURATION 2 /* in seconds */
@@ -693,7 +694,7 @@ static void engine_activity_all_fn(int fd, struct drm_xe_engine_class_instance *
}
static void engine_activity_fn(int fd, struct drm_xe_engine_class_instance *eci,
- int function, bool sched_if_idle)
+ int function, enum xe_sriov_sched_priority prio)
{
uint64_t config, engine_active_ticks, engine_total_ticks, before[2], after[2];
double busy_percent, exec_quantum_ratio;
@@ -701,6 +702,9 @@ static void engine_activity_fn(int fd, struct drm_xe_engine_class_instance *eci,
int pmu_fd[2], fn_fd;
uint32_t vm;
+ if (prio != xe_sriov_profile_get_sched_priority(fd, 0, NULL))
+ xe_sriov_bulk_set_sched_priority(fd, prio);
+
if (function > 0) {
fn_fd = igt_sriov_open_vf_drm_device(fd, function);
igt_assert_fd(fn_fd);
@@ -748,7 +752,7 @@ static void engine_activity_fn(int fd, struct drm_xe_engine_class_instance *eci,
if (function > 0)
close(fn_fd);
- if (sched_if_idle)
+ if (prio == XE_SRIOV_SCHED_PRIORITY_NORMAL)
assert_within_epsilon(engine_active_ticks, engine_total_ticks, tolerance);
else
assert_within_epsilon(busy_percent, exec_quantum_ratio, tolerance);
@@ -973,10 +977,12 @@ static void test_gt_frequency(int fd, struct drm_xe_engine_class_instance *eci)
static unsigned int enable_and_provision_vfs(int fd)
{
- unsigned int gt, num_vfs;
- int pf_exec_quantum = 64, vf_exec_quantum = 32, vf;
+ unsigned int num_vfs, vf;
+ uint32_t pf_exec_quantum_ms = 64, vf_exec_quantum_ms = 32;
+ uint32_t pf_preempt_timeout_us = 64000, vf_preempt_timeout_us = 32000;
igt_require(igt_sriov_is_pf(fd));
+ igt_require(xe_sriov_admin_is_present(fd));
igt_require(igt_sriov_get_enabled_vfs(fd) == 0);
xe_sriov_require_default_scheduling_attributes(fd);
autoprobe = igt_sriov_is_driver_autoprobe_enabled(fd);
@@ -988,37 +994,33 @@ static unsigned int enable_and_provision_vfs(int fd)
igt_require(num_vfs == 2);
/* Set 32ms for VF execution quantum and 64ms for PF execution quantum */
- xe_for_each_gt(fd, gt) {
- xe_sriov_set_sched_if_idle(fd, gt, 0);
- for (int fn = 0; fn <= num_vfs; fn++)
- xe_sriov_set_exec_quantum_ms(fd, fn, gt, fn ? vf_exec_quantum :
- pf_exec_quantum);
- }
+ xe_sriov_bulk_set_exec_quantum_ms(fd, vf_exec_quantum_ms);
+ xe_sriov_bulk_set_preempt_timeout_us(fd, vf_preempt_timeout_us);
+ xe_sriov_bulk_set_sched_priority(fd, XE_SRIOV_SCHED_PRIORITY_LOW);
+ xe_sriov_profile_set_exec_quantum_ms(fd, 0, pf_exec_quantum_ms);
+ xe_sriov_profile_set_preempt_timeout_us(fd, 0,
+ pf_preempt_timeout_us);
/* probe VFs */
igt_sriov_enable_driver_autoprobe(fd);
for (vf = 1; vf <= num_vfs; vf++)
igt_sriov_bind_vf_drm_driver(fd, vf);
- total_exec_quantum = pf_exec_quantum + (num_vfs * vf_exec_quantum);
+ total_exec_quantum = pf_exec_quantum_ms + (num_vfs * vf_exec_quantum_ms);
return num_vfs;
}
static void unprovision_and_disable_vfs(int fd)
{
- unsigned int gt, num_vfs = igt_sriov_get_enabled_vfs(fd);
-
- xe_for_each_gt(fd, gt) {
- xe_sriov_set_sched_if_idle(fd, gt, 0);
- for (int fn = 0; fn <= num_vfs; fn++)
- xe_sriov_set_exec_quantum_ms(fd, fn, gt, 0);
- }
+ int ret;
+ ret = __xe_sriov_bulk_restore_defaults(fd);
xe_sriov_disable_vfs_restore_auto_provisioning(fd);
/* abort to avoid execution of next tests with enabled VFs */
igt_abort_on_f(igt_sriov_get_enabled_vfs(fd) > 0,
"Failed to disable VF(s)");
+ igt_abort_on_f(ret, "Failed to restore scheduling params\n");
autoprobe ? igt_sriov_enable_driver_autoprobe(fd) :
igt_sriov_disable_driver_autoprobe(fd);
@@ -1188,13 +1190,12 @@ igt_main
igt_describe("Validate per-function engine activity");
test_each_engine("fn-engine-activity-load", fd, eci)
for (int fn = 0; fn < num_fns; fn++)
- engine_activity_fn(fd, eci, fn, false);
+ engine_activity_fn(fd, eci, fn, XE_SRIOV_SCHED_PRIORITY_LOW);
igt_describe("Validate per-function engine activity when sched-if-idle is set");
test_each_engine("fn-engine-activity-sched-if-idle", fd, eci) {
- xe_sriov_set_sched_if_idle(fd, eci->gt_id, 1);
for (int fn = 0; fn < num_fns; fn++)
- engine_activity_fn(fd, eci, fn, true);
+ engine_activity_fn(fd, eci, fn, XE_SRIOV_SCHED_PRIORITY_NORMAL);
}
igt_fixture
--
2.43.0
next prev parent reply other threads:[~2025-11-25 10:24 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-25 10:22 [PATCH i-g-t v2 00/10] Xe SR-IOV admin scheduling helpers and test updates Marcin Bernatowicz
2025-11-25 10:23 ` [PATCH i-g-t v2 01/10] lib/igt_sysfs_choice: Add helpers for sysfs enumerated choice attributes Marcin Bernatowicz
2026-01-15 7:24 ` Laguna, Lukasz
2025-11-25 10:23 ` [PATCH i-g-t v2 02/10] lib/tests/igt_sysfs_choice: Add test coverage Marcin Bernatowicz
2026-01-15 10:31 ` Laguna, Lukasz
2025-11-25 10:23 ` [PATCH i-g-t v2 03/10] lib/xe/xe_sriov_provisioning: Add string conversion helpers for scheduling priority Marcin Bernatowicz
2026-01-15 7:48 ` Laguna, Lukasz
2025-11-25 10:23 ` [PATCH i-g-t v2 04/10] lib/xe/xe_sriov_provisioning: Add sched priority mask to string helper Marcin Bernatowicz
2026-01-15 8:04 ` Laguna, Lukasz
2025-11-25 10:23 ` [PATCH i-g-t v2 05/10] lib/igt_sriov_device: Add helper for PF/VF sysfs path formatting Marcin Bernatowicz
2026-01-15 8:10 ` Laguna, Lukasz
2025-11-25 10:23 ` [PATCH i-g-t v2 06/10] lib/xe/xe_sriov_admin: Add SR-IOV admin sysfs accessors Marcin Bernatowicz
2026-01-15 8:24 ` Laguna, Lukasz
2025-11-25 10:23 ` [PATCH i-g-t v2 07/10] tests/intel/xe_sriov_scheduling: Avoid assert on scheduling params restore in cleanup Marcin Bernatowicz
2026-01-15 8:25 ` Laguna, Lukasz
2025-11-25 10:23 ` [PATCH i-g-t v2 08/10] tests/intel/xe_sriov_scheduling: Prefer SR-IOV admin sysfs accessors Marcin Bernatowicz
2026-01-15 8:25 ` Laguna, Lukasz
2025-11-25 10:23 ` Marcin Bernatowicz [this message]
2026-01-15 8:27 ` [PATCH i-g-t v2 09/10] tests/intel/xe_pmu: " Laguna, Lukasz
2025-11-25 10:23 ` [PATCH i-g-t v2 10/10] tests/intel/xe_sriov_admin_profile: Add SR-IOV admin sysfs scheduling attributes tests Marcin Bernatowicz
2026-01-15 10:05 ` Laguna, Lukasz
2026-01-15 10:10 ` Laguna, Lukasz
2025-11-25 17:27 ` ✓ i915.CI.BAT: success for Xe SR-IOV admin scheduling helpers and test updates (rev2) Patchwork
2025-11-25 17:50 ` ✓ Xe.CI.BAT: " Patchwork
2025-11-25 20:25 ` ✗ Xe.CI.Full: failure " Patchwork
2025-11-26 6:39 ` ✗ i915.CI.Full: " 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=20251125102312.43142-10-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=jonathan.cavitt@intel.com \
--cc=kamil.konieczny@linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.