[PATCH i-g-t 0/6] Order SR-IOV scheduling provisioning safely

Marcin Bernatowicz <[email protected]>
Newsgroups org.freedesktop.lists.igt-dev
Message-ID <[email protected]>
Provisioning execution quantum, preemption timeout and scheduling priority is
not order independent. Zero execution quantum and zero preemption timeout both
mean infinity, and a function left at a priority above LOW with infinite
timeslicing may never be switched away from by GuC. That is a risky state which
can be left via PAUSE/FLR, so the safe sequences are:

  setup:   exec_quantum, preempt_timeout, sched_priority
  cleanup: sched_priority (LOW), exec_quantum (0), preempt_timeout (0)

The restore helpers in lib did the opposite on cleanup, clearing timeslicing
first and dropping priority last. That transits through the risky state
whenever a test raised priority, and is reachable from xe_pmu, which restores
defaults while VFs are still enabled, and from the SR-IOV exit handler on abort
or signal.

Scheduling parameters should also only be reset once VFs are disabled, since
resetting them while VFs are still active can leave cleanup incomplete and make
subsequent VF probing fail.

Patch 1 was posted standalone before and is included here because the rest of
the series builds on it. Patch 2 renames the restore helpers to say scheduling
defaults, since they never touched resource provisioning. Patch 3 is the
ordering fix itself and stands on its own. Patch 4 adds a bulk setter enforcing
the setup order and rejecting infinite timeslicing, so the invalid combination
is unrepresentable rather than merely avoided by convention. Patches 5 and 6
move the tests over, and align xe_pmu cleanup with xe_sriov_scheduling.

Assisted-by: Copilot:Claude-Opus-5
Cc: Adam Miszczak <[email protected]>
Cc: Jakub Kolakowski <[email protected]>
Cc: Lukasz Laguna <[email protected]>
Cc: Michal Wajdeczko <[email protected]>

Marcin Bernatowicz (6):
  tests/intel/xe_sriov_scheduling: Disable VFs before resetting sched
    params
  lib/xe/xe_sriov_admin: Rename restore defaults helpers
  lib/xe/xe_sriov_admin: Lower priority before clearing timeslicing
  lib/xe/xe_sriov_admin: Add bulk scheduling params setter
  tests/intel/xe_sriov_scheduling: Use safe scheduling params helpers
  tests/intel/xe_pmu: Disable VFs before restoring sched params

 lib/xe/xe_sriov_admin.c           | 111 +++++++++++++++++++++++-------
 lib/xe/xe_sriov_admin.h           |  32 +++++++--
 tests/intel/xe_pmu.c              |   4 +-
 tests/intel/xe_sriov_admin.c      |   4 +-
 tests/intel/xe_sriov_scheduling.c |  88 +++++++----------------
 5 files changed, 140 insertions(+), 99 deletions(-)

-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.