Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1380252

[PATCH] locktorture: make verbose writable and control stats print

From Yang Shi <yang.shi@linaro.org>
Newsgroups linux.kernel
Subject [PATCH] locktorture: make verbose writable and control stats print
Date 2016-04-15 23:00 +0200
Message-ID <roj0l-Bj-5@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


When building locktorture test into kernel image, it keeps printing out
stats information even though there is no lock type specified.

There is already verbose parameter to control print, but it is read-only,
so it can't be changed at runtime. Make verbose read-write and control
stats print.

Signed-off-by: Yang Shi <yang.shi@linaro.org>
---
 include/linux/torture.h      |  2 ++
 kernel/locking/locktorture.c | 11 +++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/include/linux/torture.h b/include/linux/torture.h
index 7759fc3..86d6e54 100644
--- a/include/linux/torture.h
+++ b/include/linux/torture.h
@@ -48,6 +48,8 @@
 	do { if (verbose) pr_alert("%s" TORTURE_FLAG " %s\n", torture_type, s); } while (0)
 #define VERBOSE_TOROUT_ERRSTRING(s) \
 	do { if (verbose) pr_alert("%s" TORTURE_FLAG "!!! %s\n", torture_type, s); } while (0)
+#define VERBOSE_STRING(s) \
+	do { if (verbose) pr_alert("%s", s); } while (0)
 
 /* Definitions for online/offline exerciser. */
 int torture_onoff_init(long ooholdoff, long oointerval);
diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
index 8ef1919..d9838a3 100644
--- a/kernel/locking/locktorture.c
+++ b/kernel/locking/locktorture.c
@@ -55,8 +55,11 @@ torture_param(int, shutdown_secs, 0, "Shutdown time (j), <= 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, verbose, true,
-	     "Enable verbose debugging printk()s");
+
+static bool verbose = true;
+module_param(verbose, bool, 0644);
+MODULE_PARM_DESC(verbose,
+		 "Enable verbose debugging printk()s");
 
 static char *torture_type = "spin_lock";
 module_param(torture_type, charp, 0444);
@@ -693,7 +696,7 @@ static void lock_torture_stats_print(void)
 	}
 
 	__torture_print_stats(buf, cxt.lwsa, true);
-	pr_alert("%s", buf);
+	VERBOSE_STRING(buf);
 	kfree(buf);
 
 	if (cxt.cur_ops->readlock) {
@@ -705,7 +708,7 @@ static void lock_torture_stats_print(void)
 		}
 
 		__torture_print_stats(buf, cxt.lrsa, false);
-		pr_alert("%s", buf);
+		VERBOSE_STRING(buf);
 		kfree(buf);
 	}
 }
-- 
2.0.2

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] locktorture: make verbose writable and control stats print Yang Shi <yang.shi@linaro.org> - 2016-04-15 23:00 +0200
  Re: [PATCH] locktorture: make verbose writable and control stats  print "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-04-16 01:30 +0200
    Re: [PATCH] locktorture: make verbose writable and control stats  print "Shi, Yang" <yang.shi@linaro.org> - 2016-04-16 01:50 +0200
      Re: [PATCH] locktorture: make verbose writable and control stats  print "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-04-16 02:10 +0200
        Re: [PATCH] locktorture: make verbose writable and control stats  print "Shi, Yang" <yang.shi@linaro.org> - 2016-04-16 02:20 +0200
          Re: [PATCH] locktorture: make verbose writable and control stats  print "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-04-16 02:40 +0200

csiph-web