From: "Bernatowicz, Marcin" <marcin.bernatowicz@linux.intel.com>
To: Lukasz Laguna <lukasz.laguna@intel.com>, igt-dev@lists.freedesktop.org
Cc: satyanarayana.k.v.p@intel.com, michal.wajdeczko@intel.com,
adam.miszczak@linux.intel.com, jakub1.kolakowski@intel.com
Subject: Re: [PATCH i-g-t v2 4/4] tests/xe_sriov_auto_provisioning: Add subtest to verify VF's configuration
Date: Mon, 10 Feb 2025 11:52:53 +0100 [thread overview]
Message-ID: <705dd045-3444-45ce-b9ba-c78191b63aff@linux.intel.com> (raw)
In-Reply-To: <20250207094031.15942-5-lukasz.laguna@intel.com>
On 2/7/2025 10:40 AM, Lukasz Laguna wrote:
> Added subtest checks if configuration data that VF got from GuC during
> probe is the same as provisioned.
>
> v2:
> - add missing flag in subtest function call (Marcin)
> - fix VFs range in subtest definition (Lukasz)
>
> Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
> ---
> tests/intel/xe_sriov_auto_provisioning.c | 123 ++++++++++++++++++++++-
> 1 file changed, 121 insertions(+), 2 deletions(-)
>
> diff --git a/tests/intel/xe_sriov_auto_provisioning.c b/tests/intel/xe_sriov_auto_provisioning.c
> index e13eb3644..c95e8fc08 100644
> --- a/tests/intel/xe_sriov_auto_provisioning.c
> +++ b/tests/intel/xe_sriov_auto_provisioning.c
> @@ -33,6 +33,18 @@
> * SUBTEST: exclusive-ranges
> * Description:
> * Verify that ranges of auto-provisioned resources are exclusive
> + *
> + * SUBTEST: selfconfig-basic
> + * Description:
> + * Check if VF configuration data is the same as provisioned
> + *
> + * SUBTEST: selfconfig-reprovision-increase-numvfs
> + * Description:
> + * Check if VF configuration data is updated properly after increasing number of VFs
> + *
> + * SUBTEST: selfconfig-reprovision-reduce-numvfs
> + * Description:
> + * Check if VF configuration data is updated properly after decreasing number of VFs
> */
>
> IGT_TEST_DESCRIPTION("Xe tests for SR-IOV auto-provisioning");
> @@ -216,6 +228,70 @@ static void exclusive_ranges(int pf_fd, unsigned int num_vfs)
> igt_fail_on_f(fails, "exclusive ranges check failed\n");
> }
>
> +#define REPROVISION_INCREASE_NUMVFS (0x1 << 0)
> +#define REPROVISION_REDUCE_NUMVFS (0x1 << 1)
> +
> +static void check_selfconfig(int pf_fd, unsigned int vf_num, unsigned int flags)
> +{
> + unsigned int gt_num, total_vfs = igt_sriov_get_total_vfs(pf_fd);
> + uint64_t provisioned, queried;
> + enum xe_sriov_shared_res res;
> + int vf_fd, fails = 0;
> +
> + igt_sriov_disable_driver_autoprobe(pf_fd);
> + igt_sriov_enable_vfs(pf_fd, (flags & REPROVISION_REDUCE_NUMVFS) ? total_vfs : vf_num);
> + igt_sriov_enable_driver_autoprobe(pf_fd);
> +
> + igt_sriov_bind_vf_drm_driver(pf_fd, vf_num);
> + vf_fd = igt_sriov_open_vf_drm_device(pf_fd, vf_num);
> + igt_assert_fd(vf_fd);
> +
> + xe_for_each_gt(pf_fd, gt_num) {
> + xe_sriov_for_each_provisionable_shared_res(res, pf_fd, gt_num) {
> + provisioned = xe_sriov_pf_get_provisioned_quota(pf_fd, res, vf_num,
> + gt_num);
> + queried = xe_sriov_vf_debugfs_get_selfconfig(vf_fd, res, gt_num);
> +
> + if (igt_debug_on_f(provisioned != queried,
> + "%s selfconfig check failed on gt%u\n",
> + xe_sriov_shared_res_to_string(res), gt_num))
CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
> + fails++;
> + }
> + }
> +
> + close(vf_fd);
> + igt_sriov_disable_vfs(pf_fd);
> +
> + if (flags && !fails) {
> + igt_sriov_disable_driver_autoprobe(pf_fd);
> + igt_sriov_enable_vfs(pf_fd, (flags & REPROVISION_INCREASE_NUMVFS) ? total_vfs :
> + vf_num);
> + igt_sriov_enable_driver_autoprobe(pf_fd);
> +
> + igt_sriov_bind_vf_drm_driver(pf_fd, vf_num);
> + vf_fd = igt_sriov_open_vf_drm_device(pf_fd, vf_num);
> + igt_assert_fd(vf_fd);
> +
> + xe_for_each_gt(pf_fd, gt_num) {
> + xe_sriov_for_each_provisionable_shared_res(res, pf_fd, gt_num) {
> + provisioned = xe_sriov_pf_get_provisioned_quota(pf_fd, res, vf_num,
> + gt_num);
> + queried = xe_sriov_vf_debugfs_get_selfconfig(vf_fd, res, gt_num);
> +
> + if (igt_debug_on_f(provisioned != queried,
> + "%s selfconfig check after reprovisioning failed on gt%u\n",
> + xe_sriov_shared_res_to_string(res), gt_num))
> + fails++;
> + }
> + }
> +
> + close(vf_fd);
> + igt_sriov_disable_vfs(pf_fd);
> + }
> +
> + igt_fail_on_f(fails, "selfconfig check failed\n");
> +}
> +
> static bool extended_scope;
>
> static int opts_handler(int opt, int opt_index, void *data)
> @@ -242,9 +318,17 @@ static const char help_str[] =
> igt_main_args("", long_opts, help_str, opts_handler, NULL)
> {
> enum xe_sriov_shared_res res;
> - unsigned int gt;
> + unsigned int gt, total_vfs;
> bool autoprobe;
> int pf_fd;
> + static struct subtest_variants {
> + const char *name;
> + unsigned int flags;
> + } reprovisioning_variant[] = {
> + { "increase", REPROVISION_INCREASE_NUMVFS },
> + { "reduce", REPROVISION_REDUCE_NUMVFS },
> + { NULL },
> + };
>
> igt_fixture {
> struct xe_sriov_provisioned_range *ranges;
> @@ -264,6 +348,7 @@ igt_main_args("", long_opts, help_str, opts_handler, NULL)
> }
> }
> autoprobe = igt_sriov_is_driver_autoprobe_enabled(pf_fd);
> + total_vfs = igt_sriov_get_total_vfs(pf_fd);
> }
>
> igt_describe("Verify that auto-provisioned resources are allocated by PF driver in fairly manner");
> @@ -298,7 +383,6 @@ igt_main_args("", long_opts, help_str, opts_handler, NULL)
>
> igt_describe("Verify that ranges of auto-provisioned resources are exclusive");
> igt_subtest_with_dynamic_f("exclusive-ranges") {
> - unsigned int total_vfs = igt_sriov_get_total_vfs(pf_fd);
>
> igt_skip_on(total_vfs < 2);
>
> @@ -315,6 +399,41 @@ igt_main_args("", long_opts, help_str, opts_handler, NULL)
> }
> }
>
> + igt_describe("Check if VF configuration data is the same as provisioned");
> + igt_subtest_with_dynamic("selfconfig-basic") {
> + if (extended_scope)
> + for_each_sriov_vf(pf_fd, vf)
> + igt_dynamic_f("vf-%u", vf)
> + check_selfconfig(pf_fd, vf, 0);
> +
> + for_random_sriov_vf(pf_fd, vf) {
> + igt_dynamic_f("vf-random") {
> + igt_debug("vf=%u\n", vf);
> + check_selfconfig(pf_fd, vf, 0);
> + }
> + }
> + }
> +
> + for (const struct subtest_variants *s = reprovisioning_variant; s->name; s++) {
> + igt_describe("Check if VF configuration data is the same as reprovisioned");
> + igt_subtest_with_dynamic_f("selfconfig-reprovision-%s-numvfs", s->name) {
> +
> + igt_require(total_vfs > 1);
> +
> + if (extended_scope)
> + for_each_sriov_vf_in_range(pf_fd, 1, total_vfs - 1, vf)
> + igt_dynamic_f("vf-%u", vf)
> + check_selfconfig(pf_fd, vf, s->flags);
> +
> + for_random_sriov_vf_in_range(pf_fd, 1, total_vfs - 1, vf) {
> + igt_dynamic_f("vf-random") {
> + igt_debug("vf=%u\n", vf);
> + check_selfconfig(pf_fd, vf, s->flags);
> + }
> + }
> + }
> + }
> +
LGTM, with one indentation correction,
Reviewed-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
> igt_fixture {
> igt_sriov_disable_vfs(pf_fd);
> /* abort to avoid execution of next tests with enabled VFs */
next prev parent reply other threads:[~2025-02-10 10:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-07 9:40 [PATCH i-g-t v2 0/4] Verify VF configuration data against provisioned values Lukasz Laguna
2025-02-07 9:40 ` [PATCH i-g-t v2 1/4] lib/xe/xe_sriov_debugfs: Add helper to read VF's configuration data Lukasz Laguna
2025-02-10 10:43 ` Bernatowicz, Marcin
2025-02-10 10:57 ` Bernatowicz, Marcin
2025-02-07 9:40 ` [PATCH i-g-t v2 2/4] lib/xe/xe_sriov_provisioning: Add helper to get VF's provisioned quota Lukasz Laguna
2025-02-07 9:40 ` [PATCH i-g-t v2 3/4] lib/igt_sriov_device: Add helper to iterate over VFs in specified range Lukasz Laguna
2025-02-11 11:23 ` Bernatowicz, Marcin
2025-02-07 9:40 ` [PATCH i-g-t v2 4/4] tests/xe_sriov_auto_provisioning: Add subtest to verify VF's configuration Lukasz Laguna
2025-02-10 10:52 ` Bernatowicz, Marcin [this message]
2025-02-08 0:26 ` ✓ i915.CI.BAT: success for Verify VF configuration data against provisioned values (rev2) Patchwork
2025-02-08 1:22 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-02-08 16:45 ` ✗ i915.CI.Full: " Patchwork
2025-02-08 19:19 ` ✗ Xe.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=705dd045-3444-45ce-b9ba-c78191b63aff@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 \
--cc=satyanarayana.k.v.p@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