All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Laguna, Lukasz" <lukasz.laguna@intel.com>
To: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>,
	<igt-dev@lists.freedesktop.org>
Cc: <adam.miszczak@linux.intel.com>, <jakub1.kolakowski@intel.com>
Subject: Re: [PATCH i-g-t 8/8] tests/intel/xe_sriov_scheduling: Add default fair scheduling test
Date: Tue, 9 Jun 2026 16:58:58 +0200	[thread overview]
Message-ID: <d0096ea2-83b1-4cb3-99cc-e236b39faca0@intel.com> (raw)
In-Reply-To: <20260527205644.2801165-9-marcin.bernatowicz@linux.intel.com>


On 5/27/2026 22:56, Marcin Bernatowicz wrote:
> Verify PF and enabled VFs keep a fair share with the driver-applied
> default scheduling settings, without overriding scheduling parameters.
>
> 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>

Reviewed-by: Lukasz Laguna <lukasz.laguna@intel.com>

> ---
>   tests/intel/xe_sriov_scheduling.c | 145 ++++++++++++++++++++++++++++++
>   1 file changed, 145 insertions(+)
>
> diff --git a/tests/intel/xe_sriov_scheduling.c b/tests/intel/xe_sriov_scheduling.c
> index 915442380..aa3e5fccc 100644
> --- a/tests/intel/xe_sriov_scheduling.c
> +++ b/tests/intel/xe_sriov_scheduling.c
> @@ -1271,6 +1271,112 @@ static void nonpreempt_engine_resets(int pf_fd, int num_vfs,
>   	subm_set_fini(set);
>   }
>   
> +static struct job_sched_params
> +prepare_default_enabled_job_sched_params(int pf_fd,
> +					 const uint8_t *vf_ids,
> +					 size_t num_functions,
> +					 int job_timeout_ms)
> +{
> +	struct job_sched_params params = { };
> +	uint32_t min_exec_quantum_ms = UINT32_MAX;
> +
> +	params.sched_params = (struct vf_sched_params) {
> +		.exec_quantum_ms = xe_sriov_admin_get_exec_quantum_ms(pf_fd, vf_ids[0]),
> +		.preempt_timeout_us = xe_sriov_admin_get_preempt_timeout_us(pf_fd, vf_ids[0]),
> +		.priority = xe_sriov_admin_get_sched_priority(pf_fd, vf_ids[0], NULL),
> +	};
> +
> +	for (size_t n = 0; n < num_functions; ++n) {
> +		uint32_t exec_quantum_ms =
> +			xe_sriov_admin_get_exec_quantum_ms(pf_fd, vf_ids[n]);
> +
> +		min_exec_quantum_ms = min(min_exec_quantum_ms,
> +					  exec_quantum_ms);
> +	}
> +
> +	params.duration_ms = calculate_job_duration_ms(min_exec_quantum_ms);
> +	params.num_repeats = adjust_num_repeats(params.duration_ms, num_functions);
> +
> +	igt_require_f(params.duration_ms +
> +		      (num_functions - 1) * params.sched_params.exec_quantum_ms <=
> +		      job_timeout_ms,
> +		      "Default scheduling eq=%ums across %zu functions exceeds job timeout=%dms\n",
> +		      params.sched_params.exec_quantum_ms, num_functions, job_timeout_ms);
> +
> +	return params;
> +}
> +
> +static void validate_default_enabled_sched_params(int pf_fd,
> +						  const uint8_t *vf_ids,
> +						  size_t num_functions)
> +{
> +	for (size_t n = 0; n < num_functions; ++n) {
> +		uint32_t exec_quantum_ms =
> +			xe_sriov_admin_get_exec_quantum_ms(pf_fd, vf_ids[n]);
> +		uint32_t preempt_timeout_us =
> +			xe_sriov_admin_get_preempt_timeout_us(pf_fd, vf_ids[n]);
> +		enum xe_sriov_sched_priority priority =
> +			xe_sriov_admin_get_sched_priority(pf_fd, vf_ids[n], NULL);
> +
> +		igt_require_f(exec_quantum_ms > 0,
> +			      "%s exec_quantum_ms stayed at 0 after enabling VFs\n",
> +			      igt_sriov_func_str(vf_ids[n]));
> +		igt_require_f(preempt_timeout_us > 0,
> +			      "%s preempt_timeout_us stayed at 0 after enabling VFs\n",
> +			      igt_sriov_func_str(vf_ids[n]));
> +		igt_warn_on_f(priority != XE_SRIOV_SCHED_PRIORITY_LOW,
> +			      "%s expected LOW sched_priority after enabling VFs, got %s\n",
> +			      igt_sriov_func_str(vf_ids[n]),
> +			      xe_sriov_sched_priority_to_string(priority));
> +	}
> +}
> +
> +static void ensure_enabled_vfs(int pf_fd, int num_vfs)
> +{
> +	unsigned int enabled_vfs = igt_sriov_get_enabled_vfs(pf_fd);
> +
> +	if (enabled_vfs && enabled_vfs != (unsigned int)num_vfs) {
> +		xe_sriov_disable_vfs_restore_auto_provisioning(pf_fd);
> +		enabled_vfs = 0;
> +	}
> +
> +	if (!enabled_vfs) {
> +		xe_sriov_require_default_scheduling_attributes(pf_fd);
> +		igt_sriov_enable_driver_autoprobe(pf_fd);
> +		igt_sriov_enable_vfs(pf_fd, num_vfs);
> +	}
> +}
> +
> +/**
> + * SUBTEST: default-enabled-fair-scheduling
> + * Description:
> + *   Check PF and enabled VFs keep fair scheduling using the driver-applied
> + *   default scheduling settings established when VFs are enabled.
> + */
> +static void default_enabled_fair_scheduling(int pf_fd, int num_vfs,
> +					    const struct subm_opts *opts,
> +					    bool verify_with_perf_counters,
> +					    const struct drm_xe_engine_class_instance *eci)
> +{
> +	uint8_t vf_ids[num_vfs + 1 /*PF*/];
> +	uint32_t job_timeout_ms = sysfs_get_job_timeout_ms(pf_fd, eci);
> +	struct job_sched_params job_sched_params;
> +
> +	ensure_enabled_vfs(pf_fd, num_vfs);
> +
> +	init_vf_ids(vf_ids, ARRAY_SIZE(vf_ids),
> +		    &(struct init_vf_ids_opts){ .shuffle = true,
> +						.shuffle_pf = true });
> +	validate_default_enabled_sched_params(pf_fd, vf_ids, ARRAY_SIZE(vf_ids));
> +	job_sched_params = prepare_default_enabled_job_sched_params(pf_fd, vf_ids,
> +								    ARRAY_SIZE(vf_ids),
> +								    job_timeout_ms);
> +
> +	verify_applied_scheduling_behavior(pf_fd, vf_ids, ARRAY_SIZE(vf_ids), opts,
> +					   verify_with_perf_counters, eci,
> +					   &job_sched_params);
> +}
> +
>   static bool skip_visited_gt(bool extended_scope, uint64_t *visited_gts,
>   			    unsigned short gt_id)
>   {
> @@ -1370,6 +1476,45 @@ int igt_main_args("", long_opts, help_str, subm_opts_handler, NULL)
>   				  has_perf_event(perf_device, "engine-total-ticks");
>   	}
>   
> +	igt_describe("Check PF and VFs keep fair scheduling using driver defaults applied on VF enable");
> +	igt_subtest_with_dynamic("default-enabled-fair-scheduling") {
> +		if (extended_scope)
> +			for_each_sriov_num_vfs(pf_fd, vf)
> +				xe_for_each_engine(pf_fd, eci) {
> +					ecls = eci->engine_class;
> +					igt_dynamic_f("numvfs-%d-gt%u-%s%u", vf,
> +						      eci->gt_id,
> +						      xe_engine_class_short_string(ecls),
> +						      eci->engine_instance)
> +						default_enabled_fair_scheduling(pf_fd, vf,
> +										&subm_opts,
> +										has_perf_events,
> +										eci);
> +				}
> +
> +		for_random_sriov_vf(pf_fd, vf) {
> +			uint64_t visited_gts = 0;
> +
> +			xe_for_each_engine(pf_fd, eci) {
> +				if (skip_visited_gt(extended_scope, &visited_gts,
> +						    eci->gt_id))
> +					continue;
> +
> +				igt_dynamic_f("numvfs-random-gt%u-%s%u",
> +					      eci->gt_id,
> +					      xe_engine_class_short_string(eci->engine_class),
> +					      eci->engine_instance)
> +					default_enabled_fair_scheduling(pf_fd, vf, &subm_opts,
> +									has_perf_events,
> +									eci);
> +			}
> +		}
> +	}
> +
> +	igt_fixture() {
> +		xe_sriov_disable_vfs_restore_auto_provisioning(pf_fd);
> +	}
> +
>   	for (enum xe_sriov_sched_priority priority = XE_SRIOV_SCHED_PRIORITY_LOW;
>   	     priority <= XE_SRIOV_SCHED_PRIORITY_NORMAL;
>   	     priority++) {

  reply	other threads:[~2026-06-09 14:59 UTC|newest]

Thread overview: 21+ 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-06-09 14:48   ` Laguna, Lukasz
2026-05-27 20:56 ` [PATCH i-g-t 2/8] tests/intel/xe_sriov_scheduling: Add scheduling priority support Marcin Bernatowicz
2026-06-09 14:51   ` Laguna, Lukasz
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-06-09 14:52   ` Laguna, Lukasz
2026-05-27 20:56 ` [PATCH i-g-t 4/8] tests/intel/xe_sriov_scheduling: Add PMU-based verification helpers Marcin Bernatowicz
2026-06-09 14:53   ` Laguna, Lukasz
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-06-09 14:54   ` Laguna, Lukasz
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-06-09 14:58   ` Laguna, Lukasz
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-06-09 14:58   ` Laguna, Lukasz
2026-05-27 20:56 ` [PATCH i-g-t 8/8] tests/intel/xe_sriov_scheduling: Add default fair scheduling test Marcin Bernatowicz
2026-06-09 14:58   ` Laguna, Lukasz [this message]
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=d0096ea2-83b1-4cb3-99cc-e236b39faca0@intel.com \
    --to=lukasz.laguna@intel.com \
    --cc=adam.miszczak@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jakub1.kolakowski@intel.com \
    --cc=marcin.bernatowicz@linux.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.