[PATCH v3] tests/intel/xe_fault_injection: Inject errors during exec queue create IOCTL

Gurram, Pravalika pravalika.gurram at intel.com
Thu Feb 27 08:59:31 UTC 2025



> -----Original Message-----
> From: Dandamudi, Priyanka <priyanka.dandamudi at intel.com>
> Sent: Thursday, February 27, 2025 1:50 PM
> To: Gurram, Pravalika <pravalika.gurram at intel.com>; igt-
> dev at lists.freedesktop.org; Dugast, Francois <francois.dugast at intel.com>
> Subject: RE: [PATCH v3] tests/intel/xe_fault_injection: Inject errors during
> exec queue create IOCTL
> 
> 
> 
> > -----Original Message-----
> > From: Gurram, Pravalika <pravalika.gurram at intel.com>
> > Sent: 27 February 2025 11:14 AM
> > To: Dandamudi, Priyanka <priyanka.dandamudi at intel.com>; igt-
> > dev at lists.freedesktop.org; Dugast, Francois
> > <francois.dugast at intel.com>
> > Subject: RE: [PATCH v3] tests/intel/xe_fault_injection: Inject errors
> > during exec queue create IOCTL
> >
> >
> >
> > > -----Original Message-----
> > > From: Dandamudi, Priyanka <priyanka.dandamudi at intel.com>
> > > Sent: Thursday, February 27, 2025 10:59 AM
> > > To: Gurram, Pravalika <pravalika.gurram at intel.com>; igt-
> > > dev at lists.freedesktop.org; Dugast, Francois
> > > <francois.dugast at intel.com>
> > > Cc: Gurram, Pravalika <pravalika.gurram at intel.com>
> > > Subject: RE: [PATCH v3] tests/intel/xe_fault_injection: Inject
> > > errors during exec queue create IOCTL
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: igt-dev <igt-dev-bounces at lists.freedesktop.org> On Behalf Of
> > > > Pravalika Gurram
> > > > Sent: 25 February 2025 01:04 PM
> > > > To: igt-dev at lists.freedesktop.org; Dugast, Francois
> > > > <francois.dugast at intel.com>
> > > > Cc: Gurram, Pravalika <pravalika.gurram at intel.com>
> > > > Subject: [PATCH v3] tests/intel/xe_fault_injection: Inject errors
> > > > during exec queue create IOCTL
> > > >
> > > > Use the fault injection infrastructure to make targeted internal
> > > > KMD functions fail when executing xe_exec_queue_create_ioctl() so
> > > > that more code paths are tested, such as error handling and unwinding.
> > > > include xe_exec_queue_create_bind only for VM_BIND engine class.
> > > > xe_exec_queue_destroy_ioctl() and
> > > > xe_exec_queue_get_property_ioctl() are not considered as there is
> > > > no unwinding code to test with fault injection.
> > > >
> > > > Signed-off-by: Pravalika Gurram <pravalika.gurram at intel.com>
> > > > ---
> > > >  tests/intel/xe_fault_injection.c | 50
> > > > ++++++++++++++++++++++++++++++++
> > > >  1 file changed, 50 insertions(+)
> > > >
> > > > diff --git a/tests/intel/xe_fault_injection.c
> > > > b/tests/intel/xe_fault_injection.c
> > > > index 7ae941367..f25ad9b27 100644
> > > > --- a/tests/intel/xe_fault_injection.c
> > > > +++ b/tests/intel/xe_fault_injection.c
> > > > @@ -185,6 +185,37 @@ inject_fault_probe(int fd, char pci_slot[],
> > > > const char
> > > > function_name[])
> > > >  	injection_list_do(INJECTION_LIST_REMOVE, function_name);  }
> > > >
> > > > +/**
> > > > + * SUBTEST: exec-queue-create-fail-%s
> > > > + * Description: inject an error in function %arg[1] used in exec
> > > > +queue create IOCTL to make it fail
> > > > + * Functionality: fault
> > > > + *
> > > > + * arg[1]:
> > > > + * @xe_exec_queue_create:                 xe_exec_queue_create
> > > > + * @xe_hw_engine_group_add_exec_queue:
> > > > xe_hw_engine_group_add_exec_queue
> > > > + * @xe_vm_add_compute_exec_queue:
> > > > xe_vm_add_compute_exec_queue
> > > > + * @xe_exec_queue_create_bind:
> xe_exec_queue_create_bind
> > > > + */
> > > > +static void
> > > > +exec_queue_create_fail(int fd, struct
> > > > +drm_xe_engine_class_instance
> > > > *instance,
> > > > +		const char function_name[], unsigned int flags) {
> > > > +	uint32_t exec_queue_id;
> > > > +	uint32_t vm = xe_vm_create(fd, flags, 0);
> > > > +	/* sanity check */
> > > > +	igt_assert_eq(__xe_exec_queue_create(fd, vm, 1, 1, instance, 0,
> > > > &exec_queue_id), 0);
> > > > +	xe_exec_queue_destroy(fd, exec_queue_id);
> > > > +
> > > > +	ignore_faults_in_dmesg(function_name);
> > > > +	injection_list_do(INJECTION_LIST_ADD, function_name);
> > > > +	set_retval(function_name, INJECT_ERRNO);
> > > > +	igt_assert(__xe_exec_queue_create(fd, vm, 1, 1, instance, 0,
> > > > &exec_queue_id) != 0);
> > > > +	injection_list_do(INJECTION_LIST_REMOVE, function_name);
> > > > +
> > > > +	igt_assert_eq(__xe_exec_queue_create(fd, vm, 1, 1, instance, 0,
> > > > &exec_queue_id), 0);
> > > > +	xe_exec_queue_destroy(fd, exec_queue_id); }
> > > > +
> > > >  static int
> > > >  simple_vm_create(int fd, unsigned int flags)  { @@ -283,6 +314,7
> > > > @@ vm_bind_fail(int fd, const char function_name[])  igt_main  {
> > > >  	int fd;
> > > > +	struct drm_xe_engine_class_instance *hwe;
> > > >  	char pci_slot[NAME_MAX];
> > > >  	const struct section {
> > > >  		const char *name;
> > > > @@ -318,6 +350,14 @@ igt_main
> > > >  		{ }
> > > >  	};
> > > >
> > > > +	const struct section exec_queue_create_fail_functions[] = {
> > > > +		{ "xe_exec_queue_create", 0 },
> > > > +		{ "xe_hw_engine_group_add_exec_queue", 0 },
> > > > +		{ "xe_vm_add_compute_exec_queue",
> > > > DRM_XE_VM_CREATE_FLAG_LR_MODE },
> > > > +		{ "xe_exec_queue_create_bind", 0 },
> > > > +		{ }
> > > > +	};
> > > > +
> > > >  	igt_fixture {
> > > >  		igt_require(fail_function_injection_enabled());
> > > >  		fd = drm_open_driver(DRIVER_XE); @@ -333,6 +373,16 @@
> igt_main
> > > >  		igt_subtest_f("vm-bind-fail-%s", s->name)
> > > >  			vm_bind_fail(fd, s->name);
> > > >
> > > > +	for (const struct section *s = exec_queue_create_fail_functions;
> > > > +s-
> > > > >name; s++)
> > > > +		igt_subtest_f("exec-queue-create-fail-%s", s->name)
> > > > +			xe_for_each_engine(fd, hwe) {
> > > > +				if (hwe->engine_class ==
> > > > DRM_XE_ENGINE_CLASS_VM_BIND &&
> > > > +						strcmp(s->name,
> > > > "xe_exec_queue_create_bind"))
> > > > +					exec_queue_create_fail(fd, hwe,
> > > > s[3].name, s[3].flags);
> > > > +				else if (strcmp(s->name,
> > > > "xe_exec_queue_create_bind"))
> > > > +					exec_queue_create_fail(fd, hwe, s-
> > > > >name, s->flags);
> > > In either if-else case you are trying to validate only for
> > > xe_exec_queue_create_bind out of all the list, what about the others
> > > {"xe_exec_queue_create", 0 },
> > > +		{ "xe_hw_engine_group_add_exec_queue", 0 },
> > > +		{ "xe_vm_add_compute_exec_queue",
> > > DRM_XE_VM_CREATE_FLAG_LR_MODE },
> > > these are not considered at all. Can you check this once.
> > xe_exec_queue_create_bind is needed only for VM_BIND instance in
> > kernel this is covered in if and else in kernel
> >
> > The remaining functions are needed for other engine instances. Hence
> > excluding the VM_BIND instance for other functions
> But both the if-else condition work for only xe_exec_queue_create_bind,
> others are not covered.
else if (strcmp(s->name, "xe_exec_queue_create_bind")) 
this else condition for other functions
strcmp will return 0 for " xe_exec_queue_create_bind" so for remaining this case will be true 
> > > > +
> > > > +
> > > >  	igt_fixture {
> > > >  		xe_sysfs_driver_do(fd, pci_slot,
> > > XE_SYSFS_DRIVER_UNBIND);
> > > >  	}
> > > > --
> > > > 2.34.1



More information about the igt-dev mailing list