Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Harish Chegondi <harish.chegondi@intel.com>
To: Ravi Kishore Koppuravuri <ravi.kishore.koppuravuri@intel.com>
Cc: <igt-dev@lists.freedesktop.org>, <riana.tauro@intel.com>,
	<anshuman.gupta@intel.com>, <mallesh.koujalagi@intel.com>,
	<raag.jadav@intel.com>
Subject: Re: [PATCH 3/8] lib/igt_drm_netlink: add get_error_threshold command support
Date: Fri, 7 Aug 2026 16:14:54 -0700	[thread overview]
Message-ID: <anZm7vt-fj_qtHph@intel.com> (raw)
In-Reply-To: <20260729121959.603890-4-ravi.kishore.koppuravuri@intel.com>

On Wed, Jul 29, 2026 at 05:49:54PM +0530, 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>
> ---
>  include/drm-uapi/drm_ras.h | 18 +++++++++++++
>  lib/igt_drm_netlink.c      | 53 +++++++++++++++++++++++++++++++++++---
>  lib/igt_drm_netlink.h      |  2 ++
>  3 files changed, 70 insertions(+), 3 deletions(-)
> 
> diff --git a/include/drm-uapi/drm_ras.h b/include/drm-uapi/drm_ras.h
> index 218a3ee86..60611833b 100644
> --- a/include/drm-uapi/drm_ras.h
> +++ b/include/drm-uapi/drm_ras.h
> @@ -33,18 +33,36 @@ enum {
>  	DRM_RAS_A_ERROR_COUNTER_ATTRS_ERROR_ID,
>  	DRM_RAS_A_ERROR_COUNTER_ATTRS_ERROR_NAME,
>  	DRM_RAS_A_ERROR_COUNTER_ATTRS_ERROR_VALUE,
> +	DRM_RAS_A_ERROR_COUNTER_ATTRS_ERROR_THRESHOLD,
>  
>  	__DRM_RAS_A_ERROR_COUNTER_ATTRS_MAX,
>  	DRM_RAS_A_ERROR_COUNTER_ATTRS_MAX = (__DRM_RAS_A_ERROR_COUNTER_ATTRS_MAX - 1)
>  };
>  
> +enum {
> +	DRM_RAS_A_ERROR_EVENT_ATTRS_DEVICE_NAME = 1,
> +	DRM_RAS_A_ERROR_EVENT_ATTRS_NODE_ID,
> +	DRM_RAS_A_ERROR_EVENT_ATTRS_NODE_NAME,
> +	DRM_RAS_A_ERROR_EVENT_ATTRS_ERROR_ID,
> +	DRM_RAS_A_ERROR_EVENT_ATTRS_ERROR_NAME,
> +	DRM_RAS_A_ERROR_EVENT_ATTRS_ERROR_VALUE,
> +
> +	__DRM_RAS_A_ERROR_EVENT_ATTRS_MAX,
> +	DRM_RAS_A_ERROR_EVENT_ATTRS_MAX = (__DRM_RAS_A_ERROR_EVENT_ATTRS_MAX - 1)
The above enums are not used anywhere in this patch?
> +};
> +
>  enum {
>  	DRM_RAS_CMD_LIST_NODES = 1,
>  	DRM_RAS_CMD_GET_ERROR_COUNTER,
>  	DRM_RAS_CMD_CLEAR_ERROR_COUNTER,
> +	DRM_RAS_CMD_GET_ERROR_THRESHOLD,
> +	DRM_RAS_CMD_SET_ERROR_THRESHOLD,
> +	DRM_RAS_CMD_ERROR_EVENT,
DRM_RAS_CMD_SET_ERROR_THRESHOLD and DRM_RAS_CMD_ERROR_EVENT are not
used in this patch? 
>  
>  	__DRM_RAS_CMD_MAX,
>  	DRM_RAS_CMD_MAX = (__DRM_RAS_CMD_MAX - 1)
>  };
>  
> +#define DRM_RAS_MCGRP_ERROR_NOTIFY	"error-notify"
Same here. DRM_RAS_MCGRP_ERROR_NOTIFY not used in this patch?
> +
>  #endif /* _UAPI_LINUX_DRM_RAS_H */
> diff --git a/lib/igt_drm_netlink.c b/lib/igt_drm_netlink.c
> index 4d543275d..036660a6a 100644
> --- a/lib/igt_drm_netlink.c
> +++ b/lib/igt_drm_netlink.c
> @@ -43,6 +43,21 @@ 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: {
> +		struct nlattr *attrs[DRM_RAS_A_ERROR_COUNTER_ATTRS_MAX + 1];
> +
> +		ret = genlmsg_parse(nlh, 0, attrs,
> +				    DRM_RAS_A_ERROR_COUNTER_ATTRS_MAX, NULL);
> +		if (ret < 0)
> +			return NL_SKIP;
> +
> +		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;
>  	}
> @@ -94,6 +109,7 @@ static int send_command(struct app_context *ctx, uint8_t cmd)
>  	}
>  
>  	switch (cmd) {
> +	case DRM_RAS_CMD_GET_ERROR_THRESHOLD:
>  	case DRM_RAS_CMD_GET_ERROR_COUNTER:
>  		ret = nla_put_u32(msg,
>  				  DRM_RAS_A_ERROR_COUNTER_ATTRS_NODE_ID,
> @@ -141,6 +157,7 @@ int init_app_context(struct app_context *ctx)
>  	ctx->node_id = UINT32_MAX;
>  	ctx->error_id = UINT32_MAX;
>  	ctx->error_value = 0;
> +	ctx->error_threshold = 0;
>  	ctx->family_id = -1;
>  
>  	return 0;
> @@ -155,6 +172,7 @@ void cleanup_app_context(struct app_context *ctx)
>  	ctx->node_id = UINT32_MAX;
>  	ctx->error_id = UINT32_MAX;
>  	ctx->error_value = 0;
> +	ctx->error_threshold = 0;
>  	ctx->family_id = -1;
>  }
>  
> @@ -206,10 +224,8 @@ int init_nl_socket(struct app_context *ctx)
>  	return 0;
>  }
>  
> -int get_error_counter(struct app_context *ctx)
> +static int validate_inputs(struct app_context *ctx, uint8_t cmd)
>  {
> -	int ret;
> -
>  	if (!ctx || !ctx->sock || ctx->family_id < 0)
>  		return -EINVAL;
>  
> @@ -222,6 +238,17 @@ int get_error_counter(struct app_context *ctx)
>  		return -EINVAL;
>  	}
>  
> +	return 0;
> +}
> +
> +int get_error_counter(struct app_context *ctx)
> +{
> +	int ret;
> +
> +	ret = validate_inputs(ctx, DRM_RAS_CMD_GET_ERROR_COUNTER);
> +	if (ret < 0)
> +		return ret;
> +
>  	ctx->error_value = 0;
>  
>  	ret = send_command(ctx, DRM_RAS_CMD_GET_ERROR_COUNTER);
> @@ -233,3 +260,23 @@ int get_error_counter(struct app_context *ctx)
>  
>  	return 0;
>  }
> +
> +int get_error_threshold(struct app_context *ctx)
> +{
> +	int ret;
> +
> +	ret = validate_inputs(ctx, DRM_RAS_CMD_GET_ERROR_THRESHOLD);
> +	if (ret < 0)
> +		return ret;
> +
> +	ctx->error_threshold = 0;
> +
> +	ret = send_command(ctx, DRM_RAS_CMD_GET_ERROR_THRESHOLD);
> +	if (ret < 0)
> +		return ret;
> +
> +	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_netlink.h b/lib/igt_drm_netlink.h
> index e539bc030..fae9b0e06 100644
> --- a/lib/igt_drm_netlink.h
> +++ b/lib/igt_drm_netlink.h
> @@ -23,6 +23,7 @@ struct app_context {
>  	uint32_t node_id;
>  	uint32_t error_id;
>  	uint32_t error_value;
> +	uint32_t error_threshold;
>  	int family_id;
>  };
>  
> @@ -31,6 +32,7 @@ void cleanup_app_context(struct app_context *ctx);
>  void cleanup_nl_socket(struct app_context *ctx);
>  int init_nl_socket(struct app_context *ctx);
>  int get_error_counter(struct app_context *ctx);
> +int get_error_threshold(struct app_context *ctx);
>  
>  #endif /* IGT_DRM_NETLINK_H */
>  
> -- 
> 2.34.1
> 

  reply	other threads:[~2026-08-07 23:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29 12:19 [PATCH 0/8] Xe3P GPU Error Injection Test Suite with DRM RAS Netlink Support Ravi Kishore Koppuravuri
2026-07-29 12:19 ` [PATCH 1/8] lib/igt_drm_netlink: Introduce DRM RAS Generic Netlink interface Ravi Kishore Koppuravuri
2026-08-06 23:45   ` Harish Chegondi
2026-08-11  8:02     ` Koppuravuri, Ravi Kishore
2026-07-29 12:19 ` [PATCH 2/8] lib/igt_drm_netlink: add get_error_counter support Ravi Kishore Koppuravuri
2026-07-29 12:19 ` [PATCH 3/8] lib/igt_drm_netlink: add get_error_threshold command support Ravi Kishore Koppuravuri
2026-08-07 23:14   ` Harish Chegondi [this message]
2026-08-11 11:53     ` Koppuravuri, Ravi Kishore
2026-07-29 12:19 ` [PATCH 4/8] lib/igt_drm_netlink: add set_error_threshold " Ravi Kishore Koppuravuri
2026-08-07 23:21   ` Harish Chegondi
2026-08-11 11:47     ` Koppuravuri, Ravi Kishore
2026-07-29 12:19 ` [PATCH 5/8] tests/intel/xe_err_injection: Add GT UC Unicast GAM Walker Command Parity Error Injection Ravi Kishore Koppuravuri
2026-08-10 22:28   ` Harish Chegondi
2026-08-11 11:58     ` Koppuravuri, Ravi Kishore
2026-07-29 12:19 ` [PATCH 6/8] lib/igt_drm_netlink: add event notify subscription and event wait support Ravi Kishore Koppuravuri
2026-07-29 12:19 ` [PATCH 7/8] tests/intel/xe_err_injection: Add tests for L2 bank Corr err threshold scenarios Ravi Kishore Koppuravuri
2026-07-29 12:19 ` [PATCH 8/8] tests/intel/xe_err_injection: add CRI GPU requirement check Ravi Kishore Koppuravuri
2026-08-07  0:06   ` Harish Chegondi

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=anZm7vt-fj_qtHph@intel.com \
    --to=harish.chegondi@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --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