]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
kunit: irq: Ensure timer doesn't fire too frequently
authorEric Biggers <ebiggers@kernel.org>
Tue, 24 Feb 2026 03:37:51 +0000 (19:37 -0800)
committerEric Biggers <ebiggers@kernel.org>
Tue, 24 Feb 2026 22:44:21 +0000 (14:44 -0800)
commit201ceb94aa1def0024a7c18ce643e5f65026be06
treefab9e3825c96d61f7188d0d707c5ed2d78a08f54
parent6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
kunit: irq: Ensure timer doesn't fire too frequently

Fix a bug where kunit_run_irq_test() could hang if the system is too
slow.  This was noticed with the crypto library tests in certain VMs.

Specifically, if kunit_irq_test_timer_func() and the associated hrtimer
code took over 5us to run, then the CPU would spend all its time
executing that code in hardirq context.  As a result, the task executing
kunit_run_irq_test() never had a chance to run, exit the loop, and
cancel the timer.

To fix it, make kunit_irq_test_timer_func() increase the timer interval
when the other contexts aren't having a chance to run.

Fixes: 950a81224e8b ("lib/crypto: tests: Add hash-test-template.h and gen-hash-testvecs.py")
Cc: stable@vger.kernel.org
Reviewed-by: David Gow <david@davidgow.net>
Link: https://lore.kernel.org/r/20260224033751.97615-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
include/kunit/run-in-irq-context.h