From: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>,
Adam Miszczak <adam.miszczak@linux.intel.com>,
Jakub Kolakowski <jakub1.kolakowski@intel.com>,
Lukasz Laguna <lukasz.laguna@intel.com>,
Michal Wajdeczko <michal.wajdeczko@intel.com>
Subject: [PATCH i-g-t 3/6] lib/xe/xe_sriov_admin: Lower priority before clearing timeslicing
Date: Tue, 18 Aug 2026 14:39:27 +0200 [thread overview]
Message-ID: <19f3ef4174e856a83b6915dc19e09da4bab90a5a.1787056235.git.marcin.bernatowicz@linux.intel.com> (raw)
In-Reply-To: <cover.1787056235.git.marcin.bernatowicz@linux.intel.com>
Zero execution quantum and zero preemption timeout both mean infinity.
A function left at a scheduling priority above LOW with infinite
timeslicing may never be switched away from by GuC, which is a risky
state that can be left via PAUSE/FLR.
The restore helpers cleared execution quantum and preemption timeout
first and only then dropped priority to LOW, transiting through exactly
that state whenever a test had raised priority. This is reachable from
xe_pmu, which restores defaults while VFs are still enabled, and from
xe_sriov_admin_exit_cleanup_restore_sched_defaults() on abort or signal.
Lower priority first, then clear execution quantum and preemption timeout.
Assisted-by: Copilot:Claude-Opus-5
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>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
---
lib/xe/xe_sriov_admin.c | 32 ++++++++++++++++++++------------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/lib/xe/xe_sriov_admin.c b/lib/xe/xe_sriov_admin.c
index b03e77b08..0433ddcfc 100644
--- a/lib/xe/xe_sriov_admin.c
+++ b/lib/xe/xe_sriov_admin.c
@@ -547,6 +547,11 @@ void xe_sriov_admin_vf_stop(int pf_fd, unsigned int vf_num)
*
* Resets execution quantum, preemption timeout, and priority to driver defaults.
*
+ * Zero execution quantum and zero preemption timeout both mean infinity, so
+ * priority is lowered first. A function left at a priority above LOW with
+ * infinite timeslicing may never be switched away from by GuC, and can only be
+ * recovered by PAUSE/FLR.
+ *
* Returns: 0 on success or negative errno on error.
*/
int __xe_sriov_admin_restore_sched_defaults(int pf_fd, unsigned int vf_num)
@@ -554,6 +559,12 @@ int __xe_sriov_admin_restore_sched_defaults(int pf_fd, unsigned int vf_num)
int ret_eq, ret_pt, ret_prio;
int ret = 0;
+ ret_prio = __xe_sriov_admin_set_sched_priority(pf_fd, vf_num,
+ XE_SRIOV_SCHED_PRIORITY_LOW);
+ igt_warn_on(ret_prio);
+ if (!ret)
+ ret = ret_prio;
+
ret_eq = __xe_sriov_admin_set_exec_quantum_ms(pf_fd, vf_num, 0);
igt_warn_on(ret_eq);
if (!ret)
@@ -564,12 +575,6 @@ int __xe_sriov_admin_restore_sched_defaults(int pf_fd, unsigned int vf_num)
if (!ret)
ret = ret_pt;
- ret_prio = __xe_sriov_admin_set_sched_priority(pf_fd, vf_num,
- XE_SRIOV_SCHED_PRIORITY_LOW);
- igt_warn_on(ret_prio);
- if (!ret)
- ret = ret_prio;
-
return ret;
}
@@ -589,6 +594,9 @@ void xe_sriov_admin_restore_sched_defaults(int pf_fd, unsigned int vf_num)
*
* Resets PF and all VFs to driver default scheduling parameters.
*
+ * Priority is lowered before clearing timeslicing, see
+ * __xe_sriov_admin_restore_sched_defaults().
+ *
* Returns: 0 on success or negative errno on error.
*/
int __xe_sriov_admin_bulk_restore_sched_defaults(int pf_fd)
@@ -596,6 +604,12 @@ int __xe_sriov_admin_bulk_restore_sched_defaults(int pf_fd)
int ret_eq, ret_pt, ret_prio;
int ret = 0;
+ ret_prio = __xe_sriov_admin_bulk_set_sched_priority(pf_fd,
+ XE_SRIOV_SCHED_PRIORITY_LOW);
+ igt_warn_on(ret_prio);
+ if (!ret)
+ ret = ret_prio;
+
ret_eq = __xe_sriov_admin_bulk_set_exec_quantum_ms(pf_fd, 0);
igt_warn_on(ret_eq);
if (!ret)
@@ -606,12 +620,6 @@ int __xe_sriov_admin_bulk_restore_sched_defaults(int pf_fd)
if (!ret)
ret = ret_pt;
- ret_prio = __xe_sriov_admin_bulk_set_sched_priority(pf_fd,
- XE_SRIOV_SCHED_PRIORITY_LOW);
- igt_warn_on(ret_prio);
- if (!ret)
- ret = ret_prio;
-
return ret;
}
--
2.43.0
next prev parent reply other threads:[~2026-08-18 12:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 12:39 [PATCH i-g-t 0/6] Order SR-IOV scheduling provisioning safely Marcin Bernatowicz
2026-08-18 12:39 ` [PATCH i-g-t 1/6] tests/intel/xe_sriov_scheduling: Disable VFs before resetting sched params Marcin Bernatowicz
2026-08-18 14:14 ` Laguna, Lukasz
2026-08-18 12:39 ` [PATCH i-g-t 2/6] lib/xe/xe_sriov_admin: Rename restore defaults helpers Marcin Bernatowicz
2026-08-18 14:14 ` Laguna, Lukasz
2026-08-18 12:39 ` Marcin Bernatowicz [this message]
2026-08-18 14:15 ` [PATCH i-g-t 3/6] lib/xe/xe_sriov_admin: Lower priority before clearing timeslicing Laguna, Lukasz
2026-08-18 12:39 ` [PATCH i-g-t 4/6] lib/xe/xe_sriov_admin: Add bulk scheduling params setter Marcin Bernatowicz
2026-08-18 14:15 ` Laguna, Lukasz
2026-08-18 12:39 ` [PATCH i-g-t 5/6] tests/intel/xe_sriov_scheduling: Use safe scheduling params helpers Marcin Bernatowicz
2026-08-18 14:15 ` Laguna, Lukasz
2026-08-18 12:39 ` [PATCH i-g-t 6/6] tests/intel/xe_pmu: Disable VFs before restoring sched params Marcin Bernatowicz
2026-08-18 14:16 ` Laguna, Lukasz
2026-08-18 14:11 ` ✓ Xe.CI.BAT: success for Order SR-IOV scheduling provisioning safely Patchwork
2026-08-18 14:20 ` ✓ i915.CI.BAT: " Patchwork
2026-08-18 16:39 ` ✓ Xe.CI.FULL: " Patchwork
2026-08-19 1:50 ` ✓ 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=19f3ef4174e856a83b6915dc19e09da4bab90a5a.1787056235.git.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