kunit: irq: Unregister on-stack timer and work from debugobjects
Subsystems (2)
PATCH 1/1 kunit: irq: Unregister on-stack timer and work from debugobjects
In kunit_run_irq_test(), call destroy_hrtimer_on_stack() and destroy_work_on_stack() to unregister the hrtimer and work from the debugobjects infrastructure (when CONFIG_DEBUG_OBJECTS_TIMERS=y and CONFIG_DEBUG_OBJECTS_WORK=y) before the function returns.
Found via code review; the lack of the unregistrations didn't actually cause a warning, since the objects are inactive upon return anyway. But they should be there, otherwise debugobjects keeps tracking the objects.
---
This patch is targeting libcrypto-next
include/kunit/run-in-irq-context.h | 2 ++ 1 file changed, 2 insertions(+)
include/kunit/run-in-irq-context.h +2 -0
@@ -137,6 +137,8 @@ static inline void kunit_run_irq_test(struct kunit *test, bool (*func)(void *),/* Cancel the timer and work. */ hrtimer_cancel (&state.timer);flush_work (&state.bh_work); +destroy_hrtimer_on_stack (&state.timer); +destroy_work_on_stack (&state.bh_work);/* Sanity check: the timer and BH functions should have been run. */ KUNIT_EXPECT_GT_MSG(test, atomic_read(&state.hardirq_func_calls), 0,
base-commit: 4bceb5614e0fc0338d6787f39df5472bfd72eaab
Signature · 1 line
2.55.0
Le 06/08/2026 à 1:38 PM, Eric Biggers a écrit :
Quoted 9 lines
In
kunit_run_irq_test(), calldestroy_hrtimer_on_stack()anddestroy_work_on_stack()to unregister the hrtimer and work from the debugobjects infrastructure (whenCONFIG_DEBUG_OBJECTS_TIMERS=yandCONFIG_DEBUG_OBJECTS_WORK=y) before the function returns.Found via code review; the lack of the unregistrations didn't actually cause a warning, since the objects are inactive upon return anyway. But they should be there, otherwise debugobjects keeps tracking the objects.
Quoted 5 lines
Fixes 950a81224e8b ("lib/crypto: tests: Add hash-test-template.h and gen-hash-testvecs.py")Signed-off-by Eric Biggers <[email protected]>---
This patch is targeting libcrypto-next
Nice catch, thanks!
Cheers,
-- David
Quoted 19 lines
include/kunit/run-in-irq-context.h | 2 ++ 1 file changed, 2 insertions(+)include/kunit/run-in-irq-context.h +2
-0@@ -137,6 +137,8 @@ static inline void kunit_run_irq_test(struct kunit *test, bool (*func)(void *),/* Cancel the timer and work. */ hrtimer_cancel (&state.timer);flush_work (&state.bh_work); +destroy_hrtimer_on_stack (&state.timer); +destroy_work_on_stack (&state.bh_work);/* Sanity check: the timer and BH functions should have been run. */ KUNIT_EXPECT_GT_MSG(test, atomic_read(&state.hardirq_func_calls), 0,base-commit:
4bceb5614e0fc0338d6787f39df5472bfd72eaab
Eric Biggers
AppliedQuoted 9 lines · Eric Biggers
In
kunit_run_irq_test(), calldestroy_hrtimer_on_stack()anddestroy_work_on_stack()to unregister the hrtimer and work from the debugobjects infrastructure (whenCONFIG_DEBUG_OBJECTS_TIMERS=yandCONFIG_DEBUG_OBJECTS_WORK=y) before the function returns.Found via code review; the lack of the unregistrations didn't actually cause a warning, since the objects are inactive upon return anyway. But they should be there, otherwise debugobjects keeps tracking the objects.
Quoted 5 lines
Fixes 950a81224e8b ("lib/crypto: tests: Add hash-test-template.h and gen-hash-testvecs.py")Signed-off-by Eric Biggers <[email protected]>---
This patch is targeting libcrypto-next
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/log/?h=libcrypto-next
- Eric