All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/3] kmsg01: set/restore console log level
@ 2017-10-23 12:18 Jan Stancek
  2017-10-23 12:18 ` [LTP] [PATCH 2/3] kmsg01: specify read timeout in usec Jan Stancek
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jan Stancek @ 2017-10-23 12:18 UTC (permalink / raw)
  To: ltp

commit 497564c77836 "kmsg01: lower the volume of message going to console"
lowered message priority for the flood of messages that try to overwrite
whole buffer. This works only for default console_loglevel. If anything
increases console_loglevel (for example a call to console_verbose()
via lockdep) system starts flooding also console. This causes a failure
on systems with slower serial console, because test is unable to
complete in 5 minutes.

Before patch:
  <timeout>

After patch:
  real	0m9.219s
  user	0m0.289s
  sys	0m4.027s

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/kernel/logging/kmsg/kmsg01.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/testcases/kernel/logging/kmsg/kmsg01.c b/testcases/kernel/logging/kmsg/kmsg01.c
index 294d0a2d1495..393acdcc71c6 100644
--- a/testcases/kernel/logging/kmsg/kmsg01.c
+++ b/testcases/kernel/logging/kmsg/kmsg01.c
@@ -52,7 +52,10 @@
 #define NUM_READ_RETRY 10
 #define NUM_OVERWRITE_MSGS 1024
 #define READ_TIMEOUT 5
+#define PRINTK "/proc/sys/kernel/printk"
+#define CONSOLE_LOGLEVEL_QUIET   4
 
+static int console_loglevel = -1;
 
 /*
  * inject_msg - write message to /dev/kmsg
@@ -571,7 +574,23 @@ static void test_kmsg(void)
 	test_seek();
 }
 
+static void setup(void)
+{
+	if (access(PRINTK, F_OK) == 0) {
+		SAFE_FILE_SCANF(PRINTK, "%d", &console_loglevel);
+		SAFE_FILE_PRINTF(PRINTK, "%d", CONSOLE_LOGLEVEL_QUIET);
+	}
+}
+
+static void cleanup(void)
+{
+	if (console_loglevel != -1)
+		SAFE_FILE_PRINTF(PRINTK, "%d", console_loglevel);
+}
+
 static struct tst_test test = {
+	.setup = setup,
+	.cleanup = cleanup,
 	.needs_root = 1,
 	.test_all = test_kmsg,
 	.min_kver = "3.5.0"
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-10-26  7:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-23 12:18 [LTP] [PATCH 1/3] kmsg01: set/restore console log level Jan Stancek
2017-10-23 12:18 ` [LTP] [PATCH 2/3] kmsg01: specify read timeout in usec Jan Stancek
2017-10-23 12:18 ` [LTP] [PATCH 3/3] kmsg01: use lower timeout for test_read_block() Jan Stancek
2017-10-25  8:49   ` Cyril Hrubis
2017-10-26  7:40     ` Jan Stancek
2017-10-25  8:43 ` [LTP] [PATCH 1/3] kmsg01: set/restore console log level Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.