#define pr_fmt(fmt) …
#include <linux/atomic.h>
#include <linux/bitops.h>
#include <linux/completion.h>
#include <linux/cpu.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/kthread.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/notifier.h>
#include <linux/percpu.h>
#include <linux/rcupdate.h>
#include <linux/rcupdate_trace.h>
#include <linux/reboot.h>
#include <linux/sched.h>
#include <linux/spinlock.h>
#include <linux/smp.h>
#include <linux/stat.h>
#include <linux/srcu.h>
#include <linux/slab.h>
#include <linux/torture.h>
#include <linux/types.h>
#define SCFTORT_STRING …
#define SCFTORT_FLAG …
#define VERBOSE_SCFTORTOUT(s, x...) …
#define SCFTORTOUT_ERRSTRING(s, x...) …
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;
torture_param(int, holdoff, IS_BUILTIN(CONFIG_SCF_TORTURE_TEST) ? 10 : 0,
"Holdoff time before test start (s)");
torture_param(int, longwait, 0, "Include ridiculously long waits? (seconds)");
torture_param(int, nthreads, -1, "# threads, defaults to -1 for all CPUs.");
torture_param(int, onoff_holdoff, 0, "Time after boot before CPU hotplugs (s)");
torture_param(int, onoff_interval, 0, "Time between CPU hotplugs (s), 0=disable");
torture_param(int, shutdown_secs, 0, "Shutdown time (ms), <= zero to disable.");
torture_param(int, stat_interval, 60, "Number of seconds between stats printk()s.");
torture_param(int, stutter, 5, "Number of jiffies to run/halt test, 0=disable");
torture_param(bool, use_cpus_read_lock, 0, "Use cpus_read_lock() to exclude CPU hotplug.");
torture_param(int, verbose, 0, "Enable verbose debugging printk()s");
torture_param(int, weight_resched, -1, "Testing weight for resched_cpu() operations.");
torture_param(int, weight_single, -1, "Testing weight for single-CPU no-wait operations.");
torture_param(int, weight_single_rpc, -1, "Testing weight for single-CPU RPC operations.");
torture_param(int, weight_single_wait, -1, "Testing weight for single-CPU operations.");
torture_param(int, weight_many, -1, "Testing weight for multi-CPU no-wait operations.");
torture_param(int, weight_many_wait, -1, "Testing weight for multi-CPU operations.");
torture_param(int, weight_all, -1, "Testing weight for all-CPU no-wait operations.");
torture_param(int, weight_all_wait, -1, "Testing weight for all-CPU operations.");
static char *torture_type = …;
#ifdef MODULE
#define SCFTORT_SHUTDOWN …
#else
#define SCFTORT_SHUTDOWN …
#endif
torture_param(bool, shutdown, SCFTORT_SHUTDOWN, "Shutdown at end of torture test.");
struct scf_statistics { … };
static struct scf_statistics *scf_stats_p;
static struct task_struct *scf_torture_stats_task;
static DEFINE_PER_CPU(long long, scf_invoked_count);
#define SCF_PRIM_RESCHED …
#define SCF_PRIM_SINGLE …
#define SCF_PRIM_SINGLE_RPC …
#define SCF_PRIM_MANY …
#define SCF_PRIM_ALL …
#define SCF_NPRIMS …
static char *scf_prim_name[] = …;
struct scf_selector { … };
static struct scf_selector scf_sel_array[SCF_NPRIMS];
static int scf_sel_array_len;
static unsigned long scf_sel_totweight;
struct scf_check { … };
static atomic_t n_started;
static atomic_t n_errs;
static atomic_t n_mb_in_errs;
static atomic_t n_mb_out_errs;
static atomic_t n_alloc_errs;
static bool scfdone;
static char *bangstr = …;
static DEFINE_TORTURE_RANDOM_PERCPU(scf_torture_rand);
extern void resched_cpu(int cpu);
static void scf_torture_stats_print(void)
{ … }
static int
scf_torture_stats(void *arg)
{ … }
static void scf_sel_add(unsigned long weight, int prim, bool wait)
{ … }
static void scf_sel_dump(void)
{ … }
static struct scf_selector *scf_sel_rand(struct torture_random_state *trsp)
{ … }
static void scf_handler(void *scfc_in)
{ … }
static void scf_handler_1(void *scfc_in)
{ … }
static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_random_state *trsp)
{ … }
static int scftorture_invoker(void *arg)
{ … }
static void
scftorture_print_module_parms(const char *tag)
{ … }
static void scf_cleanup_handler(void *unused)
{ … }
static void scf_torture_cleanup(void)
{ … }
static int __init scf_torture_init(void)
{ … }
module_init(…) …;
module_exit(scf_torture_cleanup);