From: "Vivi, Rodrigo" <rodrigo.vivi@intel.com>
To: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
"kamil.konieczny@linux.intel.com"
<kamil.konieczny@linux.intel.com>
Cc: "Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>,
"De Marchi, Lucas" <lucas.demarchi@intel.com>
Subject: Re: [PATCH i-g-t] tests/intel/xe_busted: Introduce a new test for Xe device busted state
Date: Wed, 3 Apr 2024 18:28:28 +0000 [thread overview]
Message-ID: <80f4e8e964eeb4ebd96709370ecfadb1065cffc7.camel@intel.com> (raw)
In-Reply-To: <20240403182304.kwm52y3nzgvvqg3u@kamilkon-desk.igk.intel.com>
On Wed, 2024-04-03 at 20:23 +0200, Kamil Konieczny wrote:
> Hi Rodrigo,
> On 2024-03-14 at 21:08:41 -0400, Rodrigo Vivi wrote:
> > Let's inject a gt_reset failure that will put Xe device in the
> > new busted state, then we confirm the IOCTL is blocked and we
> ----- ^^^^^^
> Why is not 'wedged'? What is a difference?
doh!
Please read it wedged. I forgot to s/busted/wedged in the commit
messages. I will send a fixed version later.
>
> Regards,
> Kamil
>
> > reload the driver to get back to a clean state for other test
> > execution, since busted state in Xe is a final state that can only
> > be cleared with a device rebind/reprobe.
> >
> > The fault injection of this test is entirely based on xe_uevent
> > provided by Himal.
> >
> > v2: Use rebind instead of module reload (Lucas)
> > And other improvements also pointed out by Lucas.
> >
> > Cc: Lucas De Marchi <lucas.demarchi@intel.com>
> > Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > ---
> > tests/intel/xe_busted.c | 107
> > ++++++++++++++++++++++++++++++++++++++++
> > tests/meson.build | 1 +
> > 2 files changed, 108 insertions(+)
> > create mode 100644 tests/intel/xe_busted.c
> >
> > diff --git a/tests/intel/xe_busted.c b/tests/intel/xe_busted.c
> > new file mode 100644
> > index 000000000..88278213d
> > --- /dev/null
> > +++ b/tests/intel/xe_busted.c
> > @@ -0,0 +1,107 @@
> > +// SPDX-License-Identifier: MIT
> > +/*
> > + * Copyright © 2024 Intel Corporation
> > + */
> > +
> > +/**
> > + * TEST: cause fake gt reset failure which put Xe device in busted
> > state
> > + * Category: Software building block
> > + * Sub-category: driver
> > + * Functionality: busted
> > + * Test category: functionality test
> > + */
> > +
> > +#include <limits.h>
> > +#include <dirent.h>
> > +
> > +#include "igt.h"
> > +#include "igt_device.h"
> > +#include "igt_kmod.h"
> > +#include "igt_sysfs.h"
> > +
> > +#include "xe/xe_ioctl.h"
> > +
> > +static void force_busted(int fd)
> > +{
> > + igt_debugfs_write(fd, "fail_gt_reset/probability", "100");
> > + igt_debugfs_write(fd, "fail_gt_reset/times", "2");
> > +
> > + xe_force_gt_reset(fd, 0);
> > + sleep(1);
> > +}
> > +
> > +static int rebind_xe(int fd)
> > +{
> > + char pci_slot[NAME_MAX];
> > + int sysfs;
> > +
> > + igt_device_get_pci_slot_name(fd, pci_slot);
> > +
> > + sysfs = open("/sys/bus/pci/drivers/xe", O_DIRECTORY);
> > + igt_assert(sysfs);
> > +
> > + igt_assert(igt_sysfs_set(sysfs, "unbind", pci_slot));
> > +
> > + /*
> > + * We need to close the client for a proper release, before
> > + * binding back again.
> > + */
> > + close(fd);
> > +
> > + igt_assert(igt_sysfs_set(sysfs, "bind", pci_slot));
> > + close(sysfs);
> > +
> > + /* Renew the client connection */
> > + fd = drm_open_driver(DRIVER_XE);
> > + igt_assert(fd);
> > +
> > + return fd;
> > +}
> > +
> > +static int simple_ioctl(int fd)
> > +{
> > + int ret;
> > +
> > + struct drm_xe_vm_create create = {
> > + .extensions = 0,
> > + .flags = 0,
> > + };
> > +
> > + ret = igt_ioctl(fd, DRM_IOCTL_XE_VM_CREATE, &create);
> > +
> > + if (ret == 0)
> > + xe_vm_destroy(fd, create.vm_id);
> > +
> > + return ret;
> > +}
> > +
> > +/**
> > + * SUBTEST: basic-busted
> > + * Description: Force Xe device busted after injecting a failure
> > in GT reset
> > + */
> > +igt_main
> > +{
> > + int fd;
> > +
> > + igt_fixture {
> > + fd = drm_open_driver(DRIVER_XE);
> > + igt_require(igt_debugfs_exists(fd, "fail_gt_reset/probability",
> > + O_RDWR));
> > + }
> > +
> > + igt_subtest("basic-busted") {
> > + igt_assert_eq(simple_ioctl(fd), 0);
> > + force_busted(fd);
> > + igt_assert_neq(simple_ioctl(fd), 0);
> > + fd = rebind_xe(fd);
> > + igt_assert_eq(simple_ioctl(fd), 0);
> > + }
> > +
> > + igt_fixture {
> > + if (igt_debugfs_exists(fd, "fail_gt_reset/probability", O_RDWR))
> > {
> > + igt_debugfs_write(fd, "fail_gt_reset/probability", "0");
> > + igt_debugfs_write(fd, "fail_gt_reset/times", "1");
> > + }
> > + drm_close_driver(fd);
> > + }
> > +}
> > diff --git a/tests/meson.build b/tests/meson.build
> > index a856510fc..87a531051 100644
> > --- a/tests/meson.build
> > +++ b/tests/meson.build
> > @@ -274,6 +274,7 @@ intel_kms_progs = [
> > ]
> >
> > intel_xe_progs = [
> > + 'xe_busted',
> > 'xe_ccs',
> > 'xe_create',
> > 'xe_compute',
> > --
> > 2.44.0
> >
prev parent reply other threads:[~2024-04-03 18:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-15 1:08 [PATCH i-g-t] tests/intel/xe_busted: Introduce a new test for Xe device busted state Rodrigo Vivi
2024-03-15 2:07 ` ✓ CI.xeBAT: success for " Patchwork
2024-03-15 2:14 ` ✓ Fi.CI.BAT: " Patchwork
2024-03-16 1:21 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-04-03 18:23 ` [PATCH i-g-t] " Kamil Konieczny
2024-04-03 18:28 ` Vivi, Rodrigo [this message]
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=80f4e8e964eeb4ebd96709370ecfadb1065cffc7.camel@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=himal.prasad.ghimiray@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@linux.intel.com \
--cc=lucas.demarchi@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