Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Purkait, Soham" <soham.purkait@intel.com>
To: Ravi Kishore Koppuravuri <ravi.kishore.koppuravuri@intel.com>,
	<igt-dev@lists.freedesktop.org>
Cc: <riana.tauro@intel.com>, <anshuman.gupta@intel.com>,
	<raag.jadav@intel.com>, <mallesh.koujalagi@intel.com>,
	<harish.chegondi@intel.com>, <kamil.konieczny@linux.intel.com>
Subject: Re: [PATCH v6 05/10] lib/igt_drm_ras_nl: add get_error_threshold command support
Date: Fri, 30 Oct 2026 15:57:05 +0530	[thread overview]
Message-ID: <e5b9f13f-b247-47b4-b177-bc39901f5b0d@intel.com> (raw)
In-Reply-To: <20261029085955.1232163-6-ravi.kishore.koppuravuri@intel.com>

Hi Ravi,

On 29-10-2026 14:29, Ravi Kishore Koppuravuri wrote:
> Add support for GET_ERROR_THRESHOLD to fetch the current value of error
> threshold
>
> Signed-off-by: Ravi Kishore Koppuravuri <ravi.kishore.koppuravuri@intel.com>
> ---
> v6:Removed normalize_nl_error() for standard errno in igt_drm_ras_nl_get_error_threshold()
> v4:Renamed the library functions with prefix "igt_drm_netlink_*" (Nikula
>     Jani & Kamil)
> v2:Added a check whether error_threshold updated by valid callback or not
> ---
>   lib/igt_drm_ras_nl.c | 52 +++++++++++++++++++++++++++++++++++++++++---
>   lib/igt_drm_ras_nl.h |  4 ++++
>   2 files changed, 53 insertions(+), 3 deletions(-)
>
> diff --git a/lib/igt_drm_ras_nl.c b/lib/igt_drm_ras_nl.c
> index 7e6a61f11..d930b6e33 100644
> --- a/lib/igt_drm_ras_nl.c
> +++ b/lib/igt_drm_ras_nl.c
> @@ -75,6 +75,14 @@ static int ras_command_cb(struct nl_msg *msg, void *arg)
>   		ctx->error_value = nla_get_u32(attrs[DRM_RAS_A_ERROR_COUNTER_ATTRS_ERROR_VALUE]);
>   		break;
>   	}
> +	case DRM_RAS_CMD_GET_ERROR_THRESHOLD: {
> +		if (!attrs[DRM_RAS_A_ERROR_COUNTER_ATTRS_ERROR_THRESHOLD])
> +			return NL_SKIP;
> +
> +		ctx->error_threshold =
> +			nla_get_u32(attrs[DRM_RAS_A_ERROR_COUNTER_ATTRS_ERROR_THRESHOLD]);
> +		break;
> +	}
>   	default:
>   		return NL_SKIP;
>   	}
> @@ -230,6 +238,7 @@ static int send_command(struct igt_drm_ras_nl_context *ctx, uint8_t cmd)
>   	}
>   
>   	switch (cmd) {
> +	case DRM_RAS_CMD_GET_ERROR_THRESHOLD:
>   	case DRM_RAS_CMD_GET_ERROR_COUNTER:
>   		ctx->response_required = true;
>   		ret = nla_put_u32(msg,
> @@ -280,6 +289,7 @@ static void reset_drm_ras_nl_context(struct igt_drm_ras_nl_context *ctx)
>   	ctx->reply_received = false;
>   	ctx->ack_received = false;
>   	ctx->response_required = false;
> +	ctx->error_threshold = 0;
>   	ctx->family_id = -1;
>   }
>   
> @@ -326,10 +336,8 @@ int igt_drm_ras_nl_init(struct igt_drm_ras_nl_context *ctx)
>   	return 0;
>   }
>   
> -int igt_drm_ras_nl_get_error_counter(struct igt_drm_ras_nl_context *ctx)
> +static int validate_inputs(struct igt_drm_ras_nl_context *ctx, uint8_t cmd)
>   {
> -	int ret;
> -
>   	if (!ctx || !ctx->sock || ctx->family_id < 0) {
>   		igt_warn("Invalid DRM RAS netlink context\n");
>   		return -EINVAL;
> @@ -343,6 +351,17 @@ int igt_drm_ras_nl_get_error_counter(struct igt_drm_ras_nl_context *ctx)
>   		return -EINVAL;
>   	}
>   
> +	return 0;
> +}
> +
> +int igt_drm_ras_nl_get_error_counter(struct igt_drm_ras_nl_context *ctx)
> +{
> +	int ret;
> +
> +	ret = validate_inputs(ctx, DRM_RAS_CMD_GET_ERROR_COUNTER);
> +	if (ret < 0)
> +		return ret;
> +
>   	ctx->error_value = UINT32_MAX;
>   
>   	ret = send_command(ctx, DRM_RAS_CMD_GET_ERROR_COUNTER);
> @@ -361,3 +380,30 @@ int igt_drm_ras_nl_get_error_counter(struct igt_drm_ras_nl_context *ctx)
>   
>   	return 0;
>   }
> +
> +int igt_drm_ras_nl_get_error_threshold(struct igt_drm_ras_nl_context *ctx)
> +{
> +	int ret;
> +
> +	ret = validate_inputs(ctx, DRM_RAS_CMD_GET_ERROR_THRESHOLD);
> +	if (ret < 0)
> +		return ret;
> +
> +	ctx->error_threshold = UINT32_MAX;
Could be initialized to 0 as Valid threshold are as 1..16

Apart from this all LGTM
Reviewed-by: Soham Purkait <soham.purkait@intel.com>

Regards,
Soham
> +
> +	ret = send_command(ctx, DRM_RAS_CMD_GET_ERROR_THRESHOLD);
> +	if (ret < 0)
> +		return ret;
> +
> +	if (ctx->error_threshold == UINT32_MAX) {
> +		igt_warn("No valid error threshold reply: node_id=%u error_id=%u kernel_error=%d\n",
> +			 ctx->node_id, ctx->error_id, ctx->last_nl_error);
> +
> +		return ctx->last_nl_error ? ctx->last_nl_error : -ENODATA;
> +	}
> +
> +	igt_debug("Retrieved error threshold: node_id=%u error_id=%u threshold=%u\n",
> +		  ctx->node_id, ctx->error_id, ctx->error_threshold);
> +
> +	return 0;
> +}
> diff --git a/lib/igt_drm_ras_nl.h b/lib/igt_drm_ras_nl.h
> index f51784524..86cfd79d0 100644
> --- a/lib/igt_drm_ras_nl.h
> +++ b/lib/igt_drm_ras_nl.h
> @@ -44,11 +44,15 @@ struct igt_drm_ras_nl_context {
>   
>   	/** @family_id: Generic netlink family ID */
>   	int family_id;
> +
> +	/** @error_threshold: Error threshold value to query/set */
> +	uint32_t error_threshold;
>   };
>   
>   void igt_drm_ras_nl_cleanup(struct igt_drm_ras_nl_context *ctx);
>   int igt_drm_ras_nl_init(struct igt_drm_ras_nl_context *ctx);
>   int igt_drm_ras_nl_get_error_counter(struct igt_drm_ras_nl_context *ctx);
> +int igt_drm_ras_nl_get_error_threshold(struct igt_drm_ras_nl_context *ctx);
>   
>   #endif /* IGT_DRM_RAS_NL_H */
>   

  reply	other threads:[~2026-10-30 10:28 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29  8:59 [PATCH v6 00/10] Xe3P GPU Error Injection Test Suite with DRM RAS Netlink Support Ravi Kishore Koppuravuri
2026-10-29  8:59 ` [PATCH v6 01/10] drm-uapi/drm_ras: Sync with kernel b2207d4c4e84 Ravi Kishore Koppuravuri
2026-10-29 14:22   ` Kamil Konieczny
2026-10-29  8:59 ` [PATCH v6 02/10] lib/meson: Add libnl dependencies for DRM RAS support Ravi Kishore Koppuravuri
2026-10-29 14:25   ` Kamil Konieczny
2026-10-29  8:59 ` [PATCH v6 03/10] lib/igt_drm_ras_nl: Introduce DRM RAS Netlink interface library Ravi Kishore Koppuravuri
2026-10-29  8:59 ` [PATCH v6 04/10] lib/igt_drm_ras_nl: add get_error_counter support Ravi Kishore Koppuravuri
2026-10-30 10:04   ` Purkait, Soham
2026-10-30 15:34     ` Koppuravuri, Ravi Kishore
2026-10-29  8:59 ` [PATCH v6 05/10] lib/igt_drm_ras_nl: add get_error_threshold command support Ravi Kishore Koppuravuri
2026-10-30 10:27   ` Purkait, Soham [this message]
2026-10-29  8:59 ` [PATCH v6 06/10] lib/igt_drm_ras_nl: add set_error_threshold " Ravi Kishore Koppuravuri
2026-10-30 10:36   ` Purkait, Soham
2026-10-29  8:59 ` [PATCH v6 07/10] tests/intel/xe_err_injection: Add Core Compute Uncorr Error injection Ravi Kishore Koppuravuri
2026-10-29  9:20   ` Tauro, Riana
2026-10-30 11:36   ` Purkait, Soham
2026-10-29  8:59 ` [PATCH v6 08/10] lib/igt_drm_ras_nl: add event notify subscription and event wait support Ravi Kishore Koppuravuri
2026-10-30 12:04   ` Purkait, Soham
2026-10-29  8:59 ` [PATCH v6 09/10] tests/intel/xe_err_injection: Add Core Compute Corr Error injection Ravi Kishore Koppuravuri
2026-10-29  9:17   ` Tauro, Riana
2026-10-29  8:59 ` [PATCH v6 10/10] tests/intel/xe_err_injection: add CRI GPU requirement check Ravi Kishore Koppuravuri
2026-10-29 16:08 ` ✗ Xe.CI.BAT: failure for Xe3P GPU Error Injection Test Suite with DRM RAS Netlink Support (rev9) Patchwork
2026-10-29 16:26 ` ✓ i915.CI.BAT: success " Patchwork
2026-10-30  6:58 ` ✗ i915.CI.Full: failure " Patchwork
2026-10-30  9:04 ` ✓ Xe.CI.FULL: success " 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=e5b9f13f-b247-47b4-b177-bc39901f5b0d@intel.com \
    --to=soham.purkait@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=harish.chegondi@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=mallesh.koujalagi@intel.com \
    --cc=raag.jadav@intel.com \
    --cc=ravi.kishore.koppuravuri@intel.com \
    --cc=riana.tauro@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