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: bug/kunit: Core support for suppressing warning backtraces
Date: Sat, 16 May 2026 10:56:13 +1000	[thread overview]
Message-ID: <review-patch1-20260514-kunit_add_support-v11-1-b36a530a6d8f@redhat.com> (raw)
In-Reply-To: <20260514-kunit_add_support-v11-1-b36a530a6d8f@redhat.com>

Patch Review

**Overall: Good.** This is the core infrastructure patch and is well-designed.

**`disable_trace_on_warning()` move in `lib/bug.c`:**

The patch moves `disable_trace_on_warning()` to after the suppression check and after the flag extraction block:

```c
+#ifdef CONFIG_KUNIT
+	if (warning && kunit_is_suppressed_warning(true))
+		return BUG_TRAP_TYPE_WARN;
+#endif
+
+	disable_trace_on_warning();
+
 	if (warning && once) {
```

This is correct: suppressed warnings should not disable tracing, and importantly the comment says the check is placed "before the once logic so suppressed warnings do not consume the single-fire budget of WARN_ON_ONCE()." Good design choice.

However, the `disable_trace_on_warning()` move also affects non-KUnit code paths. Previously it ran unconditionally early; now it runs after the flag extraction. This is a minor semantic change for BUG (non-warning) traps — `disable_trace_on_warning()` now runs slightly later but still before any output. Should be harmless but worth noting.

**`#ifdef CONFIG_KUNIT` in `lib/bug.c`:**

```c
+#ifdef CONFIG_KUNIT
+	if (warning && kunit_is_suppressed_warning(true))
+		return BUG_TRAP_TYPE_WARN;
+#endif
```

Using `#ifdef CONFIG_KUNIT` rather than `IS_ENABLED(CONFIG_KUNIT)` is slightly inconsistent with the inline in `test-bug.h` which uses `IS_ENABLED`. However, since `kunit_is_suppressed_warning()` isn't available without the header, and `test-bug.h` provides a stub when `!CONFIG_KUNIT`, this is fine — the `#ifdef` avoids the header include cost for the `!CONFIG_KUNIT` case. But the `#include <kunit/test-bug.h>` is already added unconditionally at the top of `lib/bug.c`, so the `#ifdef` guard is redundant — you could just use the inline stub. This is a style nit, not a bug.

**Race in `kunit_start_suppress_warning`:**

```c
+	if (kunit_has_active_suppress_warning()) {
+		KUNIT_FAIL(test, "Another suppression block is already active");
+		return NULL;
+	}
```

The check-then-act between `kunit_has_active_suppress_warning()` and `list_add_rcu()` is not atomic, but this is fine in practice because KUnit tests run in their own kthread and nesting is explicitly disallowed — two concurrent calls for the same task can't happen.

**`kunit_has_active_suppress_warning()` is exported but not declared in `test.h`:**

The function is declared in `test.h` (line 597 in the patch). Confirmed, this is fine.

**Lifetime management is correct:** `get_task_struct()` pins the task to prevent ABA reuse, and `kunit_add_action_or_reset` ensures cleanup. The `kunit_end_suppress_warning` -> `kunit_release_action` path removes from the list and `put_task_struct`. Good.

**`__kunit_suppress_auto_cleanup` accessing `(*wp)->test`:**

```c
+void __kunit_suppress_auto_cleanup(struct kunit_suppressed_warning **wp)
+{
+	if (*wp)
+		kunit_end_suppress_warning((*wp)->test, *wp);
+}
```

This works because `w->test` is set during `kunit_start_suppress_warning` and remains valid — the test struct outlives the suppression handle. Clean.

**No `EXPORT_SYMBOL_GPL` for `__kunit_is_suppressed_warning_impl`:** This function is not exported, which is correct since it's only called through the hook table indirection. The hook pointer is set in `kunit_install_hooks()` which runs at module init.

---
Generated by Claude Code Patch Reviewer

  parent reply	other threads:[~2026-05-16  0:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-14 11:06 [PATCH v11 0/4] kunit: Add support for suppressing warning backtraces Albert Esteve
2026-05-14 11:06 ` [PATCH v11 1/4] bug/kunit: Core " Albert Esteve
2026-05-15  7:58   ` Albert Esteve
2026-05-16  0:56   ` Claude Code Review Bot [this message]
2026-05-14 11:06 ` [PATCH v11 2/4] kunit: Add backtrace suppression self-tests Albert Esteve
2026-05-15  8:30   ` Albert Esteve
2026-05-16  0:56   ` Claude review: " Claude Code Review Bot
2026-05-14 11:06 ` [PATCH v11 3/4] drm: Suppress intentional warning backtraces in scaling unit tests Albert Esteve
2026-05-16  0:56   ` Claude review: " Claude Code Review Bot
2026-05-14 11:06 ` [PATCH v11 4/4] kunit: Add documentation for warning backtrace suppression API Albert Esteve
2026-05-16  0:56   ` Claude review: " Claude Code Review Bot
2026-05-16  0:56 ` Claude review: kunit: Add support for suppressing warning backtraces Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-05-15 12:29 [PATCH v13 0/4] " Albert Esteve
2026-05-15 12:29 ` [PATCH v13 1/4] bug/kunit: Core " Albert Esteve
2026-05-15 23:18   ` Claude review: " Claude Code Review Bot
2026-05-15  8:52 [PATCH v12 0/4] kunit: Add " Albert Esteve
2026-05-15  8:52 ` [PATCH v12 1/4] bug/kunit: Core " Albert Esteve
2026-05-15 23:36   ` Claude review: " Claude Code Review Bot
2026-05-13  7:30 [PATCH v10 0/4] kunit: Add " Albert Esteve
2026-05-13  7:30 ` [PATCH v10 1/4] bug/kunit: Core " Albert Esteve
2026-05-16  2:29   ` Claude review: " Claude Code Review Bot
2026-05-04  7:41 [PATCH v8 0/4] kunit: Add " Albert Esteve
2026-05-04  7:41 ` [PATCH v8 1/4] bug/kunit: Core " Albert Esteve
2026-05-04 22:33   ` Claude review: " Claude Code Review Bot
2026-04-20 12:28 [PATCH v7 0/5] kunit: Add " Albert Esteve
2026-04-20 12:28 ` [PATCH v7 1/5] bug/kunit: Core " Albert Esteve
2026-04-22 23:52   ` Claude review: " 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-patch1-20260514-kunit_add_support-v11-1-b36a530a6d8f@redhat.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