diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-01-30 18:49:29 -0500 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-02-23 12:01:12 -0500 |
commit | 36970bb91d89618d3495babf44b934e9c9db6bbc (patch) | |
tree | cee37f3089c868338f626124124fe2f90c26cdbd /kernel/torture.c | |
parent | 4622b487ecf0094401ac10e504606e5cbdea5a6e (diff) |
rcutorture: Privatize fullstop
This commit introduces the torture_must_stop() function in order to
keep use of the fullstop variable local to kernel/torture.c. There
is also a torture_must_stop_irq() counterpart for use from RCU callbacks,
timeout handlers, and the like.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Diffstat (limited to 'kernel/torture.c')
-rw-r--r-- | kernel/torture.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/kernel/torture.c b/kernel/torture.c index b02fa2785bbb..ed360cf948da 100644 --- a/kernel/torture.c +++ b/kernel/torture.c | |||
@@ -52,8 +52,11 @@ MODULE_AUTHOR("Paul E. McKenney <paulmck@us.ibm.com>"); | |||
52 | static char *torture_type; | 52 | static char *torture_type; |
53 | static bool verbose; | 53 | static bool verbose; |
54 | 54 | ||
55 | int fullstop = FULLSTOP_RMMOD; | 55 | /* Mediate rmmod and system shutdown. Concurrent rmmod & shutdown illegal! */ |
56 | EXPORT_SYMBOL_GPL(fullstop); | 56 | #define FULLSTOP_DONTSTOP 0 /* Normal operation. */ |
57 | #define FULLSTOP_SHUTDOWN 1 /* System shutdown with torture running. */ | ||
58 | #define FULLSTOP_RMMOD 2 /* Normal rmmod of torture. */ | ||
59 | static int fullstop = FULLSTOP_RMMOD; | ||
57 | static DEFINE_MUTEX(fullstop_mutex); | 60 | static DEFINE_MUTEX(fullstop_mutex); |
58 | 61 | ||
59 | #ifdef CONFIG_HOTPLUG_CPU | 62 | #ifdef CONFIG_HOTPLUG_CPU |
@@ -458,6 +461,7 @@ void __init torture_init_begin(char *ttype, bool v) | |||
458 | mutex_lock(&fullstop_mutex); | 461 | mutex_lock(&fullstop_mutex); |
459 | torture_type = ttype; | 462 | torture_type = ttype; |
460 | verbose = v; | 463 | verbose = v; |
464 | fullstop = FULLSTOP_DONTSTOP; | ||
461 | 465 | ||
462 | } | 466 | } |
463 | EXPORT_SYMBOL_GPL(torture_init_begin); | 467 | EXPORT_SYMBOL_GPL(torture_init_begin); |
@@ -498,3 +502,22 @@ bool torture_cleanup(void) | |||
498 | return false; | 502 | return false; |
499 | } | 503 | } |
500 | EXPORT_SYMBOL_GPL(torture_cleanup); | 504 | EXPORT_SYMBOL_GPL(torture_cleanup); |
505 | |||
506 | /* | ||
507 | * Is it time for the current torture test to stop? | ||
508 | */ | ||
509 | bool torture_must_stop(void) | ||
510 | { | ||
511 | return torture_must_stop_irq() || kthread_should_stop(); | ||
512 | } | ||
513 | EXPORT_SYMBOL_GPL(torture_must_stop); | ||
514 | |||
515 | /* | ||
516 | * Is it time for the current torture test to stop? This is the irq-safe | ||
517 | * version, hence no check for kthread_should_stop(). | ||
518 | */ | ||
519 | bool torture_must_stop_irq(void) | ||
520 | { | ||
521 | return fullstop != FULLSTOP_DONTSTOP; | ||
522 | } | ||
523 | EXPORT_SYMBOL_GPL(torture_must_stop_irq); | ||