Linux Trace Kernel
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: wen.yang@linux.dev
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v4 4/4] rv/reactors: add KUnit tests for reactor registration and dispatch
Date: Thu, 27 Aug 2026 19:02:25 +0000	[thread overview]
Message-ID: <20260827190226.0DC7A1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <ab4e483f66a7297fb5b9c247964051a7de4a7ab7.1787854397.git.wen.yang@linux.dev>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The test `test_react_callback_invoked` spuriously fails if the global reactor dispatch is disabled via sysfs.
- [Medium] The 5ms busy-wait in `mock_react` is mathematically insufficient to guarantee a timer interrupt on systems with HZ < 200, making the intended lockdep coverage flaky.
--

commit 2f80d797b5152331b6b88a29924dc870e4e2b6a0
Author: Wen Yang <wen.yang@linux.dev>

rv/reactors: add KUnit tests for reactor registration and dispatch

This commit adds KUnit tests for the RV reactor register/unregister lifecycle.
It includes coverage for duplicate registration, name-length rejection, and
verifying that rv_react() correctly dispatches to the callback.

> diff --git a/kernel/trace/rv/rv_reactors_kunit.c b/kernel/trace/rv/rv_reactors_kunit.c
> new file mode 100644
> index 0000000000000..2ccbe55ce4087
> --- /dev/null
> +++ b/kernel/trace/rv/rv_reactors_kunit.c

[ ... ]

> +__printf(1, 0) static void mock_react(const char *msg, va_list args)
> +{
> +	react_call_count++;
> +	/* Busy-wait so a timer interrupt fires inside rv_react(). */
> +	mdelay(5);

[Severity: Medium]
Will this 5ms busy-wait reliably trigger a timer interrupt on systems where
HZ < 200?

On systems configured with HZ=100, where ticks occur every 10ms, a 5ms delay
will only span a timer tick around half the time. Can this lead to flaky test
coverage when trying to exercise the LD_WAIT_SPIN lockdep wait context?

> +}

[ ... ]

> +static void test_react_callback_invoked(struct kunit *test)
> +{
> +	struct rv_monitor monitor = {
> +		.name	= "kunit_dispatch_monitor",
> +		.react	= mock_react,
> +	};
> +
> +	react_call_count = 0;
> +	rv_react(&monitor, "callback invocation test");
> +	KUNIT_EXPECT_EQ(test, react_call_count, 1);

[Severity: Medium]
Can this assertion spuriously fail if the global reacting_on state is
disabled?

If the test executes while the global state is disabled, such as via
/sys/kernel/tracing/rv/reacting_on, rv_react() short-circuits:

kernel/trace/rv/rv_reactors.c:rv_react() {
	...
	if (!rv_reacting_on() || !monitor->react)
		return;
	...
}

Will this cause the test to fail by not invoking the callback at all?

> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1787854397.git.wen.yang@linux.dev?part=4

      reply	other threads:[~2026-08-27 19:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27 18:22 [PATCH v4 0/4] rv/reactors: fix lockdep warning and add KUnit tests wen.yang
2026-08-27 18:22 ` [PATCH v4 1/4] rv/reactors: use LD_WAIT_SPIN as the reactor lockdep wait type wen.yang
2026-08-27 18:36   ` sashiko-bot
2026-08-31  9:48   ` Gabriele Monaco
2026-08-27 18:22 ` [PATCH v4 2/4] rv/reactors: propagate rv_register_reactor() error from reactor init wen.yang
2026-08-27 18:22 ` [PATCH v4 3/4] rv/reactors: export rv_register_reactor() and rv_unregister_reactor() wen.yang
2026-08-27 18:48   ` sashiko-bot
2026-08-27 18:22 ` [PATCH v4 4/4] rv/reactors: add KUnit tests for reactor registration and dispatch wen.yang
2026-08-27 19:02   ` sashiko-bot [this message]

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=20260827190226.0DC7A1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wen.yang@linux.dev \
    /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