Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Francois Dugast <francois.dugast@intel.com>
To: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
Cc: igt-dev@lists.freedesktop.org,
	"Michał Wajdeczko" <michal.wajdeczko@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.
Date: Wed, 5 Mar 2025 11:28:22 +0100	[thread overview]
Message-ID: <Z8gnPWhK0seaPf08@fdugast-desk> (raw)
In-Reply-To: <20250219073445.31423-4-satyanarayana.k.v.p@intel.com>

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.

> 
> Signed-off-by: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
> Cc: Michał Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Francois Dugast <francois.dugast@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
> 

  reply	other threads:[~2025-03-05 10:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-19  7:34 [PATCH i-g-t v2 0/5] tests/intel/xe_fault_injection: Inject errors during xe_guc_ct_send_recv() xe_guc_mmio_send_recv() Satyanarayana K V P
2025-02-19  7:34 ` [PATCH i-g-t v2 1/5] lib/igt_sysfs: Add support for device unbinding Satyanarayana K V P
2025-02-19  7:34 ` [PATCH i-g-t v2 2/5] tests/intel/xe_fault_injection: Make setup_injection_fault() programmable Satyanarayana K V P
2025-02-28 10:33   ` Francois Dugast
2025-02-19  7:34 ` [PATCH i-g-t v2 3/5] tests/intel/xe_fault_injection: Add helper functions to inject fault with specific budget parameter Satyanarayana K V P
2025-03-05 10:28   ` Francois Dugast [this message]
2025-03-06  9:56     ` K V P, Satyanarayana
2025-02-19  7:34 ` [PATCH i-g-t v2 4/5] tests/intel/xe_fault_injection: Inject errors during xe_guc_ct_send_recv & xe_guc_mmio_send_recv Satyanarayana K V P
2025-03-05 10:50   ` Francois Dugast
2025-03-05 11:07     ` K V P, Satyanarayana
2025-02-19  7:34 ` [PATCH i-g-t v2 5/5] tests/intel/xe_fault_injection: Do not assert if the captured error is not same as injected error Satyanarayana K V P
2025-03-05 11:53   ` Francois Dugast
2025-03-06  9:57     ` K V P, Satyanarayana
2025-03-21 10:37     ` Bernatowicz, Marcin
2025-02-19  8:26 ` ✓ Xe.CI.BAT: success for tests/intel/xe_fault_injection: Inject errors during xe_guc_ct_send_recv() xe_guc_mmio_send_recv() (rev2) Patchwork
2025-02-19  8:40 ` ✓ i915.CI.BAT: " Patchwork
2025-02-19 10:26 ` ✓ i915.CI.Full: " Patchwork
2025-02-20  5:01 ` ✗ Xe.CI.Full: failure " 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=Z8gnPWhK0seaPf08@fdugast-desk \
    --to=francois.dugast@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=michal.wajdeczko@intel.com \
    --cc=satyanarayana.k.v.p@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