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 2/2] tests/intel/xe_sriov_flr: Restore xe_vfio_pci module state
Date: Thu, 30 Apr 2026 14:40:24 +0200 [thread overview]
Message-ID: <312e0a8a-309d-4409-99c2-1ce31792344a@intel.com> (raw)
In-Reply-To: <20260418102621.467394-3-marcin.bernatowicz@linux.intel.com>
On 4/18/2026 12:26, Marcin Bernatowicz wrote:
> Record the initial xe_vfio_pci module state in the test fixture and
> restore it during cleanup.
> This ensures xe_sriov_flr leaves xe_vfio_pci loaded or unloaded exactly
> as it was before test execution.
>
> 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_flr.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/tests/intel/xe_sriov_flr.c b/tests/intel/xe_sriov_flr.c
> index 370cb8e1b..d4a7a7498 100644
> --- a/tests/intel/xe_sriov_flr.c
> +++ b/tests/intel/xe_sriov_flr.c
> @@ -81,6 +81,7 @@ enum vf_driver_mode {
> static int g_wait_flr_ms = 200;
> static enum vf_driver_mode g_vf_driver = VF_DRIVER_XE_VFIO_PCI;
> static bool g_extended_scope;
> +static bool g_xe_vfio_loaded_initially;
>
> static struct g_mmio {
> struct xe_mmio *mmio;
> @@ -460,6 +461,29 @@ static void cleanup_vf_driver(int pf_fd, int num_vfs,
> free(binding->vf_bound);
> }
>
> +static void restore_xe_vfio_module(void)
> +{
> + bool loaded = igt_kmod_is_loaded(XE_VFIO_PCI_MODULE);
> + int ret;
> +
> + if (loaded == g_xe_vfio_loaded_initially)
> + return;
> +
> + ret = g_xe_vfio_loaded_initially ?
> + igt_kmod_load(XE_VFIO_PCI_MODULE, NULL) :
> + igt_kmod_unload(XE_VFIO_PCI_MODULE);
> + igt_abort_on_f(ret,
> + "Failed to %s %s during cleanup\n",
> + g_xe_vfio_loaded_initially ? "load" : "unload",
> + XE_VFIO_PCI_MODULE);
> +
> + loaded = igt_kmod_is_loaded(XE_VFIO_PCI_MODULE);
> + igt_abort_on_f(loaded != g_xe_vfio_loaded_initially,
> + "%s should be %s after cleanup\n",
> + XE_VFIO_PCI_MODULE,
> + g_xe_vfio_loaded_initially ? "loaded" : "unloaded");
> +}
> +
> /**
> * flr_exec_strategy - Function pointer for FLR execution strategy
> * @pf_fd: File descriptor for the Physical Function (PF).
> @@ -1339,6 +1363,7 @@ int igt_main_args("ed:w:", long_options, help_str, opt_handler, NULL)
> igt_require(igt_sriov_is_pf(pf_fd));
> igt_require(igt_sriov_get_enabled_vfs(pf_fd) == 0);
> autoprobe = igt_sriov_is_driver_autoprobe_enabled(pf_fd);
> + g_xe_vfio_loaded_initially = igt_kmod_is_loaded(XE_VFIO_PCI_MODULE);
> }
>
> igt_describe("Initiate FLR without any additional state checks.");
> @@ -1390,6 +1415,7 @@ int igt_main_args("ed:w:", long_options, help_str, opt_handler, NULL)
> igt_sriov_disable_driver_autoprobe(pf_fd);
> igt_abort_on_f(autoprobe != igt_sriov_is_driver_autoprobe_enabled(pf_fd),
> "Failed to restore sriov_drivers_autoprobe value\n");
> + restore_xe_vfio_module();
> close(pf_fd);
> }
> }
next prev parent reply other threads:[~2026-04-30 12:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-18 10:26 [PATCH i-g-t 0/2] tests/intel/xe_sriov_flr: VF driver mode option and xe_vfio_pci state restore Marcin Bernatowicz
2026-04-18 10:26 ` [PATCH i-g-t 1/2] tests/intel/xe_sriov_flr: Add vf-driver option Marcin Bernatowicz
2026-04-30 12:39 ` Laguna, Lukasz
2026-04-18 10:26 ` [PATCH i-g-t 2/2] tests/intel/xe_sriov_flr: Restore xe_vfio_pci module state Marcin Bernatowicz
2026-04-30 12:40 ` Laguna, Lukasz [this message]
2026-04-21 13:54 ` ✓ i915.CI.BAT: success for tests/intel/xe_sriov_flr: VF driver mode option and xe_vfio_pci state restore Patchwork
2026-04-21 14:03 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-21 15:40 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-04-21 17: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=312e0a8a-309d-4409-99c2-1ce31792344a@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox