From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Francois Dugast <francois.dugast@intel.com>
Cc: <igt-dev@lists.freedesktop.org>
Subject: Re: [PATCH i-g-t, v3 4/5] tests/intel/xe_fault_injection: Inject errors during vm create IOCTL
Date: Tue, 12 Nov 2024 15:50:32 -0500 [thread overview]
Message-ID: <ZzO_mMiYJ-BN52z2@intel.com> (raw)
In-Reply-To: <20241112133034.1919573-5-francois.dugast@intel.com>
On Tue, Nov 12, 2024 at 02:29:53PM +0100, Francois Dugast wrote:
> Use the fault injection infrastructure to make targeted internal KMD
> functions fail when executing xe_vm_create_ioctl() so that more code
> paths are tested, such as error handling and unwinding.
>
> v2: Order function names alphabetically (Rodrigo Vivi)
>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Francois Dugast <francois.dugast@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
> tests/intel/xe_fault_injection.c | 55 ++++++++++++++++++++++++++++++--
> 1 file changed, 53 insertions(+), 2 deletions(-)
>
> diff --git a/tests/intel/xe_fault_injection.c b/tests/intel/xe_fault_injection.c
> index f99cc48c6..d321446b5 100644
> --- a/tests/intel/xe_fault_injection.c
> +++ b/tests/intel/xe_fault_injection.c
> @@ -17,6 +17,8 @@
> #include "igt_device.h"
> #include "igt_kmod.h"
> #include "igt_sysfs.h"
> +#include "xe/xe_ioctl.h"
> +#include "xe/xe_query.h"
>
> #define INJECT_ERRNO -ENOMEM
>
> @@ -154,13 +156,47 @@ inject_fault_probe(int fd, char pci_slot[], const char function_name[])
> injection_list_do(INJECTION_LIST_REMOVE, function_name);
> }
>
> +static int
> +simple_vm_create(int fd, unsigned int flags)
> +{
> + struct drm_xe_vm_create create = {
> + .flags = flags,
> + };
> +
> + return igt_ioctl(fd, DRM_IOCTL_XE_VM_CREATE, &create);
> +}
> +
> +/**
> + * SUBTEST: vm-create-fail-%s
> + * Description: inject an error in function %arg[1] used in vm create IOCTL to make it fail
> + * Functionality: fault
> + *
> + * arg[1]:
> + * @xe_exec_queue_create_bind: xe_exec_queue_create_bind
> + * @xe_pt_create: xe_pt_create
> + * @xe_vm_create_scratch: xe_vm_create_scratch
> + */
> +static void
> +vm_create_fail(int fd, const char function_name[], unsigned int flags)
> +{
> + igt_assert_eq(simple_vm_create(fd, flags), 0);
> +
> + injection_list_do(INJECTION_LIST_ADD, function_name);
> + set_retval(function_name, INJECT_ERRNO);
> + igt_assert(simple_vm_create(fd, flags) != 0);
> + injection_list_do(INJECTION_LIST_REMOVE, function_name);
> +
> + igt_assert_eq(simple_vm_create(fd, flags), 0);
> +}
> +
> igt_main
> {
> int fd;
> char pci_slot[NAME_MAX];
> const struct section {
> const char *name;
> - } probe_function_sections[] = {
> + unsigned int flags;
> + } probe_fail_functions[] = {
> { "wait_for_lmem_ready" },
> { "xe_device_create" },
> { "xe_ggtt_init_early" },
> @@ -176,16 +212,29 @@ igt_main
> { "xe_wopcm_init" },
> { }
> };
> + const struct section vm_create_fail_functions[] = {
> + { "xe_exec_queue_create_bind", 0 },
> + { "xe_pt_create", 0 },
> + { "xe_vm_create_scratch", DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE },
> + { }
> + };
>
> igt_fixture {
> igt_require(fail_function_injection_enabled());
> fd = drm_open_driver(DRIVER_XE);
> igt_device_get_pci_slot_name(fd, pci_slot);
> setup_injection_fault();
> + }
> +
> + for (const struct section *s = vm_create_fail_functions; s->name; s++)
> + igt_subtest_f("vm-create-fail-%s", s->name)
> + vm_create_fail(fd, s->name, s->flags);
> +
> + igt_fixture {
> xe_sysfs_driver_do(fd, pci_slot, XE_SYSFS_DRIVER_UNBIND);
> }
>
> - for (const struct section *s = probe_function_sections; s->name; s++)
> + for (const struct section *s = probe_fail_functions; s->name; s++)
> igt_subtest_f("inject-fault-probe-function-%s", s->name)
> inject_fault_probe(fd, pci_slot, s->name);
>
> @@ -193,4 +242,6 @@ igt_main
> drm_close_driver(fd);
> xe_sysfs_driver_do(fd, pci_slot, XE_SYSFS_DRIVER_BIND);
> }
> +
> +
> }
> --
> 2.43.0
>
next prev parent reply other threads:[~2024-11-12 20:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-12 13:29 [PATCH i-g-t,v3 0/5] xe_fault_injection improvements Francois Dugast
2024-11-12 13:29 ` [PATCH i-g-t, v3 1/5] tests/intel/xe_fault_injection: Use a static list of functions Francois Dugast
2024-11-12 13:29 ` [PATCH i-g-t,v3 2/5] lib/igt_sysfs: Add igt_sysfs_{get,set}_s32 Francois Dugast
2024-11-12 13:29 ` [PATCH i-g-t, v3 3/5] tests/intel/xe_fault_injection: Use igt_sysfs helpers Francois Dugast
2024-11-12 20:49 ` Rodrigo Vivi
2024-11-12 13:29 ` [PATCH i-g-t, v3 4/5] tests/intel/xe_fault_injection: Inject errors during vm create IOCTL Francois Dugast
2024-11-12 20:50 ` Rodrigo Vivi [this message]
2024-11-12 13:29 ` [PATCH i-g-t, v3 5/5] tests/intel/xe_fault_injection: Inject errors during vm bind IOCTL Francois Dugast
2024-11-12 14:08 ` ✓ CI.xeBAT: success for xe_fault_injection improvements (rev3) Patchwork
2024-11-12 14:09 ` ✓ Fi.CI.BAT: " Patchwork
2024-11-12 16:11 ` ✗ CI.xeFULL: failure " Patchwork
2024-11-12 17:23 ` ✗ Fi.CI.IGT: " 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=ZzO_mMiYJ-BN52z2@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=francois.dugast@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/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