From: "Tauro, Riana" <riana.tauro@intel.com>
To: Raag Jadav <raag.jadav@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
<dri-devel@lists.freedesktop.org>, <netdev@vger.kernel.org>,
<aravind.iddamsetty@linux.intel.com>, <anshuman.gupta@intel.com>,
<rodrigo.vivi@intel.com>, <joonas.lahtinen@linux.intel.com>,
<kuba@kernel.org>, <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>,
Michal Wajdeczko <michal.wajdeczko@intel.com>
Subject: Re: [PATCH v5 2/3] drm/xe/xe_ras: Report correctable error events to userspace
Date: Wed, 22 Jul 2026 10:08:01 +0530 [thread overview]
Message-ID: <06623acf-e89c-4410-8621-a86d1afe0f5d@intel.com> (raw)
In-Reply-To: <al-neyeoG873l1xX@black.igk.intel.com>
On 21-07-2026 22:38, Raag Jadav wrote:
> On Tue, Jul 21, 2026 at 06:52:51PM +0530, Tauro, Riana wrote:
>> On 21-07-2026 14:07, Raag Jadav wrote:
>>> On Mon, Jul 20, 2026 at 01:52:11PM +0530, Riana Tauro wrote:
>>>> When an interrupt is received indicating that error counter has crossed
>>>> its threshold, read the current counter value and deliver a drm_ras error
>>>> event to userspace for each affected component.
>>>>
>>>> To avoid sending duplicate events when the same component appears multiple
>>>> times in the response. Send the error-event once per component.
>>> ...
>>>
>>>> +void xe_drm_ras_event(struct xe_device *xe, u8 component, u8 severity, u32 value)
>>>> +{
>>>> + struct xe_drm_ras *ras = &xe->ras;
>>>> + struct xe_drm_ras_counter *info;
>>>> + struct drm_ras_node *node;
>>>> + int ret;
>>>> +
>>>> + /* Event is supported only if drm_ras is enabled */
>>>> + if (!xe->info.has_drm_ras)
>>>> + return;
>>>> +
>>>> + if (component >= DRM_XE_RAS_ERR_COMP_MAX) {
>>> IIUC this is error_id and should be validated against first/last counter
>>> range in drm_ras layer (similar to registration code).
>> This should be done before because we are accessing the nodes here.
>> The nodes anyway won't be available in xe_drm_ras if not registered with
>> drm_ras.
> Yes. We get the node from severity which we already validate here, but
> error_counter_range is the property of the node and unrelated to xe.
> Even if you prefer it here, these checks must be in core functions to
> make sure they are not abused.
But here we are searching for already registered nodes with drm_ras.
So registered nodes are already range checked. The only reason of adding
this here was to avoid
array out of bounds.
Agreed will remove the check since patch [1] is taking care of the check
before
it reaches this function.
>
>>>> + drm_warn(&xe->drm, "unsupported component %u\n", component);
>>>> + return;
>>>> + }
>>>> +
>>>> + if (severity >= DRM_XE_RAS_ERR_SEV_MAX) {
>>>> + drm_warn(&xe->drm, "unsupported severity %u\n", severity);
>>>> + return;
>>>> + }
>>>> +
>>>> + node = &ras->node[severity];
>>>> + info = ras->info[severity];
>>>> +
>>>> + if (!info || !info[component].name)
>>>> + return;
>>>> +
>>>> + ret = drm_ras_nl_error_event(node, component, info[component].name, value);
>>>> + if (ret)
>>>> + drm_err_ratelimited(&xe->drm, "drm_ras error-event failed: %d for %s %s\n", ret,
>>>> + info[component].name, error_severity[severity]);
>>>> +}
>>> ...
>>>
>>>> +static void ras_send_error_event(struct xe_device *xe, u8 severity, u8 component)
>>>> +{
>>>> + struct xe_ras_error_class counter = {0};
>>>> + u8 drm_severity, drm_component;
>>>> + u32 value;
>>>> + int ret;
>>>> +
>>>> + counter.common.severity = severity;
>>>> + counter.common.component = component;
>>>> +
>>>> + ret = get_counter(xe, &counter, &value);
>>>> + if (ret)
>>>> + return;
>>>> +
>>>> + drm_severity = xe_to_drm_ras_severity(severity);
>>>> + drm_component = xe_to_drm_ras_component(component);
>>>> +
>>>> + xe_drm_ras_event(xe, drm_component, drm_severity, value);
>>>> +}
>>> This entire function can be dropped. See below.
>> We don't need to drop function. It's cleaner to have it in the function
>> than repeating it twice.
> I thought we'd lay the groundwork for cper which'll also need get_counter()
> in the same path, but upto you.
confused. CPER requires a get counter on a detailed error_class. Unlike
here which is a aggregated class
and is called once per component.
So would retain the function and remove the severity and component checks.
Thanks
Riana
> Raag
next prev parent reply other threads:[~2026-07-22 4:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 8:22 [PATCH v5 0/3] Add drm_ras netlink error event support Riana Tauro
2026-07-20 8:22 ` [PATCH v5 1/3] drm/drm_ras: Add drm_ras netlink error event Riana Tauro
2026-07-21 6:02 ` Raag Jadav
2026-07-21 6:19 ` Tauro, Riana
2026-07-20 8:22 ` [PATCH v5 2/3] drm/xe/xe_ras: Report correctable error events to userspace Riana Tauro
2026-07-21 8:37 ` Raag Jadav
2026-07-21 13:22 ` Tauro, Riana
2026-07-21 17:08 ` Raag Jadav
2026-07-22 4:38 ` Tauro, Riana [this message]
2026-07-20 8:22 ` [PATCH v5 3/3] drm/xe/xe_ras: Report uncorrectable " Riana Tauro
2026-07-21 8:40 ` Raag Jadav
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=06623acf-e89c-4410-8621-a86d1afe0f5d@intel.com \
--to=riana.tauro@intel.com \
--cc=airlied@gmail.com \
--cc=anshuman.gupta@intel.com \
--cc=aravind.iddamsetty@linux.intel.com \
--cc=ashwin.kumar.kulkarni@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=joonas.lahtinen@linux.intel.com \
--cc=joshua.santosh.ranjan@intel.com \
--cc=kuba@kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mallesh.koujalagi@intel.com \
--cc=michal.wajdeczko@intel.com \
--cc=netdev@vger.kernel.org \
--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 \
/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