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 2/5] tests/intel/xe_fault_injection: Make setup_injection_fault() programmable.
Date: Fri, 28 Feb 2025 11:33:57 +0100	[thread overview]
Message-ID: <Z8GRBWXGkqZIL5_u@fdugast-desk> (raw)
In-Reply-To: <20250219073445.31423-3-satyanarayana.k.v.p@intel.com>

On Wed, Feb 19, 2025 at 01:04:42PM +0530, Satyanarayana K V P wrote:
> The current setup_injection_fault() is always programming fixed fault
> injection parameters. Update this function to accept fault injection
> parameters for better injection capabilities.
> 
> 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>

Reviewed-by: Francois Dugast <francois.dugast@intel.com>

> ---
>  tests/intel/xe_fault_injection.c | 42 +++++++++++++++++++++++++++-----
>  1 file changed, 36 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/intel/xe_fault_injection.c b/tests/intel/xe_fault_injection.c
> index 7ae941367..bc05515a8 100644
> --- a/tests/intel/xe_fault_injection.c
> +++ b/tests/intel/xe_fault_injection.c
> @@ -31,6 +31,17 @@ enum injection_list_action {
>  	INJECTION_LIST_REMOVE,
>  };
>  
> +struct fault_injection_params {
> +	/* @probability: Likelihood of failure injection, in percent. */
> +	uint32_t probability;
> +	/* @interval: Specifies the interval between failures */
> +	uint32_t interval;
> +	/* @times: Specifies how many times failures may happen at most */
> +	int32_t times;
> +	/* @space: Specifies an initial resource "budget", decremented by "size" */
> +	uint32_t space;
> +};
> +
>  static int fail_function_open(void)
>  {
>  	int debugfs_fail_function_dir_fd;
> @@ -117,21 +128,40 @@ static void injection_list_do(enum injection_list_action action, const char func
>  	close(dir);
>  }
>  
> +/**
> + * Default fault injection parameters which injects fault on first call to the
> + * configured fail_function.
> + */
> +static const struct fault_injection_params default_fault_params = {
> +	.probability = 100,
> +	.interval = 0,
> +	.times = -1,
> +	.space = 0
> +};
> +
>  /*
>   * See https://docs.kernel.org/fault-injection/fault-injection.html#application-examples
>   */
> -static void setup_injection_fault(void)
> +static void setup_injection_fault(const struct fault_injection_params *fault_params)
>  {
>  	int dir;
>  
> +	igt_assert(fault_params);
> +	igt_assert(fault_params->probability >= 0);
> +	igt_assert(fault_params->probability <= 100);
> +
>  	dir = fail_function_open();
>  	igt_assert_lte(0, dir);
>  
> +	igt_debug("probability = %d, interval = %d, times = %d, space = %u\n",
> +			fault_params->probability, fault_params->interval,
> +			fault_params->times, fault_params->space);
> +
>  	igt_assert_lte(0, igt_sysfs_printf(dir, "task-filter", "N"));
> -	igt_sysfs_set_u32(dir, "probability", 100);
> -	igt_sysfs_set_u32(dir, "interval", 0);
> -	igt_sysfs_set_s32(dir, "times", -1);
> -	igt_sysfs_set_u32(dir, "space", 0);
> +	igt_sysfs_set_u32(dir, "probability", fault_params->probability);
> +	igt_sysfs_set_u32(dir, "interval", fault_params->interval);
> +	igt_sysfs_set_s32(dir, "times", fault_params->times);
> +	igt_sysfs_set_u32(dir, "space", fault_params->space);
>  	igt_sysfs_set_u32(dir, "verbose", 1);
>  
>  	close(dir);
> @@ -322,7 +352,7 @@ igt_main
>  		igt_require(fail_function_injection_enabled());
>  		fd = drm_open_driver(DRIVER_XE);
>  		igt_device_get_pci_slot_name(fd, pci_slot);
> -		setup_injection_fault();
> +		setup_injection_fault(&default_fault_params);
>  	}
>  
>  	for (const struct section *s = vm_create_fail_functions; s->name; s++)
> -- 
> 2.35.3
> 

  reply	other threads:[~2025-02-28 10:34 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 [this message]
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
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=Z8GRBWXGkqZIL5_u@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