summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorDavidlohr Bueso <dave@stgolabs.net>2014-09-11 20:40:19 -0700
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2014-09-16 13:41:04 -0700
commitf095bfc0ea04829d6962edaf06a5c56e0c251f5b (patch)
tree6608b20410d7ec3a6474c8ab56992bf037912dcb /kernel
parent42ddc75ddd478edac6ad9dc8c63abb4441541af2 (diff)
downloadlinux-f095bfc0ea04829d6962edaf06a5c56e0c251f5b.tar.gz
linux-f095bfc0ea04829d6962edaf06a5c56e0c251f5b.tar.bz2
linux-f095bfc0ea04829d6962edaf06a5c56e0c251f5b.zip
locktorture: Teach about lock debugging
Regular locks are very different than locks with debugging. For instance for mutexes, debugging forces to only take the slowpaths. As such, the locktorture module should take this into account when printing related information -- specifically when printing user passed parameters, it seems the right place for such info. Signed-off-by: Davidlohr Bueso <dbueso@suse.de> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/locking/locktorture.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
index 414ba45d580f..a6049fa2287e 100644
--- a/kernel/locking/locktorture.c
+++ b/kernel/locking/locktorture.c
@@ -64,6 +64,7 @@ torture_param(int, stutter, 5, "Number of jiffies to run/halt test, 0=disable");
torture_param(bool, verbose, true,
"Enable verbose debugging printk()s");
+static bool debug_lock = false;
static char *torture_type = "spin_lock";
module_param(torture_type, charp, 0444);
MODULE_PARM_DESC(torture_type,
@@ -349,8 +350,9 @@ lock_torture_print_module_parms(struct lock_torture_ops *cur_ops,
const char *tag)
{
pr_alert("%s" TORTURE_FLAG
- "--- %s: nwriters_stress=%d stat_interval=%d verbose=%d shuffle_interval=%d stutter=%d shutdown_secs=%d onoff_interval=%d onoff_holdoff=%d\n",
- torture_type, tag, nrealwriters_stress, stat_interval, verbose,
+ "--- %s%s: nwriters_stress=%d stat_interval=%d verbose=%d shuffle_interval=%d stutter=%d shutdown_secs=%d onoff_interval=%d onoff_holdoff=%d\n",
+ torture_type, tag, debug_lock ? " [debug]": "",
+ nrealwriters_stress, stat_interval, verbose,
shuffle_interval, stutter, shutdown_secs,
onoff_interval, onoff_holdoff);
}
@@ -418,6 +420,15 @@ static int __init lock_torture_init(void)
nrealwriters_stress = nwriters_stress;
else
nrealwriters_stress = 2 * num_online_cpus();
+
+#ifdef CONFIG_DEBUG_MUTEXES
+ if (strncmp(torture_type, "mutex", 5) == 0)
+ debug_lock = true;
+#endif
+#ifdef CONFIG_DEBUG_SPINLOCK
+ if (strncmp(torture_type, "spin", 4) == 0)
+ debug_lock = true;
+#endif
lock_torture_print_module_parms(cur_ops, "Start of test");
/* Initialize the statistics so that each run gets its own numbers. */