From: "Tauro, Riana" <riana.tauro@intel.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>, <raag.jadav@intel.com>,
<kuba@kernel.org>, <aravind.iddamsetty@linux.intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <anshuman.gupta@intel.com>,
<joonas.lahtinen@linux.intel.com>, <simona.vetter@ffwll.ch>,
<airlied@gmail.com>, <pratik.bari@intel.com>,
<joshua.santosh.ranjan@intel.com>,
<ashwin.kumar.kulkarni@intel.com>, <shubham.kumar@intel.com>,
<ravi.kishore.koppuravuri@intel.com>,
<maarten.lankhorst@linux.intel.com>,
<mallesh.koujalagi@intel.com>, <soham.purkait@intel.com>,
Zack McKevitt <zachary.mckevitt@oss.qualcomm.com>,
Lijo Lazar <lijo.lazar@amd.com>,
Hawking Zhang <Hawking.Zhang@amd.com>,
"David S. Miller" <davem@davemloft.net>,
Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>,
<dri-devel@lists.freedesktop.org>, <netdev@vger.kernel.org>
Subject: Re: [PATCH v4 1/3] drm/drm_ras: Add drm_ras netlink error event
Date: Thu, 9 Jul 2026 10:45:27 +0530 [thread overview]
Message-ID: <d96a4c3f-e0e7-42d7-bb8a-994b2f408dea@intel.com> (raw)
In-Reply-To: <ak6xThf9qeB0wqgK@intel.com>
On 09-07-2026 01:51, Rodrigo Vivi wrote:
> On Tue, Jul 07, 2026 at 12:02:11PM +0530, Tauro, Riana wrote:
>> Hi Rodrigo/Jakub/Aravind
>>
>> Please let me know if you have any feedback for this patch or can you please
>> ack this if it looks good to you.
> I looks good to me, but could you please double check the sashiko's comments?
Sashiko has a comment regarding namespaces
[Severity: Medium]Since the generic netlink family explicitly supports
multiple networknamespaces by setting .netnsok = true,
will hardcoding init_net hereprevent listeners in non-init namespaces
from receiving error events
.netnsok = true is auto generated not explicitly added in code.
But from what i see, drm device is present in the host and not
replicated across namespaces
and most of the non-network implementations use inet. (ex: Binder)
If this really needs a fix, we can drop the has_listeners suggested by
raag in previous patch.
I don't think in an error path, allocating a new buffer would be a big
overhead if listeners are not present.
@Raag let me know your thoughts.
The 3rd patch can be floated seperately, I can drop it before merging
and resend if i can get an ack for this
patch
Thanks
Riana
>
> Patch 3 still needs review I believe, then we get Jakub and drm maintainers acks
> to get this through drm-xe-next.
>
> Thanks,
> Rodrigo.
>
>> Thanks
>> Riana
>>
>> On 01-07-2026 15:14, Riana Tauro wrote:
>>> Define a new netlink event 'error-event' and a new multicast group
>>> 'error-report' in drm_ras. Each event contains device name, node and
>>> error information to identify the error triggering the event.
>>>
>>> Add drm_ras_nl_error_event() to trigger an event from the driver.
>>> Userspace must subscribe to 'error-report' to receive 'error-event'
>>> notifications.
>>>
>>> Usage:
>>>
>>> $ sudo ynl --family drm_ras --subscribe error-report
>>>
>>> Cc: Jakub Kicinski <kuba@kernel.org>
>>> Cc: Zack McKevitt <zachary.mckevitt@oss.qualcomm.com>
>>> Cc: Lijo Lazar <lijo.lazar@amd.com>
>>> Cc: Hawking Zhang <Hawking.Zhang@amd.com>
>>> Cc: David S. Miller <davem@davemloft.net>
>>> Cc: Paolo Abeni <pabeni@redhat.com>
>>> Cc: Eric Dumazet <edumazet@google.com>
>>> Signed-off-by: Riana Tauro <riana.tauro@intel.com>
>>> Reviewed-by: Raag Jadav <raag.jadav@intel.com>
>>> ---
>>> v2: remove redundant initialization
>>> remove unnecessary space
>>> use ynl in commit message and doc (Raag)
>>> simplify doc for error-event attrs
>>>
>>> v3: rename error-notify to error-report
>>> Replace notify with report across the file (Raag)
>>> ---
>>> Documentation/gpu/drm-ras.rst | 21 ++++++
>>> Documentation/netlink/specs/drm_ras.yaml | 48 +++++++++++++
>>> drivers/gpu/drm/drm_ras.c | 87 ++++++++++++++++++++++++
>>> drivers/gpu/drm/drm_ras_nl.c | 6 ++
>>> drivers/gpu/drm/drm_ras_nl.h | 4 ++
>>> include/drm/drm_ras.h | 5 ++
>>> include/uapi/drm/drm_ras.h | 15 ++++
>>> 7 files changed, 186 insertions(+)
>>>
>>> diff --git a/Documentation/gpu/drm-ras.rst b/Documentation/gpu/drm-ras.rst
>>> index 83c21853b74b..406e4c49bac1 100644
>>> --- a/Documentation/gpu/drm-ras.rst
>>> +++ b/Documentation/gpu/drm-ras.rst
>>> @@ -56,6 +56,7 @@ User space tools can:
>>> ``node-id`` and ``error-id`` as parameters.
>>> * Clear specific error counters with the ``clear-error-counter`` command, using both
>>> ``node-id`` and ``error-id`` as parameters.
>>> +* Subscribe to the ``error-report`` multicast group to receive ``error-event``.
>>> YAML-based Interface
>>> --------------------
>>> @@ -111,3 +112,23 @@ Example: Clear an error counter for a given node
>>> sudo ynl --family drm_ras --do clear-error-counter --json '{"node-id":0, "error-id":1}'
>>> None
>>> +
>>> +Example: Subscribe to ``error-report`` multicast group
>>> +
>>> +.. code-block:: bash
>>> +
>>> + sudo ynl --family drm_ras --output-json --subscribe error-report
>>> +
>>> +.. code-block:: json
>>> +
>>> + {
>>> + "name": "error-event",
>>> + "msg": {
>>> + "device-name": "0000:03:00.0",
>>> + "node-id": 1,
>>> + "node-name": "uncorrectable-errors",
>>> + "error-id": 1,
>>> + "error-name": "error_name1",
>>> + "error-value": 1
>>> + }
>>> + }
>>> diff --git a/Documentation/netlink/specs/drm_ras.yaml b/Documentation/netlink/specs/drm_ras.yaml
>>> index e113056f8c01..8aed3d4515e5 100644
>>> --- a/Documentation/netlink/specs/drm_ras.yaml
>>> +++ b/Documentation/netlink/specs/drm_ras.yaml
>>> @@ -69,6 +69,33 @@ attribute-sets:
>>> name: error-value
>>> type: u32
>>> doc: Current value of the requested error counter.
>>> + -
>>> + name: error-event-attrs
>>> + attributes:
>>> + -
>>> + name: device-name
>>> + type: string
>>> + doc: Device (PCI BDF, UUID) that reported the error.
>>> + -
>>> + name: node-id
>>> + type: u32
>>> + doc: ID of the node that reported the error.
>>> + -
>>> + name: node-name
>>> + type: string
>>> + doc: Name of the node that reported the error.
>>> + -
>>> + name: error-id
>>> + type: u32
>>> + doc: ID of the error counter.
>>> + -
>>> + name: error-name
>>> + type: string
>>> + doc: Name of the error.
>>> + -
>>> + name: error-value
>>> + type: u32
>>> + doc: Current value of the error counter.
>>> operations:
>>> list:
>>> @@ -124,3 +151,24 @@ operations:
>>> do:
>>> request:
>>> attributes: *id-attrs
>>> + -
>>> + name: error-event
>>> + doc: >-
>>> + Report an error event to userspace.
>>> + The event includes the device, node and error information
>>> + of the error that triggered the event.
>>> + attribute-set: error-event-attrs
>>> + mcgrp: error-report
>>> + event:
>>> + attributes:
>>> + - device-name
>>> + - node-id
>>> + - node-name
>>> + - error-id
>>> + - error-name
>>> + - error-value
>>> +
>>> +mcast-groups:
>>> + list:
>>> + -
>>> + name: error-report
>>> diff --git a/drivers/gpu/drm/drm_ras.c b/drivers/gpu/drm/drm_ras.c
>>> index d6eab29a1394..77f912a4d101 100644
>>> --- a/drivers/gpu/drm/drm_ras.c
>>> +++ b/drivers/gpu/drm/drm_ras.c
>>> @@ -41,6 +41,11 @@
>>> * Userspace must provide Node ID, Error ID.
>>> * Clears specific error counter of a node if supported.
>>> *
>>> + * 4. ERROR_REPORT: Subscribe to this multicast group to receive error events
>>> + *
>>> + * 5. ERROR_EVENT: Report an error event to userspace. The event contains device, node
>>> + * and error information that triggered the event.
>>> + *
>>> * Node registration:
>>> *
>>> * - drm_ras_node_register(): Registers a new node and assigns
>>> @@ -186,6 +191,34 @@ static int msg_reply_value(struct sk_buff *msg, u32 error_id,
>>> value);
>>> }
>>> +static int msg_put_error_event_attrs(struct sk_buff *msg, struct drm_ras_node *node,
>>> + u32 error_id, const char *error_name, u32 value)
>>> +{
>>> + int ret;
>>> +
>>> + ret = nla_put_string(msg, DRM_RAS_A_ERROR_EVENT_ATTRS_DEVICE_NAME, node->device_name);
>>> + if (ret)
>>> + return ret;
>>> +
>>> + ret = nla_put_u32(msg, DRM_RAS_A_ERROR_EVENT_ATTRS_NODE_ID, node->id);
>>> + if (ret)
>>> + return ret;
>>> +
>>> + ret = nla_put_string(msg, DRM_RAS_A_ERROR_EVENT_ATTRS_NODE_NAME, node->node_name);
>>> + if (ret)
>>> + return ret;
>>> +
>>> + ret = nla_put_u32(msg, DRM_RAS_A_ERROR_EVENT_ATTRS_ERROR_ID, error_id);
>>> + if (ret)
>>> + return ret;
>>> +
>>> + ret = nla_put_string(msg, DRM_RAS_A_ERROR_EVENT_ATTRS_ERROR_NAME, error_name);
>>> + if (ret)
>>> + return ret;
>>> +
>>> + return nla_put_u32(msg, DRM_RAS_A_ERROR_EVENT_ATTRS_ERROR_VALUE, value);
>>> +}
>>> +
>>> static int doit_reply_value(struct genl_info *info, u32 node_id,
>>> u32 error_id)
>>> {
>>> @@ -222,6 +255,60 @@ static int doit_reply_value(struct genl_info *info, u32 node_id,
>>> return genlmsg_reply(msg, info);
>>> }
>>> +/**
>>> + * drm_ras_nl_error_event() - Report an error event
>>> + * @node: Node structure
>>> + * @error_id: ID of the error
>>> + * @error_name: Name of the error
>>> + * @value: Value associated with the error
>>> + * @flags: GFP flags for memory allocation
>>> + *
>>> + * Report an error-event to userspace using the error-report multicast group.
>>> + *
>>> + * Return: 0 on success, or negative errno on failure.
>>> + */
>>> +int drm_ras_nl_error_event(struct drm_ras_node *node, u32 error_id, const char *error_name,
>>> + u32 value, gfp_t flags)
>>> +{
>>> + struct genl_info info;
>>> + struct sk_buff *msg;
>>> + struct nlattr *hdr;
>>> + int ret;
>>> +
>>> + if (!error_name)
>>> + return -EINVAL;
>>> +
>>> + if (!genl_has_listeners(&drm_ras_nl_family, &init_net, DRM_RAS_NLGRP_ERROR_REPORT))
>>> + return 0;
>>> +
>>> + genl_info_init_ntf(&info, &drm_ras_nl_family, DRM_RAS_CMD_ERROR_EVENT);
>>> +
>>> + msg = genlmsg_new(NLMSG_GOODSIZE, flags);
>>> + if (!msg)
>>> + return -ENOMEM;
>>> +
>>> + hdr = genlmsg_iput(msg, &info);
>>> + if (!hdr) {
>>> + ret = -EMSGSIZE;
>>> + goto free_msg;
>>> + }
>>> +
>>> + ret = msg_put_error_event_attrs(msg, node, error_id, error_name, value);
>>> + if (ret)
>>> + goto cancel_msg;
>>> +
>>> + genlmsg_end(msg, hdr);
>>> + genlmsg_multicast(&drm_ras_nl_family, msg, 0, DRM_RAS_NLGRP_ERROR_REPORT, flags);
>>> + return 0;
>>> +
>>> +cancel_msg:
>>> + genlmsg_cancel(msg, hdr);
>>> +free_msg:
>>> + nlmsg_free(msg);
>>> + return ret;
>>> +}
>>> +EXPORT_SYMBOL(drm_ras_nl_error_event);
>>> +
>>> /**
>>> * drm_ras_nl_get_error_counter_dumpit() - Dump all Error Counters
>>> * @skb: Netlink message buffer
>>> diff --git a/drivers/gpu/drm/drm_ras_nl.c b/drivers/gpu/drm/drm_ras_nl.c
>>> index dea1c1b2494e..9d3123cc9f9c 100644
>>> --- a/drivers/gpu/drm/drm_ras_nl.c
>>> +++ b/drivers/gpu/drm/drm_ras_nl.c
>>> @@ -58,6 +58,10 @@ static const struct genl_split_ops drm_ras_nl_ops[] = {
>>> },
>>> };
>>> +static const struct genl_multicast_group drm_ras_nl_mcgrps[] = {
>>> + [DRM_RAS_NLGRP_ERROR_REPORT] = { "error-report", },
>>> +};
>>> +
>>> struct genl_family drm_ras_nl_family __ro_after_init = {
>>> .name = DRM_RAS_FAMILY_NAME,
>>> .version = DRM_RAS_FAMILY_VERSION,
>>> @@ -66,4 +70,6 @@ struct genl_family drm_ras_nl_family __ro_after_init = {
>>> .module = THIS_MODULE,
>>> .split_ops = drm_ras_nl_ops,
>>> .n_split_ops = ARRAY_SIZE(drm_ras_nl_ops),
>>> + .mcgrps = drm_ras_nl_mcgrps,
>>> + .n_mcgrps = ARRAY_SIZE(drm_ras_nl_mcgrps),
>>> };
>>> diff --git a/drivers/gpu/drm/drm_ras_nl.h b/drivers/gpu/drm/drm_ras_nl.h
>>> index a398643572a5..03ec275aca92 100644
>>> --- a/drivers/gpu/drm/drm_ras_nl.h
>>> +++ b/drivers/gpu/drm/drm_ras_nl.h
>>> @@ -21,6 +21,10 @@ int drm_ras_nl_get_error_counter_dumpit(struct sk_buff *skb,
>>> int drm_ras_nl_clear_error_counter_doit(struct sk_buff *skb,
>>> struct genl_info *info);
>>> +enum {
>>> + DRM_RAS_NLGRP_ERROR_REPORT,
>>> +};
>>> +
>>> extern struct genl_family drm_ras_nl_family;
>>> #endif /* _LINUX_DRM_RAS_GEN_H */
>>> diff --git a/include/drm/drm_ras.h b/include/drm/drm_ras.h
>>> index 0beede3ddc4e..8abfb7d2077b 100644
>>> --- a/include/drm/drm_ras.h
>>> +++ b/include/drm/drm_ras.h
>>> @@ -80,9 +80,14 @@ struct drm_device;
>>> #if IS_ENABLED(CONFIG_DRM_RAS)
>>> 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, gfp_t flags);
>>> #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, gfp_t flags)
>>> +{ return 0; }
>>> #endif
>>> #endif
>>> diff --git a/include/uapi/drm/drm_ras.h b/include/uapi/drm/drm_ras.h
>>> index 218a3ee86805..eab8231aa87c 100644
>>> --- a/include/uapi/drm/drm_ras.h
>>> +++ b/include/uapi/drm/drm_ras.h
>>> @@ -38,13 +38,28 @@ enum {
>>> 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)
>>> +};
>>> +
>>> enum {
>>> DRM_RAS_CMD_LIST_NODES = 1,
>>> DRM_RAS_CMD_GET_ERROR_COUNTER,
>>> DRM_RAS_CMD_CLEAR_ERROR_COUNTER,
>>> + DRM_RAS_CMD_ERROR_EVENT,
>>> __DRM_RAS_CMD_MAX,
>>> DRM_RAS_CMD_MAX = (__DRM_RAS_CMD_MAX - 1)
>>> };
>>> +#define DRM_RAS_MCGRP_ERROR_REPORT "error-report"
>>> +
>>> #endif /* _UAPI_LINUX_DRM_RAS_H */
next prev parent reply other threads:[~2026-07-09 5:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 9:44 [PATCH v4 0/3] Add drm_ras netlink error event support Riana Tauro
2026-07-01 9:44 ` [PATCH v4 1/3] drm/drm_ras: Add drm_ras netlink error event Riana Tauro
2026-07-07 6:32 ` Tauro, Riana
2026-07-08 20:21 ` Rodrigo Vivi
2026-07-09 5:15 ` Tauro, Riana [this message]
2026-07-09 9:22 ` Raag Jadav
2026-07-01 9:44 ` [PATCH v4 2/3] drm/xe/xe_drm_ras: Add error-event support for PVC Riana Tauro
2026-07-01 9:44 ` [PATCH v4 3/3] drm/xe/xe_ras: Add error-event support for CRI Riana Tauro
2026-07-09 10:04 ` Raag Jadav
2026-07-01 10:52 ` ✓ CI.KUnit: success for Add drm_ras netlink error event support (rev4) Patchwork
2026-07-01 11:32 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-02 3:52 ` ✓ 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=d96a4c3f-e0e7-42d7-bb8a-994b2f408dea@intel.com \
--to=riana.tauro@intel.com \
--cc=Hawking.Zhang@amd.com \
--cc=airlied@gmail.com \
--cc=anshuman.gupta@intel.com \
--cc=aravind.iddamsetty@linux.intel.com \
--cc=ashwin.kumar.kulkarni@intel.com \
--cc=davem@davemloft.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=edumazet@google.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=joonas.lahtinen@linux.intel.com \
--cc=joshua.santosh.ranjan@intel.com \
--cc=kuba@kernel.org \
--cc=lijo.lazar@amd.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mallesh.koujalagi@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pratik.bari@intel.com \
--cc=raag.jadav@intel.com \
--cc=ravi.kishore.koppuravuri@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=shubham.kumar@intel.com \
--cc=simona.vetter@ffwll.ch \
--cc=soham.purkait@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