dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: "Tauro, Riana" <riana.tauro@intel.com>
Cc: <dri-devel@lists.freedesktop.org>,
	<intel-xe@lists.freedesktop.org>,
	Aravind Iddamsetty <aravind.iddamsetty@linux.intel.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Raag Jadav <raag.jadav@intel.com>,
	Zack McKevitt <zachary.mckevitt@oss.qualcomm.com>,
	Jeff Hugo <jeff.hugo@oss.qualcomm.com>
Subject: Re: [PATCH v6 2/3] drm/ras: Add retired-pages node type
Date: Mon, 30 Nov 2026 10:34:26 -0500	[thread overview]
Message-ID: <aw2XgqEGOd0D_b9I@intel.com> (raw)
In-Reply-To: <15908e27-e48a-44b3-8dd6-ef2b1d84bca4@intel.com>

On Mon, Nov 30, 2026 at 10:31:50AM +0530, Tauro, Riana wrote:
> 
> On 27-11-2026 23:47, Rodrigo Vivi wrote:
> > From: Aravind Iddamsetty <aravind.iddamsetty@linux.intel.com>
> > 
> > Add a retired-pages node type to drm-ras so drivers can report the
> > memory pages they have taken out of service, with two operations:
> > 
> >   - get-retired-pages: dump one entry per page with its address, size
> >     and status (retired, pending or failed). The list is read once, when
> >     the dump starts.
> >   - get-retired-pages-info: return the maximum number of pages that can
> >     be retired.
> > 
> > v3 (Rodrigo+LLM):
> >   - Split the drm-ras core from the xe user.
> >   - Flatten the page attributes and name the node type retired-pages
> >     instead of retired-resources, avoiding the over-wrapping
> >     anti-pattern pointed out by Jakub: the type-specific nest and the
> >     resource-type enum are gone.
> >   - Use uint for address, size and max-pages, no pad (Jakub).
> >   - Start the status enum at 1.
> >   - Move max-pages to its own do operation instead of a leading dump
> >     entry.
> >   - Set NLM_F_DUMP_INTR from a driver generation counter.
> >   - Report unknown node IDs with NL_SET_BAD_ATTR.
> >   - Removed deprecated Assisted-by tag.
> > 
> > v4 (Rodrigo+LLM):
> >   - Check the dump consistency once a page message is filled (Sashiko),
> >     and on the final NLMSG_DONE (local Sashiko), so NLM_F_DUMP_INTR is
> >     not lost.
> >   - Make the error-counter operations reject other node types (Sashiko).
> >   - Hold a node reference in the new handlers (local Sashiko).
> >   - Rebase on the telemetry node type, moving the type check of its
> >     handlers into drm_ras_node_get().
> > 
> > v5 (Rodrigo+LLM):
> >   - Split the node and callback checks in the clear-error-counter doit,
> >     and write the new handlers like the error-counter ones, with
> >     put_node labels and an inline dump loop, for consistency (Riana).
> >   - Drop node-id from the dump entries (Riana).
> > 
> > v6 (Rodrigo+LLM):
> >   - Take a snapshot of the retired pages when the dump starts, instead of
> >     asking the driver for each page, so large lists are dumped in linear
> >     time. The snapshot is consistent, so NLM_F_DUMP_INTR and the
> >     generation counter are gone (Riana).
> >   - Move the type check of drm_ras_node_get() to its own patch (Riana).
> >   - Let drm-ras own the snapshot array, which drivers fill with
> >     drm_ras_retired_pages_add(), and do not sort it (Riana).
> >   - Pass the info to the driver in a struct, so it can grow, and drop
> >     node-id from the get-retired-pages-info reply (Riana).
> >   - Document each retired-page-status value, which also documents them
> >     in the uAPI header, and reword the max-pages and info docs (Riana).
> >   - Name the dump hooks pre/post like the other drm-ras ones, and use
> >     struct nlattr for the message headers (Riana).
> > 
> > Cc: Jakub Kicinski <kuba@kernel.org>
> > Cc: Riana Tauro <riana.tauro@intel.com>
> > Cc: Raag Jadav <raag.jadav@intel.com>
> > Cc: Zack McKevitt <zachary.mckevitt@oss.qualcomm.com>
> > Cc: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
> > Signed-off-by: Aravind Iddamsetty <aravind.iddamsetty@linux.intel.com>
> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > ---
> >   Documentation/netlink/specs/drm_ras.yaml |  78 ++++++-
> >   drivers/gpu/drm/drm_ras.c                | 252 ++++++++++++++++++++++-
> >   drivers/gpu/drm/drm_ras_nl.c             |  26 +++
> >   drivers/gpu/drm/drm_ras_nl.h             |   6 +
> >   include/drm/drm_ras.h                    |  68 ++++++
> >   include/uapi/drm/drm_ras.h               |  34 ++-
> >   6 files changed, 454 insertions(+), 10 deletions(-)
> > 
> > diff --git a/Documentation/netlink/specs/drm_ras.yaml b/Documentation/netlink/specs/drm_ras.yaml
> > index 0f1ceb705d3d..7cab42685568 100644
> > --- a/Documentation/netlink/specs/drm_ras.yaml
> > +++ b/Documentation/netlink/specs/drm_ras.yaml
> > @@ -16,16 +16,33 @@ definitions:
> >       type: enum
> >       name: node-type
> >       value-start: 1
> > -    entries: [error-counter, telemetry]
> > +    entries: [error-counter, telemetry, retired-pages]
> >       doc: >-
> >            Type of the node. The error-counter nodes expose reliability counters
> > -         for a hardware/software component, and telemetry nodes expose an
> > -         interface for reading and writing telemetry values to a device.
> > +         for a hardware/software component, telemetry nodes expose an
> > +         interface for reading and writing telemetry values to a device, and
> > +         retired-pages nodes list the memory pages that have been taken out
> > +         of service.
> >     -
> >       type: flags
> >       name: telemetry-field-mode
> >       entries: [read, write]
> >       doc: Bitmask of access modes supported by a telemetry field.
> > +  -
> > +    type: enum
> > +    name: retired-page-status
> > +    value-start: 1
> > +    doc: Status of a retired page.
> > +    entries:
> > +      -
> > +        name: retired
> > +        doc: The page is reserved and out of service.
> > +      -
> > +        name: pending
> > +        doc: The retirement is queued, but the reservation is not complete yet.
> > +      -
> > +        name: failed
> > +        doc: The reservation failed, and the page may still be in use.
> >   attribute-sets:
> >     -
> > @@ -140,6 +157,30 @@ attribute-sets:
> >           doc: >-
> >                Bitmask of access modes (read/write) supported by the
> >                telemetry field.
> > +  -
> > +    name: retired-page-attrs
> > +    attributes:
> > +      -
> > +        name: node-id
> > +        type: u32
> > +        doc: Node ID targeted by this retired pages operation.
> > +      -
> > +        name: address
> > +        type: uint
> > +        doc: Device address of the retired page.
> > +      -
> > +        name: size
> > +        type: uint
> > +        doc: Size of the retired page in bytes.
> > +      -
> > +        name: status
> > +        type: u32
> > +        doc: Retirement status of the page.
> > +        enum: retired-page-status
> > +      -
> > +        name: max-pages
> > +        type: uint
> > +        doc: Maximum number of pages that can be retired.
> >   operations:
> >     list:
> > @@ -287,6 +328,37 @@ operations:
> >               - field
> >               - field-name
> >               - mode
> > +    -
> > +      name: get-retired-pages
> > +      doc: >-
> > +           Retrieve the pages retired on a retired-pages node, one entry per
> > +           page. The list is read once, when the dump starts.
> > +      attribute-set: retired-page-attrs
> > +      flags: [admin-perm]
> > +      dump:
> > +        pre: drm-ras-nl-pre-retired-pages
> > +        post: drm-ras-nl-post-retired-pages
> > +        request:
> > +          attributes:
> > +            - node-id
> > +        reply:
> > +          attributes:
> > +            - address
> > +            - size
> > +            - status
> > +    -
> > +      name: get-retired-pages-info
> > +      doc: >-
> > +           Retrieve the retired pages info of a retired-pages node.
> > +      attribute-set: retired-page-attrs
> > +      flags: [admin-perm]
> > +      do:
> > +        request:
> > +          attributes:
> > +            - node-id
> > +        reply:
> > +          attributes:
> > +            - max-pages
> >   mcast-groups:
> >     list:
> > diff --git a/drivers/gpu/drm/drm_ras.c b/drivers/gpu/drm/drm_ras.c
> > index 5ae6d0a3b751..618b6a44c95b 100644
> > --- a/drivers/gpu/drm/drm_ras.c
> > +++ b/drivers/gpu/drm/drm_ras.c
> > @@ -69,6 +69,14 @@
> >    *     Each field contains the uAPI defined enum string, its numerical value,
> >    *     and its mode bitmask, which encodes read/write capabilities.
> >    *
> > + * 11. GET_RETIRED_PAGES: Dump the retired pages of a given node.
> > + *     Userspace must provide Node ID.
> > + *     Returns one entry per page with its address, size and status.
> > + *
> > + * 12. GET_RETIRED_PAGES_INFO: Get the retired pages info of a given node.
> > + *     Userspace must provide Node ID.
> > + *     Returns the maximum number of pages that can be retired.
> > + *
> >    * Node registration:
> >    *
> >    * - drm_ras_node_register(): Registers a new node and assigns
> > @@ -121,6 +129,13 @@
> >    *     + The driver can optionally provide a pre_doit callback, telemetry_pre(),
> >    *       to enforce permissions checks on telemetry operations.
> >    *
> > + * - RETIRED_PAGES:
> > + *     + The driver must implement the query_retired_pages() callback, adding
> > + *       each retired page of the node to the snapshot of the dump with
> > + *       drm_ras_retired_pages_add().
> > + *     + The driver can implement query_retired_pages_info() to report the
> > + *       maximum number of pages that can be retired.
> > + *
> >    * Netlink handlers:
> >    *
> >    * - drm_ras_nl_list_nodes_dumpit(): Implements the LIST_NODES
> > @@ -147,10 +162,26 @@
> >    * - drm_ras_nl_telemetry_list_fields_dumpit(): Implements the TELEMETRY_LIST_FIELDS
> >    *   dumpit operation, enumerating all telemetry fields and their supported
> >    *   access modes for a telemetry node.
> > + * - drm_ras_nl_pre_retired_pages(): GET_RETIRED_PAGES dump start operation,
> > + *   taking a snapshot of the retired pages of a specific node.
> > + * - drm_ras_nl_get_retired_pages_dumpit(): Implements the GET_RETIRED_PAGES dumpit
> > + *   operation, listing the retired pages of the snapshot.
> > + * - drm_ras_nl_post_retired_pages(): GET_RETIRED_PAGES dump done operation,
> > + *   freeing the snapshot.
> > + * - drm_ras_nl_get_retired_pages_info_doit(): Implements the GET_RETIRED_PAGES_INFO
> > + *   doit operation, fetching the retired pages info of a specific node.
> >    */
> >   static DEFINE_XARRAY_ALLOC(drm_ras_xa);
> > +/* State of a GET_RETIRED_PAGES dump */
> > +struct drm_ras_retired_pages_ctx {
> > +	/* Snapshot of the retired pages, taken when the dump starts */
> > +	struct drm_ras_retired_pages snapshot;
> > +	/* Index of the next page of @snapshot to dump */
> > +	u32 next;
> > +};
> > +
> >   /*
> >    * Per-command netlink context. Overlaid on the callback storage (cb->ctx) for
> >    * dumps and on genl_info (info->ctx) for doits. @node pins the node targeted by
> > @@ -162,6 +193,8 @@ struct drm_ras_ctx {
> >   	unsigned long restart;
> >   	/* Node targeted by a telemetry get/set doit */
> >   	struct drm_ras_node *node;
> > +	/* State of a retired pages dump */
> > +	struct drm_ras_retired_pages_ctx retired;
> >   };
> >   static_assert(sizeof(struct drm_ras_ctx) <= NETLINK_CTX_SIZE);
> > @@ -704,19 +737,23 @@ int drm_ras_nl_clear_error_counter_doit(struct sk_buff *skb,
> >   	error_id = nla_get_u32(info->attrs[DRM_RAS_A_ERROR_COUNTER_ATTRS_ERROR_ID]);
> >   	node = drm_ras_node_get(node_id, DRM_RAS_NODE_TYPE_ERROR_COUNTER);
> > -	if (!node || !node->clear_error_counter) {
> > -		drm_ras_node_put(node);
> > +	if (!node)
> >   		return -ENOENT;
> > +
> > +	if (!node->clear_error_counter) {
> > +		ret = -ENOENT;
> > +		goto put_node;
> >   	}
> >   	if (error_id < node->error_counter_range.first ||
> >   	    error_id > node->error_counter_range.last) {
> > -		drm_ras_node_put(node);
> > -		return -EINVAL;
> > +		ret = -EINVAL;
> > +		goto put_node;
> >   	}
> >   	ret = node->clear_error_counter(node, error_id);
> > +put_node:
> >   	drm_ras_node_put(node);
> 
> This can be part of the first patch. unrelated to this patch

Indeed, I'll move it to patch 1.

> 
> >   	return ret;
> > @@ -785,6 +822,208 @@ int drm_ras_nl_set_error_threshold_doit(struct sk_buff *skb, struct genl_info *i
> >   	return ret;
> >   }
> > +static struct drm_ras_node *get_retired_pages_node(const struct genl_info *info)
> > +{
> > +	struct nlattr *attr = info->attrs[DRM_RAS_A_RETIRED_PAGE_ATTRS_NODE_ID];
> > +	struct drm_ras_node *node;
> > +
> > +	node = drm_ras_node_get(nla_get_u32(attr), DRM_RAS_NODE_TYPE_RETIRED_PAGES);
> > +	if (!node)
> > +		NL_SET_BAD_ATTR(info->extack, attr);
> > +
> > +	return node;
> > +}
> > +
> > +static int msg_put_retired_page(struct sk_buff *msg,
> > +				const struct drm_ras_retired_page *page)
> > +{
> > +	int ret;
> > +
> > +	ret = nla_put_uint(msg, DRM_RAS_A_RETIRED_PAGE_ATTRS_ADDRESS, page->address);
> > +	if (ret)
> > +		return ret;
> > +
> > +	ret = nla_put_uint(msg, DRM_RAS_A_RETIRED_PAGE_ATTRS_SIZE, page->size);
> > +	if (ret)
> > +		return ret;
> > +
> > +	return nla_put_u32(msg, DRM_RAS_A_RETIRED_PAGE_ATTRS_STATUS, page->status);
> > +}
> > +
> > +/**
> > + * drm_ras_retired_pages_add() - Add a page to a retired pages snapshot
> > + * @list: Snapshot passed to the query_retired_pages() callback
> > + * @page: Retired page to add
> > + *
> > + * Return: 0 on success, or -ENOMEM if @list cannot grow.
> > + */
> > +int drm_ras_retired_pages_add(struct drm_ras_retired_pages *list,
> > +			      const struct drm_ras_retired_page *page)
> > +{
> > +	struct drm_ras_retired_page *pages;
> > +	u32 capacity;
> > +
> > +	if (list->count == list->capacity) {
> > +		capacity = max(16U, 2 * list->capacity);
> > +		pages = kvrealloc(list->pages, array_size(capacity, sizeof(*pages)), GFP_KERNEL);
> 
> Can't we allocate the list at one shot with the count and add the pages at
> once too?

I'd prefer to keep it like this. drm-ras doesn't know how many pages
there are, only the driver does, and it can change until the driver
takes its lock. Other drivers might not even keep a count, and each
one stores the pages in its own way, so there's no array to just copy.

And since the array doubles each time, even 10000 pages only take
about 10 reallocations.

Thanks,
Rodrigo.

> 
> Rest of the review comments have been addressed and it looks good to me.
> 
> Thanks
> Riana
> 
> > +		if (!pages)
> > +			return -ENOMEM;
> > +
> > +		list->pages = pages;
> > +		list->capacity = capacity;
> > +	}
> > +
> > +	list->pages[list->count++] = *page;
> > +
> > +	return 0;
> > +}
> > +EXPORT_SYMBOL(drm_ras_retired_pages_add);
> > +
> > +/**
> > + * drm_ras_nl_pre_retired_pages() - Take a snapshot of the retired pages
> > + * @cb: Callback context for multi-part dumps
> > + *
> > + * Return: 0 on success, or a negative error code on failure.
> > + */
> > +int drm_ras_nl_pre_retired_pages(struct netlink_callback *cb)
> > +{
> > +	const struct genl_info *info = genl_info_dump(cb);
> > +	struct drm_ras_ctx *ctx = (void *)cb->ctx;
> > +	struct drm_ras_node *node;
> > +	int ret;
> > +
> > +	if (!info->attrs || GENL_REQ_ATTR_CHECK(info, DRM_RAS_A_RETIRED_PAGE_ATTRS_NODE_ID))
> > +		return -EINVAL;
> > +
> > +	node = get_retired_pages_node(info);
> > +	if (!node)
> > +		return -ENOENT;
> > +
> > +	ret = node->query_retired_pages(node, &ctx->retired.snapshot);
> > +	drm_ras_node_put(node);
> > +	if (ret)
> > +		kvfree(ctx->retired.snapshot.pages);
> > +
> > +	return ret;
> > +}
> > +
> > +/**
> > + * drm_ras_nl_get_retired_pages_dumpit() - Dump the retired pages of a node
> > + * @skb: Netlink message buffer
> > + * @cb: Callback context for multi-part dumps
> > + *
> > + * Appends one message per retired page of the snapshot. The dump resumes from
> > + * the next page after a buffer overflow.
> > + *
> > + * Return: 0 if all pages fit in @skb, -EMSGSIZE if the buffer filled up
> > + *         (requires multi-part continuation), or a negative error code on
> > + *         failure.
> > + */
> > +int drm_ras_nl_get_retired_pages_dumpit(struct sk_buff *skb,
> > +					struct netlink_callback *cb)
> > +{
> > +	const struct genl_info *info = genl_info_dump(cb);
> > +	struct drm_ras_ctx *ctx = (void *)cb->ctx;
> > +	struct nlattr *hdr;
> > +	int ret = 0;
> > +
> > +	for (; ctx->retired.next < ctx->retired.snapshot.count; ctx->retired.next++) {
> > +		hdr = genlmsg_iput(skb, info);
> > +		if (!hdr) {
> > +			ret = -EMSGSIZE;
> > +			break;
> > +		}
> > +
> > +		ret = msg_put_retired_page(skb, &ctx->retired.snapshot.pages[ctx->retired.next]);
> > +		if (ret) {
> > +			genlmsg_cancel(skb, hdr);
> > +			break;
> > +		}
> > +
> > +		genlmsg_end(skb, hdr);
> > +	}
> > +
> > +	return ret;
> > +}
> > +
> > +/**
> > + * drm_ras_nl_post_retired_pages() - Free the retired pages snapshot
> > + * @cb: Callback context for multi-part dumps
> > + *
> > + * Return: 0.
> > + */
> > +int drm_ras_nl_post_retired_pages(struct netlink_callback *cb)
> > +{
> > +	struct drm_ras_ctx *ctx = (void *)cb->ctx;
> > +
> > +	kvfree(ctx->retired.snapshot.pages);
> > +
> > +	return 0;
> > +}
> > +
> > +/**
> > + * drm_ras_nl_get_retired_pages_info_doit() - Query the retired pages info of a node
> > + * @skb: Netlink message buffer
> > + * @info: Generic Netlink info containing attributes of the request
> > + *
> > + * Return: 0 on success, or negative errno on failure.
> > + */
> > +int drm_ras_nl_get_retired_pages_info_doit(struct sk_buff *skb,
> > +					   struct genl_info *info)
> > +{
> > +	struct drm_ras_retired_pages_info pages_info = {};
> > +	struct drm_ras_node *node;
> > +	struct sk_buff *msg;
> > +	struct nlattr *hdr;
> > +	int ret;
> > +
> > +	if (!info->attrs || GENL_REQ_ATTR_CHECK(info, DRM_RAS_A_RETIRED_PAGE_ATTRS_NODE_ID))
> > +		return -EINVAL;
> > +
> > +	node = get_retired_pages_node(info);
> > +	if (!node)
> > +		return -ENOENT;
> > +
> > +	if (!node->query_retired_pages_info) {
> > +		ret = -EOPNOTSUPP;
> > +		goto put_node;
> > +	}
> > +
> > +	ret = node->query_retired_pages_info(node, &pages_info);
> > +	if (ret)
> > +		goto put_node;
> > +
> > +	msg = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
> > +	if (!msg) {
> > +		ret = -ENOMEM;
> > +		goto put_node;
> > +	}
> > +
> > +	hdr = genlmsg_iput(msg, info);
> > +	if (!hdr) {
> > +		ret = -EMSGSIZE;
> > +		goto free_msg;
> > +	}
> > +
> > +	ret = nla_put_uint(msg, DRM_RAS_A_RETIRED_PAGE_ATTRS_MAX_PAGES, pages_info.max_pages);
> > +	if (ret)
> > +		goto cancel_msg;
> > +
> > +	genlmsg_end(msg, hdr);
> > +
> > +	drm_ras_node_put(node);
> > +
> > +	return genlmsg_reply(msg, info);
> > +
> > +cancel_msg:
> > +	genlmsg_cancel(msg, hdr);
> > +free_msg:
> > +	nlmsg_free(msg);
> > +put_node:
> > +	drm_ras_node_put(node);
> > +	return ret;
> > +}
> > +
> >   /**
> >    * drm_ras_nl_pre_telemetry - Look up the telemetry node and enforce permissions
> >    * @ops: Generic netlink operations
> > @@ -1102,7 +1341,6 @@ int drm_ras_node_register(struct drm_ras_node *node)
> >   	if (!node->device_name || !node->node_name)
> >   		return -EINVAL;
> > -	/* Currently, only Error Counter and Telemetry endpoints are supported */
> >   	switch (node->type) {
> >   	case DRM_RAS_NODE_TYPE_ERROR_COUNTER:
> >   		/* Mandatory entries for Error Counter Node */
> > @@ -1114,6 +1352,10 @@ int drm_ras_node_register(struct drm_ras_node *node)
> >   		if (!node->telemetry_get || !node->telemetry_fields)
> >   			return -EINVAL;
> >   		break;
> > +	case DRM_RAS_NODE_TYPE_RETIRED_PAGES:
> > +		if (!node->query_retired_pages)
> > +			return -EINVAL;
> > +		break;
> >   	default:
> >   		return -EINVAL;
> >   	}
> > diff --git a/drivers/gpu/drm/drm_ras_nl.c b/drivers/gpu/drm/drm_ras_nl.c
> > index 589c6445eff7..3fadd8742760 100644
> > --- a/drivers/gpu/drm/drm_ras_nl.c
> > +++ b/drivers/gpu/drm/drm_ras_nl.c
> > @@ -59,6 +59,16 @@ static const struct nla_policy drm_ras_telemetry_list_fields_nl_policy[DRM_RAS_A
> >   	[DRM_RAS_A_TELEMETRY_ATTRS_NODE_ID] = { .type = NLA_U32, },
> >   };
> > +/* DRM_RAS_CMD_GET_RETIRED_PAGES - dump */
> > +static const struct nla_policy drm_ras_get_retired_pages_nl_policy[DRM_RAS_A_RETIRED_PAGE_ATTRS_NODE_ID + 1] = {
> > +	[DRM_RAS_A_RETIRED_PAGE_ATTRS_NODE_ID] = { .type = NLA_U32, },
> > +};
> > +
> > +/* DRM_RAS_CMD_GET_RETIRED_PAGES_INFO - do */
> > +static const struct nla_policy drm_ras_get_retired_pages_info_nl_policy[DRM_RAS_A_RETIRED_PAGE_ATTRS_NODE_ID + 1] = {
> > +	[DRM_RAS_A_RETIRED_PAGE_ATTRS_NODE_ID] = { .type = NLA_U32, },
> > +};
> > +
> >   /* Ops table for drm_ras */
> >   static const struct genl_split_ops drm_ras_nl_ops[] = {
> >   	{
> > @@ -126,6 +136,22 @@ static const struct genl_split_ops drm_ras_nl_ops[] = {
> >   		.maxattr	= DRM_RAS_A_TELEMETRY_ATTRS_NODE_ID,
> >   		.flags		= GENL_CMD_CAP_DUMP,
> >   	},
> > +	{
> > +		.cmd		= DRM_RAS_CMD_GET_RETIRED_PAGES,
> > +		.start		= drm_ras_nl_pre_retired_pages,
> > +		.dumpit		= drm_ras_nl_get_retired_pages_dumpit,
> > +		.done		= drm_ras_nl_post_retired_pages,
> > +		.policy		= drm_ras_get_retired_pages_nl_policy,
> > +		.maxattr	= DRM_RAS_A_RETIRED_PAGE_ATTRS_NODE_ID,
> > +		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
> > +	},
> > +	{
> > +		.cmd		= DRM_RAS_CMD_GET_RETIRED_PAGES_INFO,
> > +		.doit		= drm_ras_nl_get_retired_pages_info_doit,
> > +		.policy		= drm_ras_get_retired_pages_info_nl_policy,
> > +		.maxattr	= DRM_RAS_A_RETIRED_PAGE_ATTRS_NODE_ID,
> > +		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
> > +	},
> >   };
> >   static const struct genl_multicast_group drm_ras_nl_mcgrps[] = {
> > diff --git a/drivers/gpu/drm/drm_ras_nl.h b/drivers/gpu/drm/drm_ras_nl.h
> > index 7a1cba70fd50..9d6c43279eb1 100644
> > --- a/drivers/gpu/drm/drm_ras_nl.h
> > +++ b/drivers/gpu/drm/drm_ras_nl.h
> > @@ -17,6 +17,8 @@ int drm_ras_nl_pre_telemetry(const struct genl_split_ops *ops,
> >   void
> >   drm_ras_nl_post_telemetry(const struct genl_split_ops *ops,
> >   			  struct sk_buff *skb, struct genl_info *info);
> > +int drm_ras_nl_pre_retired_pages(struct netlink_callback *cb);
> > +int drm_ras_nl_post_retired_pages(struct netlink_callback *cb);
> >   int drm_ras_nl_list_nodes_dumpit(struct sk_buff *skb,
> >   				 struct netlink_callback *cb);
> > @@ -34,6 +36,10 @@ int drm_ras_nl_telemetry_get_doit(struct sk_buff *skb, struct genl_info *info);
> >   int drm_ras_nl_telemetry_set_doit(struct sk_buff *skb, struct genl_info *info);
> >   int drm_ras_nl_telemetry_list_fields_dumpit(struct sk_buff *skb,
> >   					    struct netlink_callback *cb);
> > +int drm_ras_nl_get_retired_pages_dumpit(struct sk_buff *skb,
> > +					struct netlink_callback *cb);
> > +int drm_ras_nl_get_retired_pages_info_doit(struct sk_buff *skb,
> > +					   struct genl_info *info);
> >   enum {
> >   	DRM_RAS_NLGRP_ERROR_REPORT,
> > diff --git a/include/drm/drm_ras.h b/include/drm/drm_ras.h
> > index 76bdcc6f96a5..26bc9006f0d7 100644
> > --- a/include/drm/drm_ras.h
> > +++ b/include/drm/drm_ras.h
> > @@ -28,6 +28,41 @@ struct drm_ras_telemetry_field {
> >   	u32 mode;
> >   };
> > +/**
> > + * struct drm_ras_retired_page - A retired page reported by a driver
> > + */
> > +struct drm_ras_retired_page {
> > +	/** @address: Device address of the page. */
> > +	u64 address;
> > +	/** @size: Size of the page in bytes. */
> > +	u64 size;
> > +	/** @status: Retirement status (enum drm_ras_retired_page_status). */
> > +	enum drm_ras_retired_page_status status;
> > +};
> > +
> > +/**
> > + * struct drm_ras_retired_pages - A snapshot of the retired pages of a node
> > + *
> > + * Owned by drm-ras. Drivers only add pages to it with
> > + * drm_ras_retired_pages_add().
> > + */
> > +struct drm_ras_retired_pages {
> > +	/** @pages: Array of the retired pages. */
> > +	struct drm_ras_retired_page *pages;
> > +	/** @count: Number of pages in @pages. */
> > +	u32 count;
> > +	/** @capacity: Number of pages @pages can hold. */
> > +	u32 capacity;
> > +};
> > +
> > +/**
> > + * struct drm_ras_retired_pages_info - Retired pages info of a node
> > + */
> > +struct drm_ras_retired_pages_info {
> > +	/** @max_pages: Maximum number of pages that can be retired. */
> > +	u64 max_pages;
> > +};
> > +
> >   /**
> >    * struct drm_ras_node - A DRM RAS Node
> >    */
> > @@ -184,6 +219,34 @@ struct drm_ras_node {
> >   	int (*telemetry_set)(struct drm_ras_node *ep, u64 *field, s64 *value,
> >   			     s64 *status);
> > +	/* Retired-Pages Related Callbacks */
> > +
> > +	/**
> > +	 * @query_retired_pages:
> > +	 *
> > +	 * This callback is used by drm-ras to take a snapshot of the retired
> > +	 * pages of a node. It must add each retired page of the node to @list
> > +	 * with drm_ras_retired_pages_add().
> > +	 *
> > +	 * The @query_retired_pages is a mandatory callback for
> > +	 * retired_pages_node.
> > +	 *
> > +	 * Returns: 0 on success, negative error code on failure.
> > +	 */
> > +	int (*query_retired_pages)(struct drm_ras_node *node,
> > +				   struct drm_ras_retired_pages *list);
> > +
> > +	/**
> > +	 * @query_retired_pages_info:
> > +	 *
> > +	 * This callback is used by drm-ras to query the retired pages info of a
> > +	 * node.
> > +	 *
> > +	 * Returns: 0 on success, negative error code on failure.
> > +	 */
> > +	int (*query_retired_pages_info)(struct drm_ras_node *node,
> > +					struct drm_ras_retired_pages_info *info);
> > +
> >   	/** @priv: Driver private data */
> >   	void *priv;
> > @@ -209,12 +272,17 @@ int drm_ras_node_register(struct drm_ras_node *node);
> >   void drm_ras_node_unregister(struct drm_ras_node *node);
> >   int drm_ras_nl_error_event(struct drm_ras_node *node, u32 error_id, const char *error_name,
> >   			   u32 value);
> > +int drm_ras_retired_pages_add(struct drm_ras_retired_pages *list,
> > +			      const struct drm_ras_retired_page *page);
> >   #else
> >   static inline int drm_ras_node_register(struct drm_ras_node *node) { return 0; }
> >   static inline void drm_ras_node_unregister(struct drm_ras_node *node) { }
> >   static inline int drm_ras_nl_error_event(struct drm_ras_node *node, u32 error_id,
> >   					 const char *error_name, u32 value)
> >   { return 0; }
> > +static inline int drm_ras_retired_pages_add(struct drm_ras_retired_pages *list,
> > +					    const struct drm_ras_retired_page *page)
> > +{ return 0; }
> >   #endif
> >   #endif
> > diff --git a/include/uapi/drm/drm_ras.h b/include/uapi/drm/drm_ras.h
> > index 56e0588af5d5..834741da2459 100644
> > --- a/include/uapi/drm/drm_ras.h
> > +++ b/include/uapi/drm/drm_ras.h
> > @@ -12,12 +12,14 @@
> >   /*
> >    * Type of the node. The error-counter nodes expose reliability counters for a
> > - * hardware/software component, and telemetry nodes expose an interface for
> > - * reading and writing telemetry values to a device.
> > + * hardware/software component, telemetry nodes expose an interface for reading
> > + * and writing telemetry values to a device, and retired-pages nodes list the
> > + * memory pages that have been taken out of service.
> >    */
> >   enum drm_ras_node_type {
> >   	DRM_RAS_NODE_TYPE_ERROR_COUNTER = 1,
> >   	DRM_RAS_NODE_TYPE_TELEMETRY,
> > +	DRM_RAS_NODE_TYPE_RETIRED_PAGES,
> >   };
> >   /*
> > @@ -28,6 +30,21 @@ enum drm_ras_telemetry_field_mode {
> >   	DRM_RAS_TELEMETRY_FIELD_MODE_WRITE = 2,
> >   };
> > +/**
> > + * enum drm_ras_retired_page_status - Status of a retired page.
> > + * @DRM_RAS_RETIRED_PAGE_STATUS_RETIRED: The page is reserved and out of
> > + *   service.
> > + * @DRM_RAS_RETIRED_PAGE_STATUS_PENDING: The retirement is queued, but the
> > + *   reservation is not complete yet.
> > + * @DRM_RAS_RETIRED_PAGE_STATUS_FAILED: The reservation failed, and the page
> > + *   may still be in use.
> > + */
> > +enum drm_ras_retired_page_status {
> > +	DRM_RAS_RETIRED_PAGE_STATUS_RETIRED = 1,
> > +	DRM_RAS_RETIRED_PAGE_STATUS_PENDING,
> > +	DRM_RAS_RETIRED_PAGE_STATUS_FAILED,
> > +};
> > +
> >   enum {
> >   	DRM_RAS_A_NODE_ATTRS_NODE_ID = 1,
> >   	DRM_RAS_A_NODE_ATTRS_DEVICE_NAME,
> > @@ -73,6 +90,17 @@ enum {
> >   	DRM_RAS_A_TELEMETRY_ATTRS_MAX = (__DRM_RAS_A_TELEMETRY_ATTRS_MAX - 1)
> >   };
> > +enum {
> > +	DRM_RAS_A_RETIRED_PAGE_ATTRS_NODE_ID = 1,
> > +	DRM_RAS_A_RETIRED_PAGE_ATTRS_ADDRESS,
> > +	DRM_RAS_A_RETIRED_PAGE_ATTRS_SIZE,
> > +	DRM_RAS_A_RETIRED_PAGE_ATTRS_STATUS,
> > +	DRM_RAS_A_RETIRED_PAGE_ATTRS_MAX_PAGES,
> > +
> > +	__DRM_RAS_A_RETIRED_PAGE_ATTRS_MAX,
> > +	DRM_RAS_A_RETIRED_PAGE_ATTRS_MAX = (__DRM_RAS_A_RETIRED_PAGE_ATTRS_MAX - 1)
> > +};
> > +
> >   enum {
> >   	DRM_RAS_CMD_LIST_NODES = 1,
> >   	DRM_RAS_CMD_GET_ERROR_COUNTER,
> > @@ -83,6 +111,8 @@ enum {
> >   	DRM_RAS_CMD_TELEMETRY_GET,
> >   	DRM_RAS_CMD_TELEMETRY_SET,
> >   	DRM_RAS_CMD_TELEMETRY_LIST_FIELDS,
> > +	DRM_RAS_CMD_GET_RETIRED_PAGES,
> > +	DRM_RAS_CMD_GET_RETIRED_PAGES_INFO,
> >   	__DRM_RAS_CMD_MAX,
> >   	DRM_RAS_CMD_MAX = (__DRM_RAS_CMD_MAX - 1)

  reply	other threads:[~2026-11-30 15:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 18:17 [PATCH v6 0/3] drm/xe: Expose retired VRAM pages via drm-ras Rodrigo Vivi
2026-11-27 18:17 ` [PATCH v6 1/3] drm/ras: Check the node type in node lookups Rodrigo Vivi
2026-11-27 18:24   ` sashiko-bot
2026-11-27 18:41     ` Rodrigo Vivi
2026-11-30  4:24   ` Tauro, Riana
2026-11-27 18:17 ` [PATCH v6 2/3] drm/ras: Add retired-pages node type Rodrigo Vivi
2026-11-30  5:01   ` Tauro, Riana
2026-11-30 15:34     ` Rodrigo Vivi [this message]
2026-11-30 16:27       ` Tauro, Riana
2026-11-30 16:30         ` Tauro, Riana
2026-11-30  5:09   ` Tauro, Riana
2026-11-30 13:35     ` Rodrigo Vivi
2026-11-30 18:02       ` Rodrigo Vivi
2026-11-27 18:17 ` [PATCH v6 3/3] drm/xe: Expose retired VRAM pages via drm-ras Rodrigo Vivi
2026-11-29 17:31   ` Upadhyay, Tejas
2026-11-30 16:04     ` Rodrigo Vivi
2026-11-30  5:04   ` Tauro, Riana

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=aw2XgqEGOd0D_b9I@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=aravind.iddamsetty@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jeff.hugo@oss.qualcomm.com \
    --cc=kuba@kernel.org \
    --cc=raag.jadav@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=zachary.mckevitt@oss.qualcomm.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