Skip to contentSkip to conversation

Silence cyclicdeadline

PATCH New Daniel Wagner 1 participant 3 messages May 23, 2021

lore
Share & tools
lore
#0 lore raw

cover Silence cyclicdeadline

cyclicdeadline logs on default all every cycle via the ftrace buffers. Not really needed in normal test operation mode, thus introduce --debug to silence it for CI systems.

Daniel Wagner (2):
cyclicdeadline: Generate ftrace log entries in debug mode only
cyclicdeadline: Document --debug command line option

 src/sched_deadline/cyclicdeadline.8 |  6 +++++-
 src/sched_deadline/cyclicdeadline.c | 13 ++++++++++---
 2 files changed, 15 insertions(+), 4 deletions(-)
Signature · 1 line
2.31.1
#1 lore raw

PATCH 1/2 cyclicdeadline: Generate ftrace log entries in debug mode only

Introduce a new command line option --debug which enables the ftrace log entries only if enabled. Currently, cyclicdeadline will log every start of a cycle to kernel buffer, e.g. "cyclicdeadline -i 5000" gives

start at 30269625044 off=4 (period=30269625040 next=30269630040)
T: 0 (27109) I:5000 C: 230 Min: 2 Act: 2 Avg: 1 Max: 4
start at 30269635041 off=1 (period=30269635040 next=30269640040)
T: 0 (27109) I:5000 C: 232 Min: 1 Act: 1 Avg: 1 Max: 4

in case the kernel log levels are set higher which is usually the case of CI systems.

---
 src/sched_deadline/cyclicdeadline.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
src/sched_deadline/cyclicdeadline.c +10 -3
index 4c81891bbe63..dea9800b6507 100644
@@ -87,8 +87,9 @@ static int cpu_count;
 static int all_cpus;
 static int nr_threads;
 static int use_nsecs;
-static int mark_fd;
+static int mark_fd = -1;
 static int quiet;
+static int debug_enabled;
 static char jsonfile[MAX_PATH];
 
 static int find_mount(const char *mount, char *debugfs)
@@ -602,6 +603,7 @@ static void usage(int error)
 	       "-D TIME  --duration        Specify a length for the test run.\n"
 	       "                           Append 'm', 'h', or 'd' to specify minutes, hours or\n"
 	       "                           days\n"
+	       "         --debug           Enable ftrace logging\n"
 	       "-h       --help            Show this help menu.\n"
 	       "-i INTV  --interval        The shortest deadline for the tasks in us\n"
 	       "                           (default 1000us).\n"
@@ -985,7 +987,7 @@ static void write_stats(FILE *f, void *data)
 }
 
 enum options_valud {
-	OPT_AFFINITY=1, OPT_DURATION, OPT_HELP, OPT_INTERVAL,
+	OPT_AFFINITY=1, OPT_DURATION, OPT_DEBUG, OPT_HELP, OPT_INTERVAL,
 	OPT_JSON, OPT_STEP, OPT_THREADS, OPT_QUIET
 };
 
@@ -1019,6 +1021,7 @@ int main(int argc, char **argv)
 		static struct option options[] = {
 			{ "affinity",	optional_argument,	NULL,	OPT_AFFINITY },
 			{ "duration",	required_argument,	NULL,	OPT_DURATION },
+			{ "debug",	no_argument,		NULL,	OPT_DEBUG },
 			{ "help",	no_argument,		NULL,	OPT_HELP },
 			{ "interval",	required_argument,	NULL,	OPT_INTERVAL },
 			{ "json",	required_argument,	NULL,	OPT_JSON },
@@ -1062,6 +1065,9 @@ int main(int argc, char **argv)
 		case 'D':
 			duration = parse_time_string(optarg);
 			break;
+	        case OPT_DEBUG:
+			debug_enabled = 1;
+			break;
 		case OPT_QUIET:
 		case 'q':
 			quiet = 1;
@@ -1106,7 +1112,8 @@ int main(int argc, char **argv)
 	if (mlockall(MCL_CURRENT|MCL_FUTURE) == -1)
 		warn("mlockall");
 
-	setup_ftrace_marker();
+	if (debug_enabled)
+		setup_ftrace_marker();
 
 	thread = calloc(nr_threads, sizeof(*thread));
 	sched_data = calloc(nr_threads, sizeof(*sched_data));
Signature · 1 line
2.31.1
#2 lore raw

PATCH 2/2 cyclicdeadline: Document --debug command line option

In reply to Daniel Wagner

Describe what the newly introduced --debug command line is doing.

---
 src/sched_deadline/cyclicdeadline.8 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
src/sched_deadline/cyclicdeadline.8 +5 -1
index 1a56ed028d81..63fe9ebc6657 100644
@@ -17,7 +17,7 @@ cyclicdeadline \- This program is used to test the deadline scheduler (SCHED_DEA
 .PP
 .SH SYNOPSIS
 .B cyclicdeadline
-.RI "[-a [CPUSET]] [-D TIME] [-h]  [-i INTV] [--json FILENAME] [-s STEP] [-t NUM] [-q]"
+.RI "[-a [CPUSET]] [-D TIME] [--debug] [-h] [-i INTV] [--json FILENAME] [-s STEP] [-t NUM] [-q]"
 .PP
 .SH DESCRIPTION
 .B cyclicdeadline
@@ -32,6 +32,10 @@ Comma / hypen separated list of CPUs to run deadline tasks on
 Specify a length for the test to run
 Append 'm', 'h', or 'd' to specify minutes, hours, or days
 .TP
+.B \-\-debug
+Enable ftrace logging. When enabled cyclicdeadline will log the start
+of every cycle in the ftrace log buffer.
+.TP
 .B \-h \-\-help
 Show this help menu
 .TP
Signature · 1 line
2.31.1