From: Masami Hiramatsu <mhiramat@kernel.org>
To: linux-kselftest@vger.kernel.org, shuah@kernel.org,
Steven Rostedt <rostedt@goodmis.org>
Cc: mhiramat@kernel.org, linux-kernel@vger.kernel.org,
Alex Shi <alex.shi@linaro.org>,
Russell King - ARM Linux <linux@armlinux.org.uk>,
Jon Medhurst <tixy@linaro.org>,
linux-arm-kernel@lists.infradead.org
Subject: [RESEND PATCH 2/2] selftest: ftrace: Fix to add 256 kprobe events correctly
Date: Sun, 14 Jan 2018 22:50:36 +0900 [thread overview]
Message-ID: <151593783656.23875.14563972262086825681.stgit@devbox> (raw)
In-Reply-To: <151593777761.23875.10360397710751679883.stgit@devbox>
Current multiple-kprobe testcase only tries to add
kprobe events on first 256 text symbols. However
kprobes fails to probe on some text symbols (like
blacklisted symbols). Thus in the worst case,
the test can not add any kprobe events.
To avoid that, continue to try adding kprobe events
until 256 events. Also it confirms the number of
registered kprobe events.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
.../ftrace/test.d/kprobe/multiple_kprobes.tc | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc
index e297bd7a2e79..ce361b9d62cf 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc
@@ -12,9 +12,24 @@ case `uname -m` in
*) OFFS=0;;
esac
-echo "Setup up kprobes on first 256 text symbols"
+if [ -d events/kprobes ]; then
+ echo 0 > events/kprobes/enable
+ echo > kprobe_events
+fi
+
+N=0
+echo "Setup up kprobes on first available 256 text symbols"
grep -i " t " /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \
-head -n 256 | while read i; do echo p ${i}+${OFFS} ; done > kprobe_events ||:
+while read i; do
+ echo p ${i}+${OFFS} >> kprobe_events && N=$((N+1)) ||:
+ test $N -eq 256 && break
+done
+
+L=`wc -l kprobe_events`
+if [ $L -ne $N ]; then
+ echo "The number of kprobes events ($L) is not $N"
+ exit_fail
+fi
echo 1 > events/kprobes/enable
echo 0 > events/kprobes/enable
next prev parent reply other threads:[~2018-01-14 13:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-14 13:49 [RESEND PATCH 0/2] selftests: ftrace: Fix multiple-kprobe testcase Masami Hiramatsu
2018-01-14 13:50 ` [RESEND PATCH 1/2] [BUGFIX] selftest: ftrace: Fix to pick text symbols for kprobes Masami Hiramatsu
2018-01-14 13:50 ` Masami Hiramatsu [this message]
2018-01-15 18:05 ` [RESEND PATCH 0/2] selftests: ftrace: Fix multiple-kprobe testcase Steven Rostedt
2018-01-16 16:33 ` Shuah Khan
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=151593783656.23875.14563972262086825681.stgit@devbox \
--to=mhiramat@kernel.org \
--cc=alex.shi@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=rostedt@goodmis.org \
--cc=shuah@kernel.org \
--cc=tixy@linaro.org \
/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