[PATCH i-g-t v2 3/5] tests/intel/xe_fault_injection: Add helper functions to inject fault with specific budget parameter.
K V P, Satyanarayana
satyanarayana.k.v.p at intel.com
Thu Mar 6 09:56:37 UTC 2025
> -----Original Message-----
> From: Dugast, Francois <francois.dugast at intel.com>
> Sent: Wednesday, March 5, 2025 3:58 PM
> To: K V P, Satyanarayana <satyanarayana.k.v.p at intel.com>
> Cc: igt-dev at lists.freedesktop.org; Wajdeczko, Michal
> <Michal.Wajdeczko at intel.com>
> Subject: Re: [PATCH i-g-t v2 3/5] tests/intel/xe_fault_injection: Add helper
> functions to inject fault with specific budget parameter.
>
> Hi,
>
> On Wed, Feb 19, 2025 at 01:04:43PM +0530, Satyanarayana K V P wrote:
> > As per the current implementation, the fault is injected on the first call
> > of the error injection function. Introduce an environment variable
> > IGT_FAULT_INJECT_ITERATION using which, an error can be injected at
> > specific function call.
>
> This makes sense to me but not the commit title. What about something like:
> tests/intel/xe_fault_injection: Add helper to start injecting fault after x
> iterations
>
> > If the environment is not exported, an error will
> > be injected in every possible function call starting from first up to the
> > max number of iteration defined by INJECT_ITERATIONS, currently
> hardcoded
> > as 100.
>
> I would remove this part as this is not what this patch does and can be
> misleading.
>
Updated patch with review comments.
-Satya.
> >
> > Signed-off-by: Satyanarayana K V P <satyanarayana.k.v.p at intel.com>
> > Cc: Michał Wajdeczko <michal.wajdeczko at intel.com>
> > Cc: Francois Dugast <francois.dugast at intel.com>
> > ---
> > tests/intel/xe_fault_injection.c | 16 ++++++++++++++++
> > 1 file changed, 16 insertions(+)
> >
> > diff --git a/tests/intel/xe_fault_injection.c b/tests/intel/xe_fault_injection.c
> > index bc05515a8..32733fec5 100644
> > --- a/tests/intel/xe_fault_injection.c
> > +++ b/tests/intel/xe_fault_injection.c
> > @@ -25,6 +25,7 @@
> > #define INJECT_ERRNO -ENOMEM
> > #define BO_ADDR 0x1a0000
> > #define BO_SIZE (1024*1024)
> > +#define INJECT_ITERATIONS 100
>
> It seems this line does not belong to this patch as INJECT_ITERATIONS is
> not used.
>
> >
> > enum injection_list_action {
> > INJECTION_LIST_ADD,
> > @@ -42,6 +43,21 @@ struct fault_injection_params {
> > uint32_t space;
> > };
> >
> > +static int get_fault_inject_iter(void)
> > +{
> > + /**
> > + * Introduce a new env variable IGT_FAULT_INJECT_ITERATION.
> > + * When unset test will run for INJECT_ITERATIONS iterations.
> > + * When set to <=0 or malformed - same as unset.
> > + * When set to >0 it will run single n-th iteration only.
> > + */
>
> The function description should be before its definition, like this:
>
> /**
> * ...
> */
> static int get_fault_inject_iter(void)
> ...
>
> Also, I find the description in the commit message better describes the
> purpose of this new env variable and function: "... an error can be
> injected at specific function call".
>
> Francois
>
> > +
> > + const char *env = getenv("IGT_FAULT_INJECT_ITERATION");
> > +
> > + /* Return 0 if not exported / -ve value */
> > + return env ? (atoi(env) > 0 ? atoi(env) : 0) : 0;
> > +}
> > +
> > static int fail_function_open(void)
> > {
> > int debugfs_fail_function_dir_fd;
> > --
> > 2.35.3
> >
More information about the igt-dev
mailing list