From: Steven Rostedt <rostedt@goodmis.org>
To: Tom Zanussi <tom.zanussi@linux.intel.com>
Cc: masami.hiramatsu.pt@hitachi.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] tracing/triggers: A couple minor variable name changes
Date: Mon, 6 Jan 2014 22:31:24 -0500 [thread overview]
Message-ID: <20140106223124.0e5fd0b4@gandalf.local.home> (raw)
In-Reply-To: <1389063069.3040.90.camel@empanada>
[-- Attachment #1: Type: text/plain, Size: 1646 bytes --]
On Mon, 06 Jan 2014 20:51:09 -0600
Tom Zanussi <tom.zanussi@linux.intel.com> wrote:
> I'll run the next version through my 'testsuite', which unfortunately is
> still manual (one of the many things on my todo list is automate it)..
I have some basic tests, attached is one. Which failed. Here's the
patch that fixes it:
-- Steve
tracing: Fix counter for traceon/off event triggers
The counters for the traceon and traceoff are only suppose to decrement
when the trigger enables or disables tracing. It is not suppose to decrement
every time the event is hit.
Only decrement the counter if the trigger actually did something.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace_events_trigger.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
index f6dd115..a53e0da 100644
--- a/kernel/trace/trace_events_trigger.c
+++ b/kernel/trace/trace_events_trigger.c
@@ -742,13 +742,16 @@ traceon_trigger(struct event_trigger_data *data)
static void
traceon_count_trigger(struct event_trigger_data *data)
{
+ if (tracing_is_on())
+ return;
+
if (!data->count)
return;
if (data->count != -1)
(data->count)--;
- traceon_trigger(data);
+ tracing_on();
}
static void
@@ -763,13 +766,16 @@ traceoff_trigger(struct event_trigger_data *data)
static void
traceoff_count_trigger(struct event_trigger_data *data)
{
+ if (!tracing_is_on())
+ return;
+
if (!data->count)
return;
if (data->count != -1)
(data->count)--;
- traceoff_trigger(data);
+ tracing_off();
}
static int
--
1.8.1.4
[-- Attachment #2: ftrace-test-event-traceon-off --]
[-- Type: application/octet-stream, Size: 2408 bytes --]
#!/bin/bash
find_debugfs() {
debugfs=`cat /proc/mounts | while read mount dir type opts a b; do
if [ $mount == "debugfs" ]; then
echo $dir;
break
fi
done`
if [ -z "$debugfs" ]; then
if ! mount -t debugfs nodev /sys/kernel/debug; then
echo "FAILED to mount debugfs"
exit -1
fi
echo "/sys/kernel/debug"
else
echo $debugfs
fi
}
debugfs=`find_debugfs`
TRACEDIR="$debugfs/tracing"
EVENTDIR=$TRACEDIR/events
if [ ! -f $EVENTDIR/sched/sched_switch/trigger ]; then
echo "triggers are not set for this kernel"
exit 0
fi
function cnt_trace() {
grep -v '^#' $TRACEDIR/trace | wc -l
}
function check_traceon() {
val=$1
cur=`cat $TRACEDIR/tracing_on`
if [ $val -ne $cur ]; then
echo "traceon expected to be $val but was $cur"
exit 1
fi
}
set -x
echo '** DISABLE TRACING'
echo 0 > $TRACEDIR/tracing_on || exit -1
echo > $TRACEDIR/trace || exit -1
check_traceon 0
cnt=`cnt_trace`
if [ $cnt -ne 0 ]; then
exit -1
fi
echo '** ENABLE FUNCTION TRACING'
echo function > $TRACEDIR/current_tracer || exit -1
echo '** ENABLE TRACING'
echo 1 > $TRACEDIR/tracing_on || exit -1
cnt=`cnt_trace`
if [ $cnt -eq 0 ]; then
exit -1
fi
echo '** SET EVENT TRACEOFF'
check_traceon 1
echo "traceoff" > $EVENTDIR/sched/sched_switch/trigger
sleep 1
check_traceon 0
cnt=`cnt_trace`
sleep 1
cnt2=`cnt_trace`
if [ $cnt -ne $cnt2 ]; then
exit -1;
fi
line1=`cat $TRACEDIR/trace | tail -1`
sleep 1
line2=`cat $TRACEDIR/trace | tail -1`
if [ $line1 != $line2 ]; then
exit -1
fi
echo > $TRACEDIR/trace || exit -1
check_traceon 0
echo "!traceoff" >> $EVENTDIR/sched/sched_switch/trigger
check_traceon 0
echo "traceon" >> $EVENTDIR/sched/sched_switch/trigger
sleep 1
cnt=`cnt_trace`
if [ $cnt -eq 0 ]; then
exit -1
fi
check_traceon 1
echo "!traceon" >> $EVENTDIR/sched/sched_switch/trigger
check_sleep() {
val=$1
sleep 1
check_traceon $val
}
echo '** TEST COUNT traceoff (3)'
echo "traceoff:3" >> $EVENTDIR/sched/sched_switch/trigger
check_sleep "0"
echo '** TEST COUNT traceoff (2)'
echo 1 > $TRACEDIR/tracing_on
check_sleep "0"
echo '** TEST COUNT traceoff (1)'
echo 1 > $TRACEDIR/tracing_on
check_sleep "0"
echo '** TEST COUNT traceoff (0)'
echo 1 > $TRACEDIR/tracing_on
check_sleep "1"
echo "!traceoff:0" >> $EVENTDIR/sched/sched_switch/trigger
echo nop > $TRACEDIR/current_tracer
echo '** SUCCESS'
exit 0
next prev parent reply other threads:[~2014-01-07 3:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-06 19:44 Tom Zanussi
2014-01-06 19:44 ` [PATCH 1/2 v2] tracing/kprobes: Add trace event trigger invocations Tom Zanussi
2014-01-06 21:56 ` Masami Hiramatsu
2014-01-06 19:44 ` [PATCH 2/2] tracing: Remove double-underscore naming in syscall " Tom Zanussi
2014-01-06 21:13 ` [PATCH 0/2] tracing/triggers: A couple minor variable name changes Steven Rostedt
2014-01-07 0:47 ` Tom Zanussi
2014-01-07 1:50 ` Steven Rostedt
2014-01-07 2:51 ` Tom Zanussi
2014-01-07 3:27 ` Steven Rostedt
2014-01-07 17:29 ` Tom Zanussi
2014-01-07 17:56 ` Steven Rostedt
2014-01-07 3:31 ` Steven Rostedt [this message]
2014-01-07 17:30 ` Tom Zanussi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140106223124.0e5fd0b4@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=tom.zanussi@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®