Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jia He" <justin.he@arm.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 1/7] init/initramfs_test: wait_for_initramfs() before running
Date: Thu, 14 May 2026 12:29:46 +0000	[thread overview]
Message-ID: <20260514122946.C5F75C2BCB3@smtp.kernel.org> (raw)
In-Reply-To: <20260514050455.2954509-2-justin.he@arm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The patch uses the per-test `.init` KUnit callback instead of the suite-level `.suite_init` callback.
--

commit 28e6f37006ed9a359c88f36fcc58752b6f3eb78e
Author: Jia He <justin.he@arm.com>

init/initramfs_test: wait_for_initramfs() before running

The commit introduces a wait_for_initramfs() call to ensure the boot-time
async do_populate_rootfs() is complete before the initramfs kunit tests run.
This prevents a race condition where the boot-time unpacker and the test
unpacker corrupt each other's module-static state.

> diff --git a/init/initramfs_test.c b/init/initramfs_test.c
> index 2ce38d9a8fd0f..eb76f63f302e0 100644
> --- a/init/initramfs_test.c
> +++ b/init/initramfs_test.c

[ ... ]

> @@ -510,8 +512,21 @@ static struct kunit_case __refdata initramfs_test_cases[] = {
>  	{},
>  };
>  
> -static struct kunit_suite initramfs_test_suite = {
> +static int __init initramfs_test_init(struct kunit *test)
> +{
> +	/*
> +	 * unpack_to_rootfs() uses module-static state (victim, byte_count,
> +	 * state, ...). The boot-time async do_populate_rootfs() may still be
> +	 * running, so wait for it to finish before we call unpack_to_rootfs()
> +	 * from the test thread, otherwise the two writers race and crash.
> +	 */
> +	wait_for_initramfs();
> +	return 0;
> +}
> +
> +static struct kunit_suite __refdata initramfs_test_suite = {
>  	.name = "initramfs",
> +	.init = initramfs_test_init,

The commit message notes this is added so the async unpack is quiescent
"before the first case runs". Should this be using .suite_init instead of
.init?

The .init callback is invoked by KUnit before every individual test case,
meaning wait_for_initramfs() will be called once for each of the test cases.

While functionally harmless since subsequent calls return instantly,
.suite_init is designed for one-time suite-level initialization and seems to
better match the intent.

>  	.test_cases = initramfs_test_cases,
>  };
>  kunit_test_init_section_suites(&initramfs_test_suite);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260514050455.2954509-1-justin.he@arm.com?part=1

  parent reply	other threads:[~2026-05-14 12:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-14  5:04 [PATCH 0/7] Silence spurious warnings and crashes from kunit test suites Jia He
2026-05-14  5:04 ` [PATCH 1/7] init/initramfs_test: wait_for_initramfs() before running Jia He
2026-05-14  5:58   ` David Disseldorp
2026-05-14 12:29   ` sashiko-bot [this message]
2026-05-14  5:04 ` [PATCH 2/7] kfence: kunit: skip when no pool is available Jia He
2026-05-14  7:54   ` Marco Elver
2026-05-14  5:04 ` [PATCH 3/7] lib/math/int_log: drop WARN_ON for value == 0 Jia He
2026-05-14  5:04 ` [PATCH 4/7] kunit: platform: catch duplicate (name, id) in kunit_platform_device_add() Jia He
2026-05-14  5:04 ` [PATCH 5/7] misc: reject duplicate names in misc_register() Jia He
2026-05-14  7:00   ` Greg Kroah-Hartman
2026-05-14  7:25     ` Justin He
2026-05-14  5:04 ` [PATCH 6/7] hw_breakpoint_test: fix test_many_cpus failure on large systems Jia He
2026-05-14  8:01   ` Marco Elver
2026-05-14  5:04 ` [PATCH 7/7] lib/tests: test_ratelimit: fix stress test thread lifecycle and leak Jia He
2026-05-14  7:02 ` [PATCH 0/7] Silence spurious warnings and crashes from kunit test suites Greg Kroah-Hartman
2026-05-14  7:17   ` Justin He

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=20260514122946.C5F75C2BCB3@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=justin.he@arm.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.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