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: accel/amdxdna: Reduce log noise during process termination
Date: Wed, 11 Feb 2026 16:21:02 +1000	[thread overview]
Message-ID: <review-patch2-20260210164521.1094274-3-mario.limonciello@amd.com> (raw)
In-Reply-To: <20260210164521.1094274-3-mario.limonciello@amd.com>

Patch Review

**Summary:** Reasonable intent but implementation could be improved.

**Issues:**

1. **Inconsistent error code checking pattern:**

In `aie2_ctx.c`:
```c
-	if (ret)
+	if (ret && ret != -ENODEV)
		XDNA_ERR(xdna, "Destroy temporal only context failed, ret %d", ret);
```

This silently swallows `-ENODEV` errors even though the function description says they should be downgraded to debug level. There's no debug message added here unlike in the other locations.

2. **Logic error in dma_resv_wait_timeout handling:**

```c
ret = dma_resv_wait_timeout(gobj->resv, DMA_RESV_USAGE_BOOKKEEP,
			    true, MAX_SCHEDULE_TIMEOUT);
-	if (!ret || ret == -ERESTARTSYS)
+	if (!ret)
	XDNA_ERR(xdna, "Failed to wait for bo, ret %ld", ret);
+	else if (ret == -ERESTARTSYS)
+		XDNA_DBG(xdna, "Wait for bo interrupted by signal");
```

The `dma_resv_wait_timeout()` function returns:
- `> 0`: Success (remaining timeout in jiffies)
- `0`: Timeout
- `< 0`: Error code

The original code treated both timeout (`!ret`) and signal interruption (`-ERESTARTSYS`) as errors. The new code only prints an error for timeout but adds debug for signals. However, there's a subtle issue: what if there are other error codes besides `-ERESTARTSYS`? They would be silently ignored. A better pattern would be:

```c
if (ret > 0) {
	// Success - do nothing
} else if (ret == 0) {
	XDNA_ERR(xdna, "Timeout waiting for bo");
} else if (ret == -ERESTARTSYS) {
	XDNA_DBG(xdna, "Wait for bo interrupted by signal");  
} else {
	XDNA_ERR(xdna, "Failed to wait for bo, ret %ld", ret);
}
```

3. **Same Fixes tag issue:**

```
Fixes: 97f27573837e ("accel/amdxdna: Fix potential NULL pointer dereference in context cleanup")
```

This tag references a commit that doesn't seem to be the root cause of log noise - it's the NULL pointer fix. The Fixes tag should reference the commit that introduced the noisy logging, not the previous patch in this series.

4. **Missing context in commit message:**

The commit message doesn't explain *how* the submitter determined these are "expected" conditions. For example:
- How often does `-ERESTARTSYS` occur during normal termination?
- Are there cases where `-ERESTARTSYS` indicates a real problem?
- Same questions for `-ENODEV`

**Positive aspects:**

- The intent is correct - reducing log noise for expected conditions
- The debug messages are informative
- Reviewed-by tag from Lizhi Hou shows maintainer approval (for this patch specifically)

**Recommendation:**

This patch should be reworked to:
1. Add consistent debug logging for all downgraded errors
2. Fix the error handling logic in `aie2_hmm_invalidate()`  
3. Correct the Fixes tag
4. Provide more context about when these conditions occur

---
Generated by Claude Code Patch Reviewer

  parent reply	other threads:[~2026-02-11  6:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-10 16:42 [PATCH 0/2] amdxdna: fixes for closing a process Mario Limonciello
2026-02-10 16:42 ` [PATCH 1/2] accel/amdxdna: Fix NULL pointer dereference in mailbox channel cleanup Mario Limonciello
2026-02-10 17:17   ` Lizhi Hou
2026-02-11  6:21   ` Claude review: " Claude Code Review Bot
2026-02-10 16:42 ` [PATCH 2/2] accel/amdxdna: Reduce log noise during process termination Mario Limonciello
2026-02-10 17:20   ` Lizhi Hou
2026-02-11  6:21   ` Claude Code Review Bot [this message]
2026-02-11  6:21 ` Claude review: amdxdna: fixes for closing a process 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-patch2-20260210164521.1094274-3-mario.limonciello@amd.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