From: "Manszewski, Christoph" <christoph.manszewski@intel.com>
To: "Piatkowski, Dominik Karol" <dominik.karol.piatkowski@intel.com>,
"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Cc: "Grzegorzek, Dominik" <dominik.grzegorzek@intel.com>,
Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>,
Mika Kuoppala <mika.kuoppala@linux.intel.com>,
"Laguna, Lukasz" <lukasz.laguna@intel.com>,
"Wajdeczko, Michal" <Michal.Wajdeczko@intel.com>,
Kamil Konieczny <kamil.konieczny@linux.intel.com>
Subject: Re: [PATCH i-g-t v2 2/2] tests/intel/xe_eudebug: Add subtests for eudebug/SR-IOV exclusion
Date: Wed, 26 Feb 2025 11:05:45 +0100 [thread overview]
Message-ID: <fbd54432-39f5-4e7a-bd4c-e554fc7988d5@intel.com> (raw)
In-Reply-To: <DS0PR11MB7264229868E4E77EC4343FB1D9C02@DS0PR11MB7264.namprd11.prod.outlook.com>
Hi Dominik,
On 24.02.2025 14:31, Piatkowski, Dominik Karol wrote:
> Hi Christoph,
>
>> -----Original Message-----
>> From: Manszewski, Christoph <christoph.manszewski@intel.com>
>> Sent: Thursday, February 20, 2025 3:59 PM
>> To: igt-dev@lists.freedesktop.org
>> Cc: Piatkowski, Dominik Karol <dominik.karol.piatkowski@intel.com>;
>> Grzegorzek, Dominik <dominik.grzegorzek@intel.com>; Marcin Bernatowicz
>> <marcin.bernatowicz@linux.intel.com>; Mika Kuoppala
>> <mika.kuoppala@linux.intel.com>; Laguna, Lukasz
>> <lukasz.laguna@intel.com>; Wajdeczko, Michal
>> <Michal.Wajdeczko@intel.com>; Kamil Konieczny
>> <kamil.konieczny@linux.intel.com>; Manszewski, Christoph
>> <christoph.manszewski@intel.com>
>> Subject: [PATCH i-g-t v2 2/2] tests/intel/xe_eudebug: Add subtests for
>> eudebug/SR-IOV exclusion
>>
>> Eudebug is not supported in PF mode with VFs enabled and in VF mode.
>> Provide subtests to ensure that:
>> 1. enabling eudebug is not permitted in PF mode with VFs enabled
>> 2. eudebug sysfs toggle is not available in VF mode
>> 3. enabling VFs is not permitted when eudebug is enabled
>>
>> Signed-off-by: Christoph Manszewski <christoph.manszewski@intel.com>
>> ---
>> tests/intel/xe_eudebug.c | 2 +
>> tests/intel/xe_eudebug_sriov.c | 153
>> +++++++++++++++++++++++++++++++++
>> tests/meson.build | 1 +
>> 3 files changed, 156 insertions(+)
>> create mode 100644 tests/intel/xe_eudebug_sriov.c
>>
>> diff --git a/tests/intel/xe_eudebug.c b/tests/intel/xe_eudebug.c
>> index 76870805c..3eedd543d 100644
>> --- a/tests/intel/xe_eudebug.c
>> +++ b/tests/intel/xe_eudebug.c
>> @@ -20,7 +20,9 @@
>> #include <sys/prctl.h>
>>
>> #include "igt.h"
>> +#include "igt_sysfs.h"
>> #include "intel_pat.h"
>> +#include "lib/igt_sriov_device.h"
>> #include "lib/igt_syncobj.h"
>> #include "xe/xe_eudebug.h"
>> #include "xe/xe_ioctl.h"
>
> These includes are probably a leftover artifact from v1. Please remove them.
Sure, will do.
Thanks,
Christoph
>
> Thanks,
> Dominik Karol
>
>> diff --git a/tests/intel/xe_eudebug_sriov.c b/tests/intel/xe_eudebug_sriov.c
>> new file mode 100644
>> index 000000000..e82dff98a
>> --- /dev/null
>> +++ b/tests/intel/xe_eudebug_sriov.c
>> @@ -0,0 +1,153 @@
>> +// SPDX-License-Identifier: MIT
>> +/*
>> + * Copyright © 2025 Intel Corporation
>> + */
>> +
>> +/**
>> + * TEST: Test EU Debugger and SR-IOV interaction
>> + * Category: Core
>> + * Mega feature: EUdebug/SR-IOV
>> + * Sub-category: EUdebug tests
>> + * Functionality: EU Debugger framework
>> + * Test category: functionality test
>> + */
>> +
>> +#include "igt.h"
>> +#include "igt_sysfs.h"
>> +#include "lib/igt_sriov_device.h"
>> +#include "xe/xe_eudebug.h"
>> +
>> +static bool has_enable_eudebug_attr(int fd, unsigned int vf_num)
>> +{
>> + char path[PATH_MAX];
>> + int sysfs;
>> + bool ret;
>> +
>> + igt_assert(vf_num > 0);
>> +
>> + sysfs = igt_sysfs_open(fd);
>> + igt_assert_fd(sysfs);
>> + /* vf_num is 1-based, but virtfn is 0-based */
>> + snprintf(path, sizeof(path), "device/virtfn%u/enable_eudebug",
>> vf_num - 1);
>> + ret = igt_sysfs_has_attr(sysfs, path);
>> + close(sysfs);
>> +
>> + return ret;
>> +}
>> +
>> +/**
>> + * SUBTEST: deny-eudebug
>> + * Description:
>> + * Check that eudebug toggle is not available for VFs, and that enabling
>> + * eudebug with VFs enabled is not permitted.
>> + */
>> +static void test_deny_eudebug(int fd)
>> +{
>> + unsigned int num_vfs = igt_sriov_get_total_vfs(fd);
>> + bool eudebug_enable = true;
>> + bool err = false;
>> + int ret = 0;
>> +
>> + igt_debug("Testing %u VFs\n", num_vfs);
>> +
>> + xe_eudebug_enable(fd, false);
>> + igt_sriov_enable_driver_autoprobe(fd);
>> + igt_sriov_enable_vfs(fd, num_vfs);
>> + igt_assert_eq(num_vfs, igt_sriov_get_enabled_vfs(fd));
>> +
>> + for (int vf_num = 1; vf_num <= num_vfs; ++vf_num) {
>> + if (!igt_sriov_is_vf_drm_driver_probed(fd, vf_num)) {
>> + igt_debug("VF%u probe failed\n", vf_num);
>> + err = true;
>> + } else if (has_enable_eudebug_attr(fd, vf_num)) {
>> + igt_debug("VF%u has enable_eudebug attribute\n",
>> vf_num);
>> + err = true;
>> + }
>> + }
>> +
>> + igt_assert(!err);
>> +
>> + ret = __xe_eudebug_enable_getset(fd, NULL, &eudebug_enable);
>> + igt_assert_eq(ret, -1);
>> + igt_assert_eq(errno, EPERM);
>> +}
>> +
>> +/**
>> + * SUBTEST: deny-sriov
>> + * Description:
>> + * Check that VFs cannot be enabled when eudebug is enabled.
>> + */
>> +static void test_deny_sriov(int fd)
>> +{
>> + unsigned int num_vfs = igt_sriov_get_total_vfs(fd);
>> + bool ret = false;
>> + int sysfs = 0;
>> +
>> + igt_debug("Testing %u VFs\n", num_vfs);
>> +
>> + igt_sriov_disable_vfs(fd);
>> + igt_assert_eq(0, igt_sriov_get_enabled_vfs(fd));
>> + xe_eudebug_enable(fd, true);
>> +
>> + sysfs = igt_sysfs_open(fd);
>> + igt_assert_fd(sysfs);
>> +
>> + ret = __igt_sysfs_set_u32(sysfs, "device/sriov_numvfs", num_vfs);
>> + close(sysfs);
>> +
>> + igt_assert_eq(ret, false);
>> + igt_assert_eq(errno, EPERM);
>> +}
>> +
>> +static void restore_initial_driver_state(int fd, bool eudebug_enabled, bool
>> vf_autoprobe)
>> +{
>> + bool abort = false;
>> +
>> + igt_sriov_disable_vfs(fd);
>> + if (igt_sriov_get_enabled_vfs(fd) > 0) {
>> + igt_debug("Failed to disable VF(s)\n");
>> + abort = true;
>> + }
>> +
>> + vf_autoprobe ? igt_sriov_enable_driver_autoprobe(fd) :
>> + igt_sriov_disable_driver_autoprobe(fd);
>> + if (vf_autoprobe != igt_sriov_is_driver_autoprobe_enabled(fd)) {
>> + igt_debug("Failed to restore sriov_drivers_autoprobe
>> value\n");
>> + abort = true;
>> + }
>> +
>> + if (__xe_eudebug_enable_getset(fd, NULL, &eudebug_enabled) < 0) {
>> + igt_debug("Failed to restore eudebug state\n");
>> + abort = true;
>> + }
>> +
>> + /* abort to avoid execution of next tests with invalid driver state */
>> + igt_abort_on_f(abort, "Failed to restore initial driver state\n");
>> +}
>> +
>> +igt_main
>> +{
>> + bool eudebug_enabled;
>> + bool vf_autoprobe;
>> + int fd;
>> +
>> + igt_fixture {
>> + fd = drm_open_driver(DRIVER_XE);
>> + igt_require(igt_sriov_is_pf(fd));
>> + igt_require(igt_sriov_vfs_supported(fd));
>> + igt_require(igt_sriov_get_enabled_vfs(fd) == 0);
>> + igt_require(__xe_eudebug_enable_getset(fd,
>> &eudebug_enabled, NULL) == 0);
>> + vf_autoprobe = igt_sriov_is_driver_autoprobe_enabled(fd);
>> + }
>> +
>> + igt_subtest("deny-eudebug")
>> + test_deny_eudebug(fd);
>> +
>> + igt_subtest("deny-sriov")
>> + test_deny_sriov(fd);
>> +
>> + igt_fixture {
>> + restore_initial_driver_state(fd, eudebug_enabled,
>> vf_autoprobe);
>> + close(fd);
>> + }
>> +}
>> diff --git a/tests/meson.build b/tests/meson.build
>> index a0f984b34..30d067c24 100644
>> --- a/tests/meson.build
>> +++ b/tests/meson.build
>> @@ -332,6 +332,7 @@ intel_xe_eudebug_progs = [
>> 'xe_eudebug',
>> 'xe_exec_sip_eudebug',
>> 'xe_eudebug_online',
>> + 'xe_eudebug_sriov',
>> ]
>>
>> if build_xe_eudebug
>> --
>> 2.34.1
>
next prev parent reply other threads:[~2025-02-26 10:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-20 14:59 [PATCH i-g-t v2 0/2] Ensure that SR-IOV and eudebug are exclusive for Xe Christoph Manszewski
2025-02-20 14:59 ` [PATCH i-g-t v2 1/2] lib/xe_eudebug: Export __xe_eudebug_enable_getset Christoph Manszewski
2025-02-24 13:20 ` Piatkowski, Dominik Karol
2025-02-20 14:59 ` [PATCH i-g-t v2 2/2] tests/intel/xe_eudebug: Add subtests for eudebug/SR-IOV exclusion Christoph Manszewski
2025-02-24 13:31 ` Piatkowski, Dominik Karol
2025-02-26 10:05 ` Manszewski, Christoph [this message]
2025-02-27 16:39 ` Grzegorzek, Dominik
2025-02-28 15:23 ` Manszewski, Christoph
2025-02-20 19:12 ` ✓ Xe.CI.BAT: success for Ensure that SR-IOV and eudebug are exclusive for Xe (rev2) Patchwork
2025-02-20 19:23 ` ✗ i915.CI.BAT: failure " Patchwork
2025-02-21 13: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=fbd54432-39f5-4e7a-bd4c-e554fc7988d5@intel.com \
--to=christoph.manszewski@intel.com \
--cc=Michal.Wajdeczko@intel.com \
--cc=dominik.grzegorzek@intel.com \
--cc=dominik.karol.piatkowski@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@linux.intel.com \
--cc=lukasz.laguna@intel.com \
--cc=marcin.bernatowicz@linux.intel.com \
--cc=mika.kuoppala@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.