From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751423AbdFBVhN (ORCPT ); Fri, 2 Jun 2017 17:37:13 -0400 Received: from resqmta-po-02v.sys.comcast.net ([96.114.154.161]:53222 "EHLO resqmta-po-02v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750966AbdFBVhL (ORCPT ); Fri, 2 Jun 2017 17:37:11 -0400 Reply-To: shuah@kernel.org Subject: Re: [PATCH] selftests/ftrace: Add a testcase for many kprobe events To: Masami Hiramatsu , Ingo Molnar Cc: Thomas Gleixner , Steven Rostedt , Kees Cook , LKML , x86@kernel.org, "Luis R . Rodriguez" , Peter Zijlstra , linux-kselftest@vger.kernel.org, Shuah Khan References: <149570868652.3518.14120169373590420503.stgit@devbox> <149577388470.11702.11832460851769204511.stgit@devbox> From: Shuah Khan Message-ID: <3358257f-4428-d598-6aed-f7076ca524a5@kernel.org> Date: Fri, 2 Jun 2017 15:37:09 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <149577388470.11702.11832460851769204511.stgit@devbox> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfCyBxAKj1ysiUJcyRUhfSDZz9tSsfDzerZiSwtNN/srW8dn6Ixzdrt6dt8fP6zbtQHqVi9M8LC+B9qYiW9GXs9n2NgnRT3iguguwaAIUWRcl5qaPse3R iKQFk132if5tNe9pHrpVaNVwpawCs/M8yfFkxZbH1MH+esWtSa5zLC4joOqaO1PDdPzYc3eWQHFrlVUxH/vyvQ+fvSed8KXwz0yldxjsCWZoBHEXUnshIWYM 5jQcyVWipMdvd0/MDOqQ2OM71YpVXNLukPvz4XMDeuoVA8gXanqffEuHz2tBpojZNvyCPiXm/ETkF523VAJq2j1sAVCCRzS88FJ3duCysv/argdq7QfEFycs f1wHi6L4ndYfHzNjY5KpyfmAVdJwdcJAtz8pH0fG+MVxY45cwYpZ2+Y9mujXVyLARIWa6VcnzNcXtAHSi2A/GtUQHHnQnU/ZWKL5Km4/pZsijQx9CqKxEuuT M2v/FjqhSzrRgLaw Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/25/2017 10:44 PM, Masami Hiramatsu wrote: > Add a testcase to test kprobes via ftrace interface > with many concurrent kprobe events. > > This tries to add many kprobe events (up to 256) on > kernel functions. To avoid making ftrace-based > kprobes (kprobes on fentry), it skips first N bytes > (on x86 N=5, on ppc or arm N=4) of function entry. > After that, it enables all those events, disable it, > and remove it. > > Since the unoptimization buffer reclaiming will > be delayed, after removing events, it will wait > enough time. > > Signed-off-by: Masami Hiramatsu > Suggested-by: Steven Rostedt Thanks. Applied to linux-kselftest next for 4.13-rc1 -- Shuah > --- > This ensures following bug is fixed and no regression. > > https://lkml.org/lkml/2017/5/25/218 > --- > .../ftrace/test.d/kprobe/multiple_kprobes.tc | 21 ++++++++++++++++++++ > 1 file changed, 21 insertions(+) > create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc > > diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc > new file mode 100644 > index 0000000..f4d1ff7 > --- /dev/null > +++ b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc > @@ -0,0 +1,21 @@ > +#!/bin/sh > +# description: Register/unregister many kprobe events > + > +# ftrace fentry skip size depends on the machine architecture. > +# Currently HAVE_KPROBES_ON_FTRACE defined on x86 and powerpc > +case `uname -m` in > + x86_64|i[3456]86) OFFS=5;; > + ppc*) OFFS=4;; > + *) OFFS=0;; > +esac > + > +echo "Setup up to 256 kprobes" > +grep t /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \ > +head -n 256 | while read i; do echo p ${i}+${OFFS} ; done > kprobe_events ||: > + > +echo 1 > events/kprobes/enable > +echo 0 > events/kprobes/enable > +echo > kprobe_events > +echo "Waiting for unoptimizing & freeing" > +sleep 5 > +echo "Done" > > >