public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Bernatowicz, Marcin" <marcin.bernatowicz@linux.intel.com>
To: Adam Miszczak <adam.miszczak@linux.intel.com>,
	igt-dev@lists.freedesktop.org
Cc: kamil.konieczny@linux.intel.com
Subject: Re: [PATCH i-g-t 02/10] tools/vmtb: Fix DUT selection based on card index
Date: Tue, 10 Mar 2026 11:26:58 +0100	[thread overview]
Message-ID: <e48af959-cdba-4159-81f1-10cb9fd8c7e8@linux.intel.com> (raw)
In-Reply-To: <20260224075027.2409675-3-adam.miszczak@linux.intel.com>


On 2/24/2026 8:50 AM, Adam Miszczak wrote:
> A GPU devices list need to be searched by requested card index
> (device minor number) - not list index.
> Implement Host.get_device() function to return Device
> with a given minor number from the detected devices list,
> bound to a requested DRM driver (e.g. xe).
> DUT reference is now kept by the VmmTestingSetup,
> not embedded within Host class.
>
> Signed-off-by: Adam Miszczak <adam.miszczak@linux.intel.com>
> ---
>   tools/vmtb/bench/machines/host.py            | 12 +++++++-----
>   tools/vmtb/bench/machines/physical/device.py |  5 ++++-
>   tools/vmtb/vmm_flows/conftest.py             | 15 ++++++++-------
>   tools/vmtb/vmm_flows/test_basic.py           |  4 ++--
>   4 files changed, 21 insertions(+), 15 deletions(-)
>
> diff --git a/tools/vmtb/bench/machines/host.py b/tools/vmtb/bench/machines/host.py
> index 666f35c26..aecc7709a 100644
> --- a/tools/vmtb/bench/machines/host.py
> +++ b/tools/vmtb/bench/machines/host.py
> @@ -1,8 +1,7 @@
>   # SPDX-License-Identifier: MIT
> -# Copyright © 2024 Intel Corporation
> +# Copyright © 2024-2026 Intel Corporation
>   
>   import logging
> -import re
>   import shlex
>   import signal
>   import subprocess
> @@ -24,13 +23,12 @@ class Host(MachineInterface):
>       def __init__(self) -> None:
>           self.running_procs: typing.Dict[int, subprocess.Popen] = {}
>           self.gpu_devices: typing.List[Device] = []
> -        self.dut_index: int = 0
>           # Initialize in conftest/VmmTestingSetup:
>           self.drm_driver_name: str
>           self.igt_config: VmtbIgtConfig
>   
>       def __str__(self) -> str:
> -        return f'Host-{self.gpu_devices[self.dut_index].pci_info.bdf}'
> +        return 'Host'
>   
>       @LogDecorators.parse_kmsg
>       def execute(self, command: str) -> int:
> @@ -181,9 +179,13 @@ class Host(MachineInterface):
>   
>           logger.debug("Detected GPU PCI device(s):")
>           for dev in self.gpu_devices:
> -            logger.debug("[%s] PCI BDF: %s / DevID: %s (%s)",
> +            logger.debug("[card%s] PCI BDF: %s / DevID: %s (%s)",
>                             dev.pci_info.minor_number, dev.pci_info.bdf, dev.pci_info.devid, dev.gpu_model)
>   
> +    def get_device(self, dev_minor: int) -> typing.Optional[Device]:
> +        """Find device with a given minor number within detected GPU devices list."""
> +        return next((dev for dev in self.gpu_devices if dev.pci_info.minor_number == dev_minor), None)
> +
>       def suspend(self, mode: SuspendMode = SuspendMode.ACPI_S3) -> None:
>           """Perform host suspend cycle (ACPI S3) via rtcwake tool."""
>           wakeup_delay = 10 # wakeup timer in seconds
> diff --git a/tools/vmtb/bench/machines/physical/device.py b/tools/vmtb/bench/machines/physical/device.py
> index 12a5d5f7d..887f607e4 100644
> --- a/tools/vmtb/bench/machines/physical/device.py
> +++ b/tools/vmtb/bench/machines/physical/device.py
> @@ -1,5 +1,5 @@
>   # SPDX-License-Identifier: MIT
> -# Copyright © 2024 Intel Corporation
> +# Copyright © 2024-2026 Intel Corporation
>   
>   import importlib
>   import logging
> @@ -48,6 +48,9 @@ class Device(DeviceInterface):
>           self.gpu_model: str = pci.get_gpu_model(self.pci_info.devid)
>           self.driver: DriverInterface = self.instantiate_driver(driver, self.pci_info.minor_number)
>   
> +    def __str__(self) -> str:
> +        return f'Dev-{self.pci_info.bdf}'
> +
>       def instantiate_driver(self, driver_name: str, card_index: int) -> Any:
>           module_name = f'bench.drivers.{driver_name}'
>           class_name = f'{driver_name.capitalize()}Driver'
> diff --git a/tools/vmtb/vmm_flows/conftest.py b/tools/vmtb/vmm_flows/conftest.py
> index 675312253..3bfac01c4 100644
> --- a/tools/vmtb/vmm_flows/conftest.py
> +++ b/tools/vmtb/vmm_flows/conftest.py
> @@ -81,12 +81,12 @@ class VmmTestingSetup:
>   
>           self.vgpu_profiles_dir = vmtb_config.vmtb_config_file.parent / vmtb_config.config.vgpu_profiles_path
>   
> -        self.host.dut_index = self.dut_index
>           self.host.drm_driver_name = vmtb_config.get_host_config().driver
>           self.host.igt_config = vmtb_config.get_host_config().igt_config
>   
>           self.host.load_drivers()
>           self.host.discover_devices()
> +        self.dut: Device = self.host.get_device(self.dut_index)
>   
>           # VF migration requires vendor specific VFIO driver (e.g. xe-vfio-pci)
>           vf_migration_support: bool = self.host.is_driver_loaded(f'{self.host.drm_driver_name}-vfio-pci')
> @@ -97,7 +97,7 @@ class VmmTestingSetup:
>                       "\n\tDevice ID: %s (%s)"
>                       "\n\tHost DRM driver: %s"
>                       "\n\tVF migration support: %s",
> -                    self.host.dut_index,
> +                    self.dut_index,
>                       self.get_dut().pci_info.bdf,
>                       self.get_dut().pci_info.devid, self.get_dut().gpu_model,
>                       self.get_dut().driver.get_name(),
> @@ -127,11 +127,12 @@ class VmmTestingSetup:
>           return vgpu_profile
>   
>       def get_dut(self) -> Device:
> -        try:
> -            return self.host.gpu_devices[self.dut_index]
> -        except IndexError as exc:
> -            logger.error("Invalid VMTB config - device card index = %s not available", self.dut_index)
> -            raise exceptions.VmtbConfigError(f'Device card index = {self.dut_index} not available') from exc
> +        if self.dut is None:
> +            logger.error("Invalid VMTB config - DRM card%s is not bound to %s driver",
> +                         self.dut_index, self.host.drm_driver_name)
> +            raise exceptions.VmtbConfigError(f'Invalid VMTB config - DRM card{self.dut_index} device not supported')
> +
> +        return self.dut
>   
>       @property
>       def get_vm(self):
> diff --git a/tools/vmtb/vmm_flows/test_basic.py b/tools/vmtb/vmm_flows/test_basic.py
> index 100be7652..1d3a68b36 100644
> --- a/tools/vmtb/vmm_flows/test_basic.py
> +++ b/tools/vmtb/vmm_flows/test_basic.py
> @@ -1,5 +1,5 @@
>   # SPDX-License-Identifier: MIT
> -# Copyright © 2024 Intel Corporation
> +# Copyright © 2024-2026 Intel Corporation
>   
>   import logging
>   import time
> @@ -82,7 +82,7 @@ class TestVmWorkload:
>               logger.info("[%s] Verify result of basic WL", igt.target)
>               assert igt_check(igt)
>   
> -        logger.info("[%s] Verify result of basic WL", ts.host)
> +        logger.info("[Host %s] Verify result of basic WL", ts.get_dut())
LGTM,
Reviewed-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
>           igt_run_check(ts.host, IgtType.EXEC_STORE)
>   
>       def test_wsim(self, setup_vms):

  reply	other threads:[~2026-03-10 10:27 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-24  7:50 [PATCH i-g-t 00/10] vmtb: Modernize SR-IOV VM Test Bench core Adam Miszczak
2026-02-24  7:50 ` [PATCH i-g-t 01/10] tools/vmtb: Update QEMU parameters Adam Miszczak
2026-03-10 10:22   ` Bernatowicz, Marcin
2026-02-24  7:50 ` [PATCH i-g-t 02/10] tools/vmtb: Fix DUT selection based on card index Adam Miszczak
2026-03-10 10:26   ` Bernatowicz, Marcin [this message]
2026-02-24  7:50 ` [PATCH i-g-t 03/10] tools/vmtb: Fix VM snapshot query handling Adam Miszczak
2026-03-10 10:29   ` Bernatowicz, Marcin
2026-02-24  7:50 ` [PATCH i-g-t 04/10] tools/vmtb: Extend IGT and WSIM abstractions Adam Miszczak
2026-03-10 10:36   ` Bernatowicz, Marcin
2026-02-24  7:50 ` [PATCH i-g-t 05/10] tools/vmtb: VF auto/fair provisioning support Adam Miszczak
2026-03-10 10:38   ` Bernatowicz, Marcin
2026-02-24  7:50 ` [PATCH i-g-t 06/10] tools/vmtb: Refactor driver interfaces Adam Miszczak
2026-03-10 10:43   ` Bernatowicz, Marcin
2026-02-24  7:50 ` [PATCH i-g-t 07/10] tools/vmtb: Introduce VirtualDevice class Adam Miszczak
2026-03-10 10:45   ` Bernatowicz, Marcin
2026-02-24  7:50 ` [PATCH i-g-t 08/10] tools/vmtb: Redesign VirtualMachine class Adam Miszczak
2026-03-10 10:47   ` Bernatowicz, Marcin
2026-02-24  7:50 ` [PATCH i-g-t 09/10] tools/vmtb: Support max VFs configuration Adam Miszczak
2026-03-10 10:52   ` Bernatowicz, Marcin
2026-02-24  7:50 ` [PATCH i-g-t 10/10] tools/vmtb: Platform enabling: PTL and BMG support Adam Miszczak
2026-03-10 10:52   ` Bernatowicz, Marcin
2026-02-24 11:49 ` ✓ Xe.CI.BAT: success for vmtb: Modernize SR-IOV VM Test Bench core Patchwork
2026-02-24 12:43 ` ✓ i915.CI.BAT: " Patchwork
2026-02-24 16:27 ` ✗ i915.CI.Full: failure " Patchwork
2026-02-24 20:21 ` ✗ 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=e48af959-cdba-4159-81f1-10cb9fd8c7e8@linux.intel.com \
    --to=marcin.bernatowicz@linux.intel.com \
    --cc=adam.miszczak@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@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