From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: kunit: Add backtrace suppression self-tests Date: Sat, 16 May 2026 09:18:00 +1000 Message-ID: In-Reply-To: <20260515-kunit_add_support-v13-2-18ee42f96e7b@redhat.com> References: <20260515-kunit_add_support-v13-0-18ee42f96e7b@redhat.com> <20260515-kunit_add_support-v13-2-18ee42f96e7b@redhat.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review Good test coverage. Tests exercise: - Direct WARN with message (`backtrace_suppression_test_warn_direct`) - Indirect WARN through a helper (`backtrace_suppression_test_warn_indirect= `) - Multiple warnings in one scope (`backtrace_suppression_test_warn_multi`) - WARN_ON (no format string) (`backtrace_suppression_test_warn_on_direct/in= direct`) - Incremental counting (`backtrace_suppression_test_count`) - Active state transitions (`backtrace_suppression_test_active_state`) - Sequential independent scopes via direct API (`backtrace_suppression_test= _multi_scope`) - Cross-kthread isolation (`backtrace_suppression_test_cross_kthread`) **Cross-kthread test:** ```c +static void backtrace_suppression_test_cross_kthread(struct kunit *test) +{ + struct cross_kthread_data data; + struct task_struct *task; + + data.was_active =3D false; + init_completion(&data.done); + + kunit_warning_suppress(test) { + task =3D kthread_run(cross_kthread_fn, &data, "kunit-cross-test"); + KUNIT_ASSERT_FALSE(test, IS_ERR(task)); + wait_for_completion(&data.done); + kthread_stop(task); + } + + KUNIT_EXPECT_FALSE(test, data.was_active); +} ``` This is well-structured. The `kthread_stop()` is inside the suppress block = so the kthread is guaranteed to be stopped before the suppression scope exi= ts. The `while (!kthread_should_stop()) schedule();` loop in the kthread fu= nction ensures the kthread stays alive until `kthread_stop()` is called, av= oiding use-after-free. **Minor observation:** The helper functions `trigger_backtrace_warn()` and = `trigger_backtrace_warn_on()` are marked `noinline`, which is important =E2= =80=94 without this, the compiler could inline them into the test function,= and on some architectures the WARN path might behave differently with rega= rd to the return address. Good. **No issues found.** --- --- Generated by Claude Code Patch Reviewer