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 3/4] tests/intel/xe_fault_injection: Add helper functions to inject fault with specific budget parameter.
Date: Tue, 18 Feb 2025 14:04:07 +0100	[thread overview]
Message-ID: <Z7SFR3X0yFuVSdrg@fdugast-desk> (raw)
In-Reply-To: <20250207072902.12582-4-satyanarayana.k.v.p@intel.com>

On Fri, Feb 07, 2025 at 12:59:01PM +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. 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.

This description does not fit the patch, which adds one function that is
not used yet. If I understand correctly it is exclusively intended for
use in probe_fail_guc(), so it might be best to merge this patch and the
next one in the series.

> 
> 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 | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/intel/xe_fault_injection.c b/tests/intel/xe_fault_injection.c
> index a4252d028..9432828c2 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
>  
>  enum injection_list_action {
>  	INJECTION_LIST_ADD,
> @@ -42,6 +43,21 @@ struct fault_injection_params {
>  	unsigned int 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.
> +	 */
> +
> +	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;
> @@ -211,8 +227,8 @@ inject_fault_probe(int fd, char pci_slot[], const char function_name[])
>  	injection_list_do(INJECTION_LIST_ADD, function_name);
>  	set_retval(function_name, INJECT_ERRNO);
>  	xe_sysfs_driver_do(fd, pci_slot, XE_SYSFS_DRIVER_TRY_BIND);
> -	igt_assert_eq(-errno, INJECT_ERRNO);
>  	injection_list_do(INJECTION_LIST_REMOVE, function_name);
> +	xe_sysfs_driver_do(fd, pci_slot, XE_SYSFS_DRIVER_TRY_UNBIND);

Unrelated changes?

Francois

>  }
>  
>  static int
> -- 
> 2.35.3
> 

  reply	other threads:[~2025-02-18 13:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-07  7:28 [PATCH i-g-t 0/4] tests/intel/xe_fault_injection: Inject errors during xe_guc_ct_send_recv() xe_guc_mmio_send_recv() Satyanarayana K V P
2025-02-07  7:28 ` [PATCH i-g-t 1/4] lib/igt_sysfs: Add support for device unbinding Satyanarayana K V P
2025-02-18 12:19   ` Francois Dugast
2025-02-07  7:29 ` [PATCH i-g-t 2/4] tests/intel/xe_fault_injection: Make setup_injection_fault() programmable Satyanarayana K V P
2025-02-18 12:46   ` Francois Dugast
2025-02-07  7:29 ` [PATCH i-g-t 3/4] tests/intel/xe_fault_injection: Add helper functions to inject fault with specific budget parameter Satyanarayana K V P
2025-02-18 13:04   ` Francois Dugast [this message]
2025-02-07  7:29 ` [PATCH i-g-t 4/4] tests/intel/xe_fault_injection: Inject errors during xe_guc_ct_send_recv & xe_guc_mmio_send_recv Satyanarayana K V P
2025-02-18 13:48   ` Francois Dugast
2025-02-18 14:06     ` Michal Wajdeczko
2025-02-18 16:40       ` Francois Dugast
2025-02-08  0:01 ` ✓ i915.CI.BAT: success for tests/intel/xe_fault_injection: Inject errors during xe_guc_ct_send_recv() xe_guc_mmio_send_recv() Patchwork
2025-02-08  0:42 ` ✓ Xe.CI.BAT: " Patchwork
2025-02-08 15:59 ` ✗ i915.CI.Full: failure " Patchwork
2025-02-08 17:21 ` ✗ Xe.CI.Full: " 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=Z7SFR3X0yFuVSdrg@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