Skip to contentSkip to conversation

rt-tests: cyclictest.8: Remove invalid tracing options from the manpage

PATCH In review John Kacur 2 participants 6 messages Sep 16, 2019 – Sep 17, 2019

lore
Share & tools
lore

John Kacur

author
#0 lore raw

PATCH 1/4 rt-tests: cyclictest.8: Remove invalid tracing options from the manpage

Most tracing options have been removed from cyclictest since the user can now use trace-cmd together with cyclictest to get the same functionality. Update the manpage to reflect this.

---
 src/cyclictest/cyclictest.8 | 35 -----------------------------------
 1 file changed, 35 deletions(-)
src/cyclictest/cyclictest.8 +0 -35
index a05d1f4c9d4a..b64a16ae8bbb 100644
@@ -52,9 +52,6 @@ Align thread wakeups to a specific offset in microseconds
 .B \-b, \-\-breaktrace=USEC
 Send break trace command when latency > USEC
 .TP
-.B \-B, \-\-preemptirqs
-Both preempt and irqsoff tracing (used with -b)
-.TP
 .B \-c, \-\-clock=CLOCK
 select clock
 .br
@@ -62,9 +59,6 @@ select clock
 .br
 1 = CLOCK_REALTIME
 .TP
-.B \-C, \-\-context
-context switch tracing (used with \-b)
-.TP
 .B \-d, \-\-distance=DIST
 Distance of thread intervals in us, default = 500
 .TP
@@ -73,12 +67,6 @@ Specify a length for the test run.
 .br
 Append 'm', 'h', or 'd' to specify minutes, hours or days.
 .TP
-.B \-E, \-\-event
-event tracing (used with \-b)
-.TP
-.B \-f, \-\-ftrace
-Enable function tracing using ftrace as tracer. This option is available only with \-b.
-.TP
 .B \-F, \-\-fifo=<path>
 Create a named pipe at path and write stats to it
 .TP
@@ -94,9 +82,6 @@ Dump the latency histogram to <path> instead of stdout.
 .B \-i, \-\-interval=INTV
 Set the base interval of the thread(s) in microseconds (default is 1000us). This sets the interval of the first thread. See also \-d.
 .TP
-.B \-I, \-\-irqsoff
-Irgsoff tracing (used with \-b)
-.TP
 .B \-l, \-\-loops=LOOPS
 Set the number of loops. The default is 0 (endless). This option is useful for automated tests with a given number of test cycles. Cyclictest is stopped once the number of timer intervals has been reached.
 .TP
@@ -113,26 +98,16 @@ running cyclictest on low-bandwidth connections)
 .B \-n, \-\-nanosleep
 Use clock_nanosleep instead of posix interval timers. Setting this option runs the tests with clock_nanosleep instead of posix interval timers.
 .TP
-.B \-\-notrace
-suppress tracing
-.TP
 .B \-N, \-\-nsecs
 Show results in nanoseconds instead of microseconds, which is the default unit.
 .TP
 .B \-o, \-\-oscope=RED
 Oscilloscope mode, reduce verbose output by RED.
 .TP
-.B \-O, \-\-traceopt=TRACING_OPTION
-Used to pass tracing options to ftrace tracers. May be invoked multiple
-times for multiple trace options. For example trace options look at /sys/kernel/debug/tracing/trace_options
-.TP
 .B \-p, \-\-prio=PRIO
 Set the priority of the first thread. The given priority is set to the first test thread. Each further thread gets a lower priority:
 Priority(Thread N) = max(Priority(Thread N\-1) \- 1, 0)
 .TP
-.B \-P, \-\-preemptoff
-Preempt off tracing (used with -b)
-.TP
 .B \-\-policy=NAME
 set the scheduler policy of the measurement threads
 where NAME is one of: other, normal, batch, idle, fifo, rr
@@ -178,10 +153,6 @@ the number of available CPUs. See \-d, \-i and \-p for further information.
 .B \-\-tracemark
 write a trace mark when \-b latency is exceeded.
 .TP
-.B \-T, \-\-tracer=TRACEFUNC
-set the ftrace tracer function. Used with the \-b option. Must be one
-of the trace functions available from <debugfs-mountpoint>/kernel/debug/tracing/available_tracers
-.TP
 .B \-u, \-\-unbuffered
 force unbuffered output for live processing
 .TP
@@ -192,12 +163,6 @@ n:c:v
 
 where n=task number c=count v=latency value in us.
 .TP
-.B \\-w, \-\-wakeup
-task wakeup tracing (used with \-b)
-.TP
-.B \\-W, \-\-wakeuprt
-rt-task wakeup tracing (used with \-b)
-.TP
 .B \-\-dbg_cyclictest
 Print info userful for debugging cyclictest
 
Signature · 1 line
2.20.1
author
#1 lore raw

PATCH 2/4 rt-tests: cyclictest: Make tracemark work correctly again

commit f5ccfbe4d6641e48f56152be135d901dd31cba7e
was a little too aggressive removing ftrace code.

We were able to remove ftrace code because this functionality is available using trace-cmd, in conjunction with the tracemark option in cyclictest. Put back the parts of tracemark needed to make this work correctly.

After this patch you can get tracing info like this as an example.

trace-cmd record -p function ./cyclictest -t -b100 --tracemark

---
 src/cyclictest/cyclictest.c | 7 +++++++
 1 file changed, 7 insertions(+)
src/cyclictest/cyclictest.c +7 -0
index 52f93da7d074..45b6041ec1c9 100644
@@ -184,6 +184,7 @@ static void trigger_update(struct thread_param *par, int diff, int64_t ts);
 
 static int shutdown;
 static int tracelimit = 0;
+static int trace_marker = 9;
 static int verbose = 0;
 static int oscope_reduction = 1;
 static int lockall = 0;
@@ -400,6 +401,9 @@ static void debugfs_prepare(void)
 
 static void enable_trace_mark(void)
 {
+	if (!trace_marker)
+		return;
+
 	debugfs_prepare();
 	open_tracemark_fd();
 }
@@ -1167,6 +1171,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
 			{"spike",	     required_argument, NULL, OPT_TRIGGER },
 			{"spike-nodes",	     required_argument, NULL, OPT_TRIGGER_NODES },
 			{"threads",          optional_argument, NULL, OPT_THREADS },
+			{"tracemark",	     no_argument,	NULL, OPT_TRACEMARK },
 			{"unbuffered",       no_argument,       NULL, OPT_UNBUFFERED },
 			{"verbose",          no_argument,       NULL, OPT_VERBOSE },
 			{"dbg_cyclictest",   no_argument,       NULL, OPT_DBGCYCLIC },
@@ -1343,6 +1348,8 @@ static void process_options (int argc, char *argv[], int max_cpus)
 			fatal("--smi is not available on your arch\n");
 #endif
 			break;
+		case OPT_TRACEMARK:
+			trace_marker = 1; break;
 		}
 	}
 
Signature · 1 line
2.20.1
#2 lore raw

Re: [PATCH 2/4] rt-tests: cyclictest: Make tracemark work correctly again

Hi John,

Quoted 22 lines · John Kacur

commit f5ccfbe4d6641e48f56152be135d901dd31cba7e
was a little too aggressive removing ftrace code.

We were able to remove ftrace code because this functionality is available using trace-cmd, in conjunction with the tracemark option in cyclictest. Put back the parts of tracemark needed to make this work correctly.

After this patch you can get tracing info like this as an example.

trace-cmd record -p function ./cyclictest -t -b100 --tracemark

---
 src/cyclictest/cyclictest.c | 7 +++++++
 1 file changed, 7 insertions(+)
src/cyclictest/cyclictest.c +0 -0
index 52f93da7d074..45b6041ec1c9 100644

src/cyclictest/cyclictest.c static void trigger_update(struct thread_param *par, int diff, int64_t ts); · line 187

Quoted 4 lines
src/cyclictest/cyclictest.c +1 -0
@@ -184,6 +184,7 @@ static void trigger_update(struct thread_param *par, int diff, int64_t ts);
 
 static int shutdown;
 static int tracelimit = 0;
+static int trace_marker = 9;

Shouldn't this be 'static int trace_marker = 0'? Otherwise it's always set.

Thanks,
Kurt

author
#3 lore raw

Re: [PATCH 2/4] rt-tests: cyclictest: Make tracemark work correctly again

Quoted 26 lines · Kurt Kanzenbach

Hi John,

Quoted 23 lines · John Kacur

commit f5ccfbe4d6641e48f56152be135d901dd31cba7e
was a little too aggressive removing ftrace code.

We were able to remove ftrace code because this functionality is available using trace-cmd, in conjunction with the tracemark option in cyclictest. Put back the parts of tracemark needed to make this work correctly.

After this patch you can get tracing info like this as an example.

trace-cmd record -p function ./cyclictest -t -b100 --tracemark

---
 src/cyclictest/cyclictest.c | 7 +++++++
 1 file changed, 7 insertions(+)
src/cyclictest/cyclictest.c +0 -0
index 52f93da7d074..45b6041ec1c9 100644
@@ -184,6 +184,7 @@ static void trigger_update(struct thread_param *par, int diff, int64_t ts);
 
Quoted 9 lines

src/cyclictest/cyclictest.c static void trigger_update(struct thread_param *par, int diff, int64_t ts); · line 187

Quoted 3 lines
src/cyclictest/cyclictest.c +1 -0
 static int shutdown;
 static int tracelimit = 0;
+static int trace_marker = 9;

Shouldn't this be 'static int trace_marker = 0'? Otherwise it's always set.

Thanks,
Kurt

I left my computer glasses in Germany - no seriously I did! Thanks for spotting that, respinning the patch

John

author
#4 lore raw

PATCH 3/4 rt-tests: cyclictest: Fix warning: ‘cpu’ may be used uninitialized

In reply to John Kacur

Fix warning 'cpu' maybe uninitialized by giving it a default value in the switch statement. Note, this is a false positive, but documenting the default value in the switch statement isn't a bad thing.

---
 src/cyclictest/cyclictest.c | 1 +
 1 file changed, 1 insertion(+)
src/cyclictest/cyclictest.c +1 -0
index 45b6041ec1c9..542e85c27a25 100644
@@ -1897,6 +1897,7 @@ int main(int argc, char **argv)
 				printf("Thread %d using cpu %d.\n", i, cpu);
 			break;
 		case AFFINITY_USEALL: cpu = i % max_cpus; break;
+		default: cpu = -1;
 		}
 
 		node = -1;
Signature · 1 line
2.20.1
author
#5 lore raw

PATCH 4/4 rt-tests: cyclictest: Don't allow OPT_SYSTEM with OPT_POSIX_TIMERS

In reply to John Kacur

OPT_SYSTEM means use sys_nanosleep and sys_setitimer if you try to combine it with OPT_POSIX_TIMERS, it breaks.

cyclictest becomes unkillable with ctrl-C and only the first thread is updated.

Fix this by issuing a warning if the user tries to combine the two options and then use clock_nanosleep.

---
 src/cyclictest/cyclictest.c | 7 +++++++
 1 file changed, 7 insertions(+)
src/cyclictest/cyclictest.c +7 -0
index 542e85c27a25..90449d465398 100644
@@ -1353,6 +1353,13 @@ static void process_options (int argc, char *argv[], int max_cpus)
 		}
 	}
 
+	if ((use_system == MODE_SYS_OFFSET) && (use_nanosleep == MODE_CYCLIC)) {
+		warn("The system option requires clock_nanosleep\n");
+		warn("and is not compatible with posix_timers\n");
+		warn("Using clock_nanosleep\n");
+		use_nanosleep = MODE_CLOCK_NANOSLEEP;
+	}
+
 	/* if smp wasn't requested, test for numa automatically */
 	if (!smp) {
 #ifdef NUMA
Signature · 1 line
2.20.1