aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/torture.h
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@kernel.org>2020-11-17 11:30:18 -0800
committerPaul E. McKenney <paulmck@kernel.org>2021-01-06 17:17:19 -0800
commitae19aaafae95a5487469433e9cae4c208f8d15cd (patch)
tree35b99f140c8f40c06954ab3e5608ff59cebdf21c /include/linux/torture.h
parentrcutorture: Make rcu_torture_fakewriter() use blocking wait primitives (diff)
downloadlinux-dev-ae19aaafae95a5487469433e9cae4c208f8d15cd.tar.xz
linux-dev-ae19aaafae95a5487469433e9cae4c208f8d15cd.zip
torture: Add fuzzed hrtimer-based sleep functions
This commit adds torture_hrtimeout_ns(), torture_hrtimeout_us(), torture_hrtimeout_ms(), torture_hrtimeout_jiffies(), and torture_hrtimeout_s(), each of which uses hrtimers to block for a fuzzed time interval. These functions are intended to be used by the various torture tests to decouple wakeups from the timer wheel, thus providing more opportunity for Murphy to insert destructive race conditions. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'include/linux/torture.h')
-rw-r--r--include/linux/torture.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/torture.h b/include/linux/torture.h
index 7f65bd1dd307..32941f8106b2 100644
--- a/include/linux/torture.h
+++ b/include/linux/torture.h
@@ -61,6 +61,13 @@ static inline void torture_random_init(struct torture_random_state *trsp)
trsp->trs_count = 0;
}
+/* Definitions for high-resolution-timer sleeps. */
+int torture_hrtimeout_ns(ktime_t baset_ns, u32 fuzzt_ns, struct torture_random_state *trsp);
+int torture_hrtimeout_us(u32 baset_us, u32 fuzzt_ns, struct torture_random_state *trsp);
+int torture_hrtimeout_ms(u32 baset_ms, u32 fuzzt_us, struct torture_random_state *trsp);
+int torture_hrtimeout_jiffies(u32 baset_j, struct torture_random_state *trsp);
+int torture_hrtimeout_s(u32 baset_s, u32 fuzzt_ms, struct torture_random_state *trsp);
+
/* Task shuffler, which causes CPUs to occasionally go idle. */
void torture_shuffle_task_register(struct task_struct *tp);
int torture_shuffle_init(long shuffint);