Commit f095bfc0ea04829d6962edaf06a5c56e0c251f5b

Authored by Davidlohr Bueso
Committed by Paul E. McKenney
1 parent 42ddc75ddd

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>

Showing 1 changed file with 13 additions and 2 deletions Side-by-side Diff

kernel/locking/locktorture.c
... ... @@ -64,6 +64,7 @@
64 64 torture_param(bool, verbose, true,
65 65 "Enable verbose debugging printk()s");
66 66  
  67 +static bool debug_lock = false;
67 68 static char *torture_type = "spin_lock";
68 69 module_param(torture_type, charp, 0444);
69 70 MODULE_PARM_DESC(torture_type,
... ... @@ -349,8 +350,9 @@
349 350 const char *tag)
350 351 {
351 352 pr_alert("%s" TORTURE_FLAG
352   - "--- %s: nwriters_stress=%d stat_interval=%d verbose=%d shuffle_interval=%d stutter=%d shutdown_secs=%d onoff_interval=%d onoff_holdoff=%d\n",
353   - torture_type, tag, nrealwriters_stress, stat_interval, verbose,
  353 + "--- %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",
  354 + torture_type, tag, debug_lock ? " [debug]": "",
  355 + nrealwriters_stress, stat_interval, verbose,
354 356 shuffle_interval, stutter, shutdown_secs,
355 357 onoff_interval, onoff_holdoff);
356 358 }
... ... @@ -418,6 +420,15 @@
418 420 nrealwriters_stress = nwriters_stress;
419 421 else
420 422 nrealwriters_stress = 2 * num_online_cpus();
  423 +
  424 +#ifdef CONFIG_DEBUG_MUTEXES
  425 + if (strncmp(torture_type, "mutex", 5) == 0)
  426 + debug_lock = true;
  427 +#endif
  428 +#ifdef CONFIG_DEBUG_SPINLOCK
  429 + if (strncmp(torture_type, "spin", 4) == 0)
  430 + debug_lock = true;
  431 +#endif
421 432 lock_torture_print_module_parms(cur_ops, "Start of test");
422 433  
423 434 /* Initialize the statistics so that each run gets its own numbers. */