public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/xe/xe_drm_ras: Add error-event support in XE DRM RAS
Date: Thu, 12 Mar 2026 07:06:13 +1000	[thread overview]
Message-ID: <review-patch4-20260311102913.3387468-10-riana.tauro@intel.com> (raw)
In-Reply-To: <20260311102913.3387468-10-riana.tauro@intel.com>

Patch Review

**Critical concern — `error_id` and `ras` variable scope in `gt_hw_error_handler`:**

```c
xe_drm_ras_notify(ras, error_id, severity, GFP_ATOMIC);
```

This is called at the end of `gt_hw_error_handler`. Looking at the patch context, `ras` and `error_id` are local variables in that function. The `error_id` appears to be derived from the error vector processing loop above. However, by the time we reach the notify call at the end of the function (after the loop), `error_id` holds the *last* error ID that was processed. If multiple error IDs triggered simultaneously, only the last one gets notified. This seems like a bug — the notification should likely be inside the loop body, so each error ID triggers its own notification.

**Same concern in `soc_hw_error_handler`:**

```c
xe_drm_ras_notify(ras, error_id, severity, GFP_ATOMIC);
```

Again called after the loop, so only the last processed `error_id` gets notified. The same fix would apply — move the notification inside the error processing loop.

**`GFP_ATOMIC` usage is correct** since both `gt_hw_error_handler` and `soc_hw_error_handler` are called from interrupt context (under `spin_lock_irqsave` in `hw_error_source_handler`).

**`xe_drm_ras_notify` wrapper is thin but useful:**

```c
void xe_drm_ras_notify(struct xe_drm_ras *ras, u32 error_id,
                       const enum drm_xe_ras_error_severity severity, gfp_t flags)
{
    struct drm_ras_node *node = &ras->node[severity];
    drm_ras_error_notify(node, error_id, flags);
}
```

This provides a clean mapping from the XE-specific severity-based node array to the generic DRM RAS node. The `const` on the `severity` parameter in the declaration is unnecessary (it's a value parameter) but harmless.

**Missing bounds check on `severity`:** If an invalid `severity` value is passed, `ras->node[severity]` would access out of bounds. The callers currently pass values derived from `hw_err_to_severity()` which should be safe, but a defensive check wouldn't hurt.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-03-11 21:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-11 10:29 [PATCH 0/4] Add support for clear counter and error event in DRM RAS Riana Tauro
2026-03-11 10:29 ` [PATCH 1/4] drm/drm_ras: Add clear-error-counter netlink command to drm_ras Riana Tauro
2026-03-11 21:06   ` Claude review: " Claude Code Review Bot
2026-03-11 10:29 ` [PATCH 2/4] drm/xe/xe_drm_ras: Add support for clear-error-counter in XE DRM RAS Riana Tauro
2026-03-11 21:06   ` Claude review: " Claude Code Review Bot
2026-03-11 10:29 ` [PATCH 3/4] drm/drm_ras: Add DRM RAS netlink error event notification Riana Tauro
2026-03-11 21:06   ` Claude review: " Claude Code Review Bot
2026-03-11 10:29 ` [PATCH 4/4] drm/xe/xe_drm_ras: Add error-event support in XE DRM RAS Riana Tauro
2026-03-11 21:06   ` Claude Code Review Bot [this message]
2026-03-11 21:06 ` Claude review: Add support for clear counter and error event in " Claude Code Review Bot

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=review-patch4-20260311102913.3387468-10-riana.tauro@intel.com \
    --to=claude-review@example.com \
    --cc=dri-devel-reviews@example.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