PI-futex: rt-mutex tester
Subsystems (2)
PATCH 8/10 PI-futex: rt-mutex tester
From: Thomas Gleixner <[email protected]>
RT-mutex tester: scriptable tester for rt mutexes, which allows userspace scripting of mutex unit-tests (and dynamic tests as well), using the actual rt-mutex implementation of the kernel.
----
include/linux/rtmutex_internal.h | 22 + include/linux/sched.h | 1 kernel/Makefile | 1 kernel/rtmutex-tester.c | 436 +++++++++++++++++++++++++++ kernel/rtmutex.c | 3 lib/Kconfig.debug | 7 scripts/rt-tester/check-all.sh | 21 + scripts/rt-tester/rt-tester.py | 222 +++++++++++++ scripts/rt-tester/t2-l1-2rt-sameprio.tst | 101 ++++++ scripts/rt-tester/t2-l1-pi.tst | 84 +++++ scripts/rt-tester/t2-l1-signal.tst | 79 ++++ scripts/rt-tester/t2-l2-2rt-deadlock.tst | 91 +++++ scripts/rt-tester/t3-l1-pi-1rt.tst | 95 +++++ scripts/rt-tester/t3-l1-pi-2rt.tst | 96 +++++ scripts/rt-tester/t3-l1-pi-3rt.tst | 95 +++++ scripts/rt-tester/t3-l1-pi-signal.tst | 98 ++++++ scripts/rt-tester/t3-l1-pi-steal.tst | 99 ++++++ scripts/rt-tester/t3-l2-pi.tst | 95 +++++ scripts/rt-tester/t4-l2-pi-deboost.tst | 127 +++++++ scripts/rt-tester/t5-l4-pi-boost-deboost.tst | 148 +++++++++ 20 files changed, 1920 insertions(+), 1 deletion(-)
include/linux/rtmutex_internal.h +22 -0
@@ -15,6 +15,28 @@#include <linux/rtmutex.h> /* +* The rtmutex in kernel tester is independent of rtmutex debugging. We +* call schedule_rt_mutex_test() instead of schedule() for the tasks which +* belong to the tester. That way we can delay the wakeup path of those +* threads to provoke lock stealing and testing of complex boosting scenarios. +*/ +#ifdef CONFIG_RT_MUTEX_TESTER + +extern void schedule_rt_mutex_test (struct rt_mutex *lock); + +#define schedule_rt_mutex (_lock) \ + do { \ + if (!(current->flags & PF_MUTEX_TESTER)) \ + schedule(); \ + else \ + schedule_rt_mutex_test(_lock); \ + } while (0) + +#else +# define schedule_rt_mutex (_lock) schedule() +#endif + +/* * This is the control structure for tasks blocked on a rt_mutex, * which is allocated on the kernel stack on of the blocked task. *
include/linux/sched.h +1 -0
@@ -981,6 +981,7 @@ static inline void put_task_struct(struc#define PF_SPREAD_PAGE 0x04000000/* Spread page cache over cpuset */ #define PF_SPREAD_SLAB 0x08000000/* Spread some slab caches over cpuset */ #define PF_MEMPOLICY 0x10000000/* Non-default NUMA mempolicy */ +#define PF_MUTEX_TESTER 0x20000000/* Thread belongs to the rt mutex tester */ /* * Only the _current_ task can read/write to tsk->flags, but other
kernel/Makefile +1 -0
@@ -18,6 +18,7 @@ obj-$(CONFIG_FUTEX) += futex_compat.o endif obj-$(CONFIG_RT_MUTEXES) += rtmutex.o obj-$(CONFIG_DEBUG_RT_MUTEXES) += rtmutex-debug.o +obj-$(CONFIG_RT_MUTEX_TESTER) += rtmutex-tester.o obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o obj-$(CONFIG_SMP) += cpu.o spinlock.o obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o
kernel/rtmutex-tester.c new file +436 -0
436 lines not on this page · raw message
kernel/rtmutex.c +2 -1
@@ -671,7 +671,8 @@ rt_mutex_slowlock(struct rt_mutex *lock,debug_rt_mutex_print_deadlock (&waiter); -schedule (); +if (waiter.task) +schedule_rt_mutex (lock);spin_lock_irqsave (&lock->wait_lock, flags);set_task_state (current, state);
lib/Kconfig.debug +7 -0
@@ -134,6 +134,13 @@ config DEBUG_PI_LIST default y depends on DEBUG_RT_MUTEXES +config RT_MUTEX_TESTER + bool "Built-in scriptable tester for rt-mutexes" + depends on RT_MUTEXES + default n + help + This option enables a rt-mutex tester. + config DEBUG_SPINLOCK bool "Spinlock debugging" depends on DEBUG_KERNEL
scripts/rt-tester/check-all.sh new file +21 -0
@@ -0,0 +1,21 @@ + + +function testit () +{ + printf "%-30s: " $1 + ./rt-tester.py $1 | grep Pass +} + +testit t2-l1-2rt-sameprio.tst +testit t2-l1-pi.tst +testit t2-l1-signal.tst +#testit t2-l2-2rt-deadlock.tst +testit t3-l1-pi-1rt.tst +testit t3-l1-pi-2rt.tst +testit t3-l1-pi-3rt.tst +testit t3-l1-pi-signal.tst +testit t3-l1-pi-steal.tst +testit t3-l2-pi.tst +testit t4-l2-pi-deboost.tst +testit t5-l4-pi-boost-deboost.tst +
scripts/rt-tester/rt-tester.py new file +222 -0
222 lines not on this page · raw message
scripts/rt-tester/t2-l1-2rt-sameprio.tst new file +101 -0
101 lines not on this page · raw message
scripts/rt-tester/t2-l1-pi.tst new file +84 -0
84 lines not on this page · raw message
scripts/rt-tester/t2-l1-signal.tst new file +79 -0
79 lines not on this page · raw message
scripts/rt-tester/t2-l2-2rt-deadlock.tst new file +91 -0
91 lines not on this page · raw message
scripts/rt-tester/t3-l1-pi-1rt.tst new file +95 -0
95 lines not on this page · raw message
scripts/rt-tester/t3-l1-pi-2rt.tst new file +96 -0
96 lines not on this page · raw message
scripts/rt-tester/t3-l1-pi-3rt.tst new file +95 -0
95 lines not on this page · raw message
scripts/rt-tester/t3-l1-pi-signal.tst new file +98 -0
98 lines not on this page · raw message
scripts/rt-tester/t3-l1-pi-steal.tst new file +99 -0
99 lines not on this page · raw message
scripts/rt-tester/t3-l2-pi.tst new file +95 -0
95 lines not on this page · raw message
scripts/rt-tester/t4-l2-pi-deboost.tst new file +127 -0
127 lines not on this page · raw message
scripts/rt-tester/t5-l4-pi-boost-deboost.tst new file +148 -0
148 lines not on this page · raw message