[PATCH v2 next 02/15] kallsyms: Fix selftest startup delay

From: David Laight

Date: Sun Oct 18 2026 - 11:56:00 EST


The kallsym_selftest code clearly intends to sleep until initialisation
is complete in order to get more reproducable timings.

Replace the schedule_timeout() calls with schedule_timeout_idle()
so that the thread actually sleeps.
Poll every second (not every 5) for SYSTEM_RUNNING and then wait
another 10 seconds before starting the tests, otherwise the tests
start as soon an init is executed.

This code is in the initial 2022 import of the tests.

Signed-off-by: David Laight <david.laight.linux@xxxxxxxxx>
---
kernel/kallsyms_selftest.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/kallsyms_selftest.c b/kernel/kallsyms_selftest.c
index 8f6c4e9b3a1c..0db79237fe54 100644
--- a/kernel/kallsyms_selftest.c
+++ b/kernel/kallsyms_selftest.c
@@ -411,9 +411,11 @@ static int test_entry(void *p)
{
int ret;

+ pr_info("waiting\n");
do {
- schedule_timeout(5 * HZ);
+ schedule_timeout_idle(HZ);
} while (system_state != SYSTEM_RUNNING);
+ schedule_timeout_idle(10 * HZ);

pr_info("start\n");
ret = test_kallsyms_basic_function();
--
2.39.5