mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
torture: Add get_torture_init_jiffies() for test-start time
This commit adds a get_torture_init_jiffies() function that returns the value of the jiffies counter at the start of the test, that is, at the point where torture_init_begin() was invoked. This will be used to enable torture-test holdoffs for tests implemented using per-CPU kthreads, which are created and deleted by CPU-hotplug operations, and thus (unlike normal kthreads) don't automatically know when the test started. Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
This commit is contained in:
parent
2014c95afe
commit
623b52802b
@ -104,6 +104,7 @@ int torture_stutter_init(int s, int sgap);
|
|||||||
/* Initialization and cleanup. */
|
/* Initialization and cleanup. */
|
||||||
bool torture_init_begin(char *ttype, int v);
|
bool torture_init_begin(char *ttype, int v);
|
||||||
void torture_init_end(void);
|
void torture_init_end(void);
|
||||||
|
unsigned long get_torture_init_jiffies(void);
|
||||||
bool torture_cleanup_begin(void);
|
bool torture_cleanup_begin(void);
|
||||||
void torture_cleanup_end(void);
|
void torture_cleanup_end(void);
|
||||||
bool torture_must_stop(void);
|
bool torture_must_stop(void);
|
||||||
|
@ -792,6 +792,8 @@ static void torture_stutter_cleanup(void)
|
|||||||
stutter_task = NULL;
|
stutter_task = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned long torture_init_jiffies;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
torture_print_module_parms(void)
|
torture_print_module_parms(void)
|
||||||
{
|
{
|
||||||
@ -821,6 +823,7 @@ bool torture_init_begin(char *ttype, int v)
|
|||||||
torture_type = ttype;
|
torture_type = ttype;
|
||||||
verbose = v;
|
verbose = v;
|
||||||
fullstop = FULLSTOP_DONTSTOP;
|
fullstop = FULLSTOP_DONTSTOP;
|
||||||
|
WRITE_ONCE(torture_init_jiffies, jiffies); // Lockless reads.
|
||||||
torture_print_module_parms();
|
torture_print_module_parms();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -836,6 +839,15 @@ void torture_init_end(void)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(torture_init_end);
|
EXPORT_SYMBOL_GPL(torture_init_end);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get the torture_init_begin()-time value of the jiffies counter.
|
||||||
|
*/
|
||||||
|
unsigned long get_torture_init_jiffies(void)
|
||||||
|
{
|
||||||
|
return READ_ONCE(torture_init_jiffies);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(get_torture_init_jiffies);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clean up torture module. Please note that this is -not- invoked via
|
* Clean up torture module. Please note that this is -not- invoked via
|
||||||
* the usual module_exit() mechanism, but rather by an explicit call from
|
* the usual module_exit() mechanism, but rather by an explicit call from
|
||||||
|
Loading…
Reference in New Issue
Block a user