[igt-dev] [PATCH i-g-t] runner: Only show the kmsg underflow/overflow message once

Chris Wilson chris at chris-wilson.co.uk
Wed Mar 25 12:33:18 UTC 2020


Instead of repeating every single time we underflow the read from kmsg,
just once per test is enough warning.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Petri Latvala <petri.latvala at intel.com>
---
 runner/executor.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/runner/executor.c b/runner/executor.c
index a56cb5d66..b26cb7bc7 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -549,6 +549,8 @@ static int dump_dmesg(int kmsgfd, int outfd)
 	int comparefd;
 	unsigned flags;
 	unsigned long long seq, cmpseq, usec;
+	bool underflow_once = false;
+	bool overflow_once = false;
 	char cont;
 	char buf[2048];
 	ssize_t r;
@@ -586,10 +588,16 @@ static int dump_dmesg(int kmsgfd, int outfd)
 		r = read(kmsgfd, buf, sizeof(buf));
 		if (r < 0) {
 			if (errno == EPIPE) {
-				errf("Warning: kernel log ringbuffer underflow, some records lost.\n");
+				if (!overflow_once) {
+					errf("Warning: kernel log ringbuffer underflow, some records lost.\n");
+					overflow_once = true;
+				}
 				continue;
 			} else if (errno == EINVAL) {
-				errf("Warning: Buffer too small for kernel log record, record lost.\n");
+				if (!underflow_once) {
+					errf("Warning: Buffer too small for kernel log record, record lost.\n");
+					underflow_once = true;
+				}
 				continue;
 			} else if (errno != EAGAIN) {
 				errf("Error reading from kmsg: %m\n");
-- 
2.26.0



More information about the igt-dev mailing list