From: Florian Schmaus <florian.schmaus@codasip.com>
To: Shuah Khan <shuah@kernel.org>
Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
Florian Schmaus <florian.schmaus@codasip.com>
Subject: [PATCH] selftests: epoll: support KSFT_MACHINE_SLOW / KSFT_TIMEOUT_MUL
Date: Fri, 28 Aug 2026 13:04:47 +0200 [thread overview]
Message-ID: <20260828-selftest-epoll-timeout-v1-1-19d15c405d09@codasip.com> (raw)
In slow or emulated environments, the hardcoded 1-second watchdog
timeout in kill_timeout() can easily expire before threads finish
scheduling and processing events, causing spurious test failures.
Add support for KSFT_MACHINE_SLOW, which is already used in kselftest,
to increase the timeout multiplier to 10x (10 seconds). Furthermore,
allow KSFT_TIMEOUT_MUL to explicitly override the multiplier.
Signed-off-by: Florian Schmaus <florian.schmaus@codasip.com>
---
.../filesystems/epoll/epoll_wakeup_test.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c b/tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c
index 81a994943e12..8d5b15a09439 100644
--- a/tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c
+++ b/tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c
@@ -40,9 +40,29 @@ static void signal_handler(int signum)
{
}
+static unsigned int get_timeout_multiplier(void)
+{
+ const char *mul_str = getenv("KSFT_TIMEOUT_MUL");
+ const char *slow_str = getenv("KSFT_MACHINE_SLOW");
+ unsigned int mul = 1;
+
+ if (slow_str)
+ mul = 10;
+
+ if (mul_str) {
+ int val;
+
+ val = atoi(mul_str);
+ if (val > 0)
+ mul = (unsigned int)val;
+ }
+
+ return mul;
+}
+
static void kill_timeout(struct epoll_mtcontext *ctx)
{
- usleep(1000000);
+ usleep(1000000 * get_timeout_multiplier());
pthread_kill(ctx->main, SIGUSR1);
pthread_kill(ctx->waiter, SIGUSR1);
}
---
base-commit: 1b78070aaef63512688aebfbc82365ef9d6660f1
change-id: 20260828-selftest-epoll-timeout-0d47c17beaa2
Best regards,
--
Florian Schmaus <florian.schmaus@codasip.com>
reply other threads:[~2026-08-28 11:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260828-selftest-epoll-timeout-v1-1-19d15c405d09@codasip.com \
--to=florian.schmaus@codasip.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
/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
all inboxes | Powered by JetHome®