* [PATCH] cyclictest: Set tracing_thresh optionally
@ 2010-01-27 11:18 yi li
2010-01-27 13:06 ` John Kacur
0 siblings, 1 reply; 3+ messages in thread
From: yi li @ 2010-01-27 11:18 UTC (permalink / raw)
To: williams, tglx; +Cc: LKML, linux-rt-users
Hi,
In cyclictest, by default "tracing_thresh" will be set to "tracelimit"
(given to cyclictest with option "-b tracelimit").
If the maximum latency of the tracer currently used is less than
"tracelimit", no trace will be recorded.
e.g:
./cyclictest -p 80 -t 1 -n -l 10000 -i 10000 -b 8000 -I -f
If the "irqsoff" maximum latency is less than 8000,
"/sys/kernel/debug/tracing/trace" will no contain valid "irqsoff"
trace.
This is not expected sometimes if e.g, the maximum latency of
cyclictest is caused by wakeup, but I want to see the irqsoff latency.
So I think it may be better to allow user set "tracing_thresh"
optionally, by adding a "--tracing_thresh=THRESH" option.
Here is a simple patch to show the idea:
Signed-off-by: yi.li@analog.com
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index ce4d911..c2f1c07 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -144,6 +144,7 @@ struct thread_stat {
static int shutdown;
static int tracelimit = 0;
+static int tracing_thresh = 0;
static int ftrace = 0;
static int kernelversion;
static int verbose = 0;
@@ -384,9 +385,11 @@ static void setup_tracer(void)
if (kernelversion == KV_26_CURR) {
char buffer[32];
int ret;
-
- sprintf(buffer, "%d", tracelimit);
- setkernvar("tracing_thresh", buffer);
+
+ if (tracing_thresh > 0 && tracing_thresh <= tracelimit) {
+ sprintf(buffer, "%d", tracing_thresh);
+ setkernvar("tracing_thresh", buffer);
+ }
/* ftrace_enabled is a sysctl variable */
fileprefix = procfileprefix;
@@ -766,6 +769,7 @@ static void display_help(int error)
" without -t default = 1\n"
"-T TRACE --tracer=TRACER set tracing function\n"
" configured tracers: %s\n"
+ "--tracing_thresh=THRESH set tracing_thresh of current
tracer to THRESH\n"
"-u --unbuffered force unbuffered output for live
processing\n"
"-v --verbose output values on stdout for statistics\n"
" format: n:c:v n=tasknum c=count
v=value in us\n"
@@ -896,6 +900,7 @@ static void process_options (int argc, char *argv[])
{"help", no_argument, NULL, '?'},
{"tracer", required_argument, NULL, 'T'},
{"traceopt", required_argument, NULL, 'O'},
+ {"tracing_thresh", required_argument, NULL, 1},
{"smp", no_argument, NULL, 'S'},
{NULL, 0, NULL, 0}
};
@@ -972,6 +977,7 @@ static void process_options (int argc, char *argv[])
use_nanosleep = MODE_CLOCK_NANOSLEEP;
break;
case '?': display_help(0); break;
+ case 1 : tracing_thresh = atoi(optarg); break;
}
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] cyclictest: Set tracing_thresh optionally
2010-01-27 11:18 [PATCH] cyclictest: Set tracing_thresh optionally yi li
@ 2010-01-27 13:06 ` John Kacur
2010-01-28 6:46 ` yi li
0 siblings, 1 reply; 3+ messages in thread
From: John Kacur @ 2010-01-27 13:06 UTC (permalink / raw)
To: yi li; +Cc: williams, tglx, LKML, linux-rt-users
On Wed, Jan 27, 2010 at 12:18 PM, yi li <liyi.dev@gmail.com> wrote:
> Hi,
>
> In cyclictest, by default "tracing_thresh" will be set to "tracelimit"
> (given to cyclictest with option "-b tracelimit").
> If the maximum latency of the tracer currently used is less than
> "tracelimit", no trace will be recorded.
So, can't you just set the tracing_thresh to your desired value with the
-b tracelimit option?
Explain to me how cyclictest will behave if tracelimit and tracing_thresh
are set to different values.
If you showed us two sets of outputs (with and without your option)
to show what setting tracing_thresh separately would achieve that
would be helpful.
>
> e.g:
> ./cyclictest -p 80 -t 1 -n -l 10000 -i 10000 -b 8000 -I -f
> If the "irqsoff" maximum latency is less than 8000,
> "/sys/kernel/debug/tracing/trace" will no contain valid "irqsoff"
> trace.
>
> This is not expected sometimes if e.g, the maximum latency of
> cyclictest is caused by wakeup, but I want to see the irqsoff latency.
> So I think it may be better to allow user set "tracing_thresh"
> optionally, by adding a "--tracing_thresh=THRESH" option.
>
> Here is a simple patch to show the idea:
>
> Signed-off-by: yi.li@analog.com
>
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index ce4d911..c2f1c07 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -144,6 +144,7 @@ struct thread_stat {
>
> static int shutdown;
> static int tracelimit = 0;
> +static int tracing_thresh = 0;
> static int ftrace = 0;
> static int kernelversion;
> static int verbose = 0;
> @@ -384,9 +385,11 @@ static void setup_tracer(void)
> if (kernelversion == KV_26_CURR) {
> char buffer[32];
> int ret;
> -
> - sprintf(buffer, "%d", tracelimit);
> - setkernvar("tracing_thresh", buffer);
> +
> + if (tracing_thresh > 0 && tracing_thresh <= tracelimit) {
> + sprintf(buffer, "%d", tracing_thresh);
> + setkernvar("tracing_thresh", buffer);
> + }
Do you need an else part that sets tracing_thresh to tracelimit?
>
> /* ftrace_enabled is a sysctl variable */
> fileprefix = procfileprefix;
> @@ -766,6 +769,7 @@ static void display_help(int error)
> " without -t default = 1\n"
> "-T TRACE --tracer=TRACER set tracing function\n"
> " configured tracers: %s\n"
> + "--tracing_thresh=THRESH set tracing_thresh of current
> tracer to THRESH\n"
If you run your patch through checkpatch you'll get
ERROR: patch seems to be corrupt (line wrapped?)
#64: FILE: src/cyclictest/cyclictest.c:772:
tracer to THRESH\n"
And because of the above, I am unable to apply your patch
with git am
We don't follow all the kernel style recommendations in cyclictest
but we try to follow most of them. So please run your patch
through checkpatch and fix-up the warnings.
> "-u --unbuffered force unbuffered output for live
> processing\n"
> "-v --verbose output values on stdout for statistics\n"
> " format: n:c:v n=tasknum c=count
> v=value in us\n"
> @@ -896,6 +900,7 @@ static void process_options (int argc, char *argv[])
> {"help", no_argument, NULL, '?'},
> {"tracer", required_argument, NULL, 'T'},
> {"traceopt", required_argument, NULL, 'O'},
> + {"tracing_thresh", required_argument, NULL, 1},
> {"smp", no_argument, NULL, 'S'},
> {NULL, 0, NULL, 0}
> };
> @@ -972,6 +977,7 @@ static void process_options (int argc, char *argv[])
> use_nanosleep = MODE_CLOCK_NANOSLEEP;
> break;
> case '?': display_help(0); break;
> + case 1 : tracing_thresh = atoi(optarg); break;
> }
> }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cyclictest: Set tracing_thresh optionally
2010-01-27 13:06 ` John Kacur
@ 2010-01-28 6:46 ` yi li
0 siblings, 0 replies; 3+ messages in thread
From: yi li @ 2010-01-28 6:46 UTC (permalink / raw)
To: John Kacur; +Cc: williams, tglx, LKML, linux-rt-users
On Wed, Jan 27, 2010 at 9:06 PM, John Kacur <jkacur@redhat.com> wrote:
> On Wed, Jan 27, 2010 at 12:18 PM, yi li <liyi.dev@gmail.com> wrote:
>> Hi,
>>
>> In cyclictest, by default "tracing_thresh" will be set to "tracelimit"
>> (given to cyclictest with option "-b tracelimit").
>> If the maximum latency of the tracer currently used is less than
>> "tracelimit", no trace will be recorded.
>
> So, can't you just set the tracing_thresh to your desired value with the
> -b tracelimit option?
>
> Explain to me how cyclictest will behave if tracelimit and tracing_thresh
> are set to different values.
>
> If you showed us two sets of outputs (with and without your option)
> to show what setting tracing_thresh separately would achieve that
> would be helpful.
>
Here is an example:
1. run cyclictest with "wakeup-rt" tracer (In my case, max latency of
cyclictest is caused by "wakeup"):
root:/> ./cyclictest -p 80 -n -t 1 -l 10000 -i 20000 -b 5000 -W
could not set latency_hist/wakeup_latency/reset to 1
policy: fifo: loadavg: 4.98 3.32 1.47 6/30 363
T: 0 ( 359) P:80 I:20000 C: 373 Min: 74 Act: 5194 Avg: 158 Max: 5194
# Thread Ids: 00359
# Break thread: 359
root:/> cat /sys/kernel/debug/tracing/trace
# tracer: wakeup_rt
#
# wakeup_rt latency trace v1.1.5 on 2.6.32.6-ADI-2010R1-pre-svn8240
# --------------------------------------------------------------------
# latency: 5138 us, #5/5, CPU#0 | (M:desktop VP:0, KP:0, SP:0 HP:0)
# -----------------
# | task: -359 (uid:0 nice:0 policy:1 rt_prio:80)
# -----------------
#
# _------=> CPU#
# / _-----=> irqs-off
# | / _----=> need-resched
# || / _---=> hardirq/softirq
# ||| / _--=> preempt-depth
# |||| /_--=> lock-depth
# |||||/ delay
# cmd pid |||||| time | caller
# \ / |||||| \ | /
ls-364 0dNh.. 7us+: 364:120:R + [000] 359: 19:S cyclictest
ls-364 0dNh.. 20us!: _wake_up_process <-_hrtimer_wakeup
ls-364 0d.... 5127us+: _schedule <-_system_call
ls-364 0d.... 5130us : 364:120:R ==> [000] 359: 19:R cyclictest
2. Now we want to run cyclictest with "irqsoff" tracer:
Without my patch, "irqsoff" tracer cannot recored valid trace,
because "tracing_thresh" will be set to "5000", and max latency of
"irqsoff" in this case is less than "5000".
root:/> ./cyclictest -p 80 -n -t 1 -l 10000 -i 20000 -b 5000 -I
could not set latency_hist/wakeup_latency/reset to 1
policy: fifo: loadavg: 5.08 3.78 1.80 6/30 408
T: 0 ( 402) P:80 I:20000 C: 1217 Min: 84 Act: 179 Avg: 167 Max: 3933
# Thread Ids: 00402
# Break thread: 402
root:/> cat /sys/kernel/debug/tracing/trace
# tracer: irqsoff
#
# irqsoff latency trace v1.1.5 on 2.6.32.6-ADI-2010R1-pre-svn8240
# --------------------------------------------------------------------
# latency: 5138 us, #5/5, CPU#0 | (M:desktop VP:0, KP:0, SP:0 HP:0)
# -----------------
# | task: -359 (uid:0 nice:0 policy:1 rt_prio:80)
# -----------------
#
# _------=> CPU#
# / _-----=> irqs-off
# | / _----=> need-resched
# || / _---=> hardirq/softirq
# ||| / _--=> preempt-depth
# |||| /_--=> lock-depth
# |||||/ delay
# cmd pid |||||| time | caller
# \ / |||||| \ | /
ls-364 0dNh.. 7us+: 364:120:R + [000] 359: 19:S cyclictest
ls-364 0dNh.. 20us!: _wake_up_process <-_hrtimer_wakeup
ls-364 0d.... 5127us+: _schedule <-_system_call
ls-364 0d.... 5130us : 364:120:R ==> [000] 359: 19:R cyclictest
3. With my patch, run cyclic test with "irqsoff" tracer can get expected trace
(because "tracing_thresh" is reset to "0" in this case).
root:/> ./cyclictest -p 80 -n -t 1 -l 10000 -i 20000 -b 5000 -I
could not set latency_hist/wakeup_latency/reset to 1
policy: fifo: loadavg: 5.00 4.79 3.15 6/30 701
T: 0 ( 700) P:80 I:20000 C: 147 Min: 92 Act: 8706 Avg: 226 Max: 8706
# Thread Ids: 00700
# Break thread: 700
root:/> cat /sys/kernel/debug/tracing/trace
# tracer: irqsoff
#
# irqsoff latency trace v1.1.5 on 2.6.32.6-ADI-2010R1-pre-svn8240
# --------------------------------------------------------------------
# latency: 116 us, #3/3, CPU#0 | (M:desktop VP:0, KP:0, SP:0 HP:0)
# -----------------
# | task: -694 (uid:0 nice:0 policy:0 rt_prio:0)
# -----------------
# => started at: _user_path_at
# => ended at: _irq_exit
#
#
# _------=> CPU#
# / _-----=> irqs-off
# | / _----=> need-resched
# || / _---=> hardirq/softirq
# ||| / _--=> preempt-depth
# |||| /_--=> lock-depth
# |||||/ delay
# cmd pid |||||| time | caller
# \ / |||||| \ | /
ls-694 0d.... 1us!: __common_int_entry <-_user_path_at
ls-694 0dNs.. 112us+: ___do_softirq <-_irq_exit
ls-694 0dNs.. 119us : _trace_hardirqs_on <-_irq_exit
4. Or we can set a smaller "tracing_thresh" (e.g 100).
root:/> ./cyclictest -p 80 -n -t 1 -l 10000 -i 20000 -b 5000 -I --tracing_thresh
100
could not set latency_hist/wakeup_latency/reset to 1
policy: fifo: loadavg: 5.04 5.01 4.92 6/30 4235
T: 0 ( 4234) P:80 I:20000 C: 262 Min: 83 Act: 100 Avg: 165 Max: 1366
# Thread Ids: 04234
# Break thread: 4234
root:/> cat /sys/kernel/debug/tracing/tracing_thresh
100
root:/> cat /sys/kernel/debug/tracing/trace
# tracer: irqsoff
#
# irqsoff latency trace v1.1.5 on 2.6.32.6-ADI-2010R1-pre-svn8240
# --------------------------------------------------------------------
# latency: 102 us, #3/3, CPU#0 | (M:desktop VP:0, KP:0, SP:0 HP:0)
# -----------------
# | task: -4231 (uid:0 nice:0 policy:0 rt_prio:0)
# -----------------
# => started at: _dput
# => ended at: _irq_exit
#
#
# _------=> CPU#
# / _-----=> irqs-off
# | / _----=> need-resched
# || / _---=> hardirq/softirq
# ||| / _--=> preempt-depth
# |||| /_--=> lock-depth
# |||||/ delay
# cmd pid |||||| time | caller
# \ / |||||| \ | /
ls-4231 0d.... 1us+: __common_int_entry <-_dput
ls-4231 0d.s.. 99us+: ___do_softirq <-_irq_exit
ls-4231 0d.s.. 105us : _trace_hardirqs_on <-_irq_exit
>> +
>> + if (tracing_thresh > 0 && tracing_thresh <= tracelimit) {
>> + sprintf(buffer, "%d", tracing_thresh);
>> + setkernvar("tracing_thresh", buffer);
>> + }
>
> Do you need an else part that sets tracing_thresh to tracelimit?
>
I think by default set "tracing_thresh" to "0" makes more sense, i.e,
disable tracing thresh.
So max latency of current tracer can be recorded.
If people want the old behavior, cyclictest can be called with option
like " cyclictest -b 1000 --tracing_thresh 1000".
I will change this code and resend the patch:
+ if (tracing_thresh >= 0 && tracing_thresh <= tracelimit) {
+ sprintf(buffer, "%d", tracing_thresh);
+ setkernvar("tracing_thresh", buffer);
+ }
>
>>
>> /* ftrace_enabled is a sysctl variable */
>> fileprefix = procfileprefix;
>> @@ -766,6 +769,7 @@ static void display_help(int error)
>> " without -t default = 1\n"
>> "-T TRACE --tracer=TRACER set tracing function\n"
>> " configured tracers: %s\n"
>> + "--tracing_thresh=THRESH set tracing_thresh of current
>> tracer to THRESH\n"
>
> If you run your patch through checkpatch you'll get
>
> ERROR: patch seems to be corrupt (line wrapped?)
> #64: FILE: src/cyclictest/cyclictest.c:772:
> tracer to THRESH\n"
>
> And because of the above, I am unable to apply your patch
> with git am
>
> We don't follow all the kernel style recommendations in cyclictest
> but we try to follow most of them. So please run your patch
> through checkpatch and fix-up the warnings.
>
Sorry about that. I will resend the patch soon.
-Yi
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-01-28 6:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-27 11:18 [PATCH] cyclictest: Set tracing_thresh optionally yi li
2010-01-27 13:06 ` John Kacur
2010-01-28 6:46 ` yi li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).