diff options
Diffstat (limited to 'kernel/rcu')
-rw-r--r-- | kernel/rcu/rcutorture.c | 63 |
1 files changed, 5 insertions, 58 deletions
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 4329ad14f8dc..897b0f91f899 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c | |||
@@ -105,7 +105,6 @@ static struct task_struct **reader_tasks; | |||
105 | static struct task_struct *stats_task; | 105 | static struct task_struct *stats_task; |
106 | static struct task_struct *fqs_task; | 106 | static struct task_struct *fqs_task; |
107 | static struct task_struct *boost_tasks[NR_CPUS]; | 107 | static struct task_struct *boost_tasks[NR_CPUS]; |
108 | static struct task_struct *shutdown_task; | ||
109 | static struct task_struct *stall_task; | 108 | static struct task_struct *stall_task; |
110 | static struct task_struct **barrier_cbs_tasks; | 109 | static struct task_struct **barrier_cbs_tasks; |
111 | static struct task_struct *barrier_task; | 110 | static struct task_struct *barrier_task; |
@@ -173,7 +172,6 @@ static u64 notrace rcu_trace_clock_local(void) | |||
173 | } | 172 | } |
174 | #endif /* #else #ifdef CONFIG_RCU_TRACE */ | 173 | #endif /* #else #ifdef CONFIG_RCU_TRACE */ |
175 | 174 | ||
176 | static unsigned long shutdown_time; /* jiffies to system shutdown. */ | ||
177 | static unsigned long boost_starttime; /* jiffies of next boost test start. */ | 175 | static unsigned long boost_starttime; /* jiffies of next boost test start. */ |
178 | DEFINE_MUTEX(boost_mutex); /* protect setting boost_starttime */ | 176 | DEFINE_MUTEX(boost_mutex); /* protect setting boost_starttime */ |
179 | /* and boost task create/destroy. */ | 177 | /* and boost task create/destroy. */ |
@@ -183,9 +181,6 @@ static atomic_t barrier_cbs_invoked; /* Barrier callbacks invoked. */ | |||
183 | static wait_queue_head_t *barrier_cbs_wq; /* Coordinate barrier testing. */ | 181 | static wait_queue_head_t *barrier_cbs_wq; /* Coordinate barrier testing. */ |
184 | static DECLARE_WAIT_QUEUE_HEAD(barrier_wq); | 182 | static DECLARE_WAIT_QUEUE_HEAD(barrier_wq); |
185 | 183 | ||
186 | /* Forward reference. */ | ||
187 | static void rcu_torture_cleanup(void); | ||
188 | |||
189 | /* | 184 | /* |
190 | * Allocate an element from the rcu_tortures pool. | 185 | * Allocate an element from the rcu_tortures pool. |
191 | */ | 186 | */ |
@@ -1087,42 +1082,6 @@ static int rcutorture_booster_init(int cpu) | |||
1087 | } | 1082 | } |
1088 | 1083 | ||
1089 | /* | 1084 | /* |
1090 | * Cause the rcutorture test to shutdown the system after the test has | ||
1091 | * run for the time specified by the shutdown_secs module parameter. | ||
1092 | */ | ||
1093 | static int | ||
1094 | rcu_torture_shutdown(void *arg) | ||
1095 | { | ||
1096 | long delta; | ||
1097 | unsigned long jiffies_snap; | ||
1098 | |||
1099 | VERBOSE_TOROUT_STRING("rcu_torture_shutdown task started"); | ||
1100 | jiffies_snap = ACCESS_ONCE(jiffies); | ||
1101 | while (ULONG_CMP_LT(jiffies_snap, shutdown_time) && | ||
1102 | !kthread_should_stop()) { | ||
1103 | delta = shutdown_time - jiffies_snap; | ||
1104 | if (verbose) | ||
1105 | pr_alert("%s" TORTURE_FLAG | ||
1106 | "rcu_torture_shutdown task: %lu jiffies remaining\n", | ||
1107 | torture_type, delta); | ||
1108 | schedule_timeout_interruptible(delta); | ||
1109 | jiffies_snap = ACCESS_ONCE(jiffies); | ||
1110 | } | ||
1111 | if (kthread_should_stop()) { | ||
1112 | VERBOSE_TOROUT_STRING("rcu_torture_shutdown task stopping"); | ||
1113 | return 0; | ||
1114 | } | ||
1115 | |||
1116 | /* OK, shut down the system. */ | ||
1117 | |||
1118 | VERBOSE_TOROUT_STRING("rcu_torture_shutdown task shutting down system"); | ||
1119 | shutdown_task = NULL; /* Avoid self-kill deadlock. */ | ||
1120 | rcu_torture_cleanup(); /* Get the success/failure message. */ | ||
1121 | kernel_power_off(); /* Shut down the system. */ | ||
1122 | return 0; | ||
1123 | } | ||
1124 | |||
1125 | /* | ||
1126 | * CPU-stall kthread. It waits as specified by stall_cpu_holdoff, then | 1085 | * CPU-stall kthread. It waits as specified by stall_cpu_holdoff, then |
1127 | * induces a CPU stall for the time specified by stall_cpu. | 1086 | * induces a CPU stall for the time specified by stall_cpu. |
1128 | */ | 1087 | */ |
@@ -1421,11 +1380,7 @@ rcu_torture_cleanup(void) | |||
1421 | for_each_possible_cpu(i) | 1380 | for_each_possible_cpu(i) |
1422 | rcutorture_booster_cleanup(i); | 1381 | rcutorture_booster_cleanup(i); |
1423 | } | 1382 | } |
1424 | if (shutdown_task != NULL) { | 1383 | torture_shutdown_cleanup(); |
1425 | VERBOSE_TOROUT_STRING("Stopping rcu_torture_shutdown task"); | ||
1426 | kthread_stop(shutdown_task); | ||
1427 | } | ||
1428 | shutdown_task = NULL; | ||
1429 | 1384 | ||
1430 | /* Wait for all RCU callbacks to fire. */ | 1385 | /* Wait for all RCU callbacks to fire. */ |
1431 | 1386 | ||
@@ -1681,18 +1636,10 @@ rcu_torture_init(void) | |||
1681 | } | 1636 | } |
1682 | } | 1637 | } |
1683 | } | 1638 | } |
1684 | if (shutdown_secs > 0) { | 1639 | i = torture_shutdown_init(shutdown_secs, rcu_torture_cleanup); |
1685 | shutdown_time = jiffies + shutdown_secs * HZ; | 1640 | if (i != 0) { |
1686 | shutdown_task = kthread_create(rcu_torture_shutdown, NULL, | 1641 | firsterr = i; |
1687 | "rcu_torture_shutdown"); | 1642 | goto unwind; |
1688 | if (IS_ERR(shutdown_task)) { | ||
1689 | firsterr = PTR_ERR(shutdown_task); | ||
1690 | VERBOSE_TOROUT_ERRSTRING("Failed to create shutdown"); | ||
1691 | shutdown_task = NULL; | ||
1692 | goto unwind; | ||
1693 | } | ||
1694 | torture_shuffle_task_register(shutdown_task); | ||
1695 | wake_up_process(shutdown_task); | ||
1696 | } | 1643 | } |
1697 | i = torture_onoff_init(onoff_holdoff * HZ, onoff_interval * HZ); | 1644 | i = torture_onoff_init(onoff_holdoff * HZ, onoff_interval * HZ); |
1698 | if (i != 0) { | 1645 | if (i != 0) { |