Blame view
include/linux/torture.h
3.48 KB
51b1130eb rcutorture: Abstr... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
/* * Common functions for in-kernel torture tests. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, you can access it online at * http://www.gnu.org/licenses/gpl-2.0.html. * * Copyright IBM Corporation, 2014 * * Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com> */ #ifndef __LINUX_TORTURE_H #define __LINUX_TORTURE_H #include <linux/types.h> #include <linux/cache.h> #include <linux/spinlock.h> #include <linux/threads.h> #include <linux/cpumask.h> #include <linux/seqlock.h> #include <linux/lockdep.h> #include <linux/completion.h> #include <linux/debugobjects.h> #include <linux/bug.h> #include <linux/compiler.h> |
9e2502254 rcutorture: Abstr... |
37 38 39 40 41 |
/* Definitions for a non-string torture-test module parameter. */ #define torture_param(type, name, init, msg) \ static type name = init; \ module_param(name, type, 0444); \ MODULE_PARM_DESC(name, msg); |
c2884de38 rcutorture: Abstr... |
42 43 44 45 46 |
#define TORTURE_FLAG "-torture:" #define TOROUT_STRING(s) \ pr_alert("%s" TORTURE_FLAG s " ", torture_type) #define VERBOSE_TOROUT_STRING(s) \ |
7fafaac5b rcutorture: Fix r... |
47 48 |
do { if (verbose) pr_alert("%s" TORTURE_FLAG " %s ", torture_type, s); } while (0) |
c2884de38 rcutorture: Abstr... |
49 |
#define VERBOSE_TOROUT_ERRSTRING(s) \ |
47cf29b9e rcutorture: Abstr... |
50 51 |
do { if (verbose) pr_alert("%s" TORTURE_FLAG "!!! %s ", torture_type, s); } while (0) |
c2884de38 rcutorture: Abstr... |
52 |
|
2e9e8081d rcutorture: Abstr... |
53 54 55 56 57 58 59 60 |
/* Definitions for a non-string torture-test module parameter. */ #define torture_parm(type, name, init, msg) \ static type name = init; \ module_param(name, type, 0444); \ MODULE_PARM_DESC(name, msg); /* Definitions for online/offline exerciser. */ int torture_onoff_init(long ooholdoff, long oointerval); |
2e9e8081d rcutorture: Abstr... |
61 62 |
char *torture_onoff_stats(char *page); bool torture_onoff_failures(void); |
9e2502254 rcutorture: Abstr... |
63 |
/* Low-rider random number generator. */ |
51b1130eb rcutorture: Abstr... |
64 65 66 67 |
struct torture_random_state { unsigned long trs_state; long trs_count; }; |
51b1130eb rcutorture: Abstr... |
68 |
#define DEFINE_TORTURE_RANDOM(name) struct torture_random_state name = { 0, 0 } |
51b1130eb rcutorture: Abstr... |
69 |
unsigned long torture_random(struct torture_random_state *trsp); |
3808dc9fa rcutorture: Abstr... |
70 71 72 |
/* Task shuffler, which causes CPUs to occasionally go idle. */ void torture_shuffle_task_register(struct task_struct *tp); int torture_shuffle_init(long shuffint); |
3808dc9fa rcutorture: Abstr... |
73 |
|
e991dbc07 rcutorture: Abstr... |
74 |
/* Test auto-shutdown handling. */ |
f67a33561 rcutorture: Abstr... |
75 |
void torture_shutdown_absorb(const char *title); |
e991dbc07 rcutorture: Abstr... |
76 |
int torture_shutdown_init(int ssecs, void (*cleanup)(void)); |
f67a33561 rcutorture: Abstr... |
77 |
|
628edaa50 rcutorture: Abstr... |
78 79 80 |
/* Task stuttering, which forces load/no-load transitions. */ void stutter_wait(const char *title); int torture_stutter_init(int s); |
628edaa50 rcutorture: Abstr... |
81 |
|
b5daa8f3b rcutorture: Abstr... |
82 |
/* Initialization and cleanup. */ |
628edaa50 rcutorture: Abstr... |
83 |
void torture_init_begin(char *ttype, bool v, int *runnable); |
b5daa8f3b rcutorture: Abstr... |
84 |
void torture_init_end(void); |
cc47ae083 rcutorture: Abstr... |
85 |
bool torture_cleanup(void); |
36970bb91 rcutorture: Priva... |
86 87 |
bool torture_must_stop(void); bool torture_must_stop_irq(void); |
7fafaac5b rcutorture: Fix r... |
88 |
void torture_kthread_stopping(char *title); |
47cf29b9e rcutorture: Abstr... |
89 90 |
int _torture_create_kthread(int (*fn)(void *arg), void *arg, char *s, char *m, char *f, struct task_struct **tp); |
9c029b860 rcutorture: Abstr... |
91 |
void _torture_stop_kthread(char *m, struct task_struct **tp); |
47cf29b9e rcutorture: Abstr... |
92 93 94 95 |
#define torture_create_kthread(n, arg, tp) \ _torture_create_kthread(n, (arg), #n, "Creating " #n " task", \ "Failed to create " #n, &(tp)) |
9c029b860 rcutorture: Abstr... |
96 97 |
#define torture_stop_kthread(n, tp) \ _torture_stop_kthread("Stopping " #n " task", &(tp)) |
b5daa8f3b rcutorture: Abstr... |
98 |
|
51b1130eb rcutorture: Abstr... |
99 |
#endif /* __LINUX_TORTURE_H */ |