Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1272496 > unrolled thread

[PATCH] perf test: Add bpf-output event

Started bySukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
First post2015-11-18 20:30 +0100
Last post2015-11-20 03:30 +0100
Articles 6 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] perf test: Add bpf-output event Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2015-11-18 20:30 +0100
    Re: [PATCH] perf test: Add bpf-output event Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-18 22:00 +0100
      Re: [PATCH] perf test: Add bpf-output event Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2015-11-19 00:20 +0100
        Re: [PATCH] perf test: Add bpf-output event "Wangnan (F)" <wangnan0@huawei.com> - 2015-11-19 02:40 +0100
          Re: [PATCH] perf test: Add bpf-output event Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2015-11-20 00:40 +0100
            Re: [PATCH] perf test: Add bpf-output event "Wangnan (F)" <wangnan0@huawei.com> - 2015-11-20 03:30 +0100

#1272496 — [PATCH] perf test: Add bpf-output event

FromSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Date2015-11-18 20:30 +0100
Subject[PATCH] perf test: Add bpf-output event
Message-ID<qwgAy-7es-9@gated-at.bofh.it>
From 8f71d55dd3e27e6ca2138e3ed6dfeceb1c00a426 Mon Sep 17 00:00:00 2001
From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Date: Wed, 18 Nov 2015 19:06:08 -0500
Subject: [PATCH] perf test: Add bpf-output event

The kernel has added support for 'PERF_COUNT_SW_BPF_OUTPUT' but that is
missing from the perf tool. Among other things, results in the 'roundtrip
evsel->name check' test case of 'perf test' failing on Powerpc.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
---
 tools/perf/util/evsel.c        | 1 +
 tools/perf/util/parse-events.c | 4 ++++
 tools/perf/util/parse-events.l | 1 +
 3 files changed, 6 insertions(+)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 397fb4e..2033632 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -342,6 +342,7 @@ const char *perf_evsel__sw_names[PERF_COUNT_SW_MAX] = {
 	"alignment-faults",
 	"emulation-faults",
 	"dummy",
+	"bpf-output",
 };
 
 static const char *__perf_evsel__sw_name(u64 config)
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index e48d9da..40ae92a 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -124,6 +124,10 @@ struct event_symbol event_symbols_sw[PERF_COUNT_SW_MAX] = {
 		.symbol = "dummy",
 		.alias  = "",
 	},
+	[PERF_COUNT_SW_BPF_OUTPUT] = {
+		.symbol = "bpf-output",
+		.alias  = "",
+	},
 };
 
 #define __PERF_EVENT_FIELD(config, name) \
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index 58c5831..380298d 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -238,6 +238,7 @@ cpu-migrations|migrations			{ return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COU
 alignment-faults				{ return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_ALIGNMENT_FAULTS); }
 emulation-faults				{ return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_EMULATION_FAULTS); }
 dummy						{ return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_DUMMY); }
+bpf-output						{ return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_BPF_OUTPUT); }
 
 	/*
 	 * We have to handle the kernel PMU event cycles-ct/cycles-t/mem-loads/mem-stores separately.
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1272564

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-11-18 22:00 +0100
Message-ID<qwhZE-8au-3@gated-at.bofh.it>
In reply to#1272496
Em Wed, Nov 18, 2015 at 11:26:04AM -0800, Sukadev Bhattiprolu escreveu:
> >From 8f71d55dd3e27e6ca2138e3ed6dfeceb1c00a426 Mon Sep 17 00:00:00 2001
> From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
> Date: Wed, 18 Nov 2015 19:06:08 -0500
> Subject: [PATCH] perf test: Add bpf-output event
> 
> The kernel has added support for 'PERF_COUNT_SW_BPF_OUTPUT' but that is
> missing from the perf tool. Among other things, results in the 'roundtrip
> evsel->name check' test case of 'perf test' failing on Powerpc.

Next time can you please state if this is for this merge window or for
the next?

Will apply it for perf/core, for the next merge window.

- Arnaldo
 
> Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
> ---
>  tools/perf/util/evsel.c        | 1 +
>  tools/perf/util/parse-events.c | 4 ++++
>  tools/perf/util/parse-events.l | 1 +
>  3 files changed, 6 insertions(+)
> 
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index 397fb4e..2033632 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -342,6 +342,7 @@ const char *perf_evsel__sw_names[PERF_COUNT_SW_MAX] = {
>  	"alignment-faults",
>  	"emulation-faults",
>  	"dummy",
> +	"bpf-output",
>  };
>  
>  static const char *__perf_evsel__sw_name(u64 config)
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index e48d9da..40ae92a 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -124,6 +124,10 @@ struct event_symbol event_symbols_sw[PERF_COUNT_SW_MAX] = {
>  		.symbol = "dummy",
>  		.alias  = "",
>  	},
> +	[PERF_COUNT_SW_BPF_OUTPUT] = {
> +		.symbol = "bpf-output",
> +		.alias  = "",
> +	},
>  };
>  
>  #define __PERF_EVENT_FIELD(config, name) \
> diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
> index 58c5831..380298d 100644
> --- a/tools/perf/util/parse-events.l
> +++ b/tools/perf/util/parse-events.l
> @@ -238,6 +238,7 @@ cpu-migrations|migrations			{ return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COU
>  alignment-faults				{ return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_ALIGNMENT_FAULTS); }
>  emulation-faults				{ return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_EMULATION_FAULTS); }
>  dummy						{ return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_DUMMY); }
> +bpf-output						{ return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_BPF_OUTPUT); }
>  
>  	/*
>  	 * We have to handle the kernel PMU event cycles-ct/cycles-t/mem-loads/mem-stores separately.
> -- 
> 1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1272660

FromAlexei Starovoitov <alexei.starovoitov@gmail.com>
Date2015-11-19 00:20 +0100
Message-ID<qwkb7-1kY-1@gated-at.bofh.it>
In reply to#1272564
On Wed, Nov 18, 2015 at 05:50:39PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Wed, Nov 18, 2015 at 11:26:04AM -0800, Sukadev Bhattiprolu escreveu:
> > >From 8f71d55dd3e27e6ca2138e3ed6dfeceb1c00a426 Mon Sep 17 00:00:00 2001
> > From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
> > Date: Wed, 18 Nov 2015 19:06:08 -0500
> > Subject: [PATCH] perf test: Add bpf-output event
> > 
> > The kernel has added support for 'PERF_COUNT_SW_BPF_OUTPUT' but that is
> > missing from the perf tool. Among other things, results in the 'roundtrip
> > evsel->name check' test case of 'perf test' failing on Powerpc.
> 
> Next time can you please state if this is for this merge window or for
> the next?
> 
> Will apply it for perf/core, for the next merge window.

wait a sec, I believe Wang has posted an RFC a month ago that adds support
for this properly instead of simply shutting up the error.
Or I missed something?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1272737

From"Wangnan (F)" <wangnan0@huawei.com>
Date2015-11-19 02:40 +0100
Message-ID<qwmmC-2DM-15@gated-at.bofh.it>
In reply to#1272660

On 2015/11/19 7:14, Alexei Starovoitov wrote:
> On Wed, Nov 18, 2015 at 05:50:39PM -0300, Arnaldo Carvalho de Melo wrote:
>> Em Wed, Nov 18, 2015 at 11:26:04AM -0800, Sukadev Bhattiprolu escreveu:
>>> >From 8f71d55dd3e27e6ca2138e3ed6dfeceb1c00a426 Mon Sep 17 00:00:00 2001
>>> From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
>>> Date: Wed, 18 Nov 2015 19:06:08 -0500
>>> Subject: [PATCH] perf test: Add bpf-output event
>>>
>>> The kernel has added support for 'PERF_COUNT_SW_BPF_OUTPUT' but that is
>>> missing from the perf tool. Among other things, results in the 'roundtrip
>>> evsel->name check' test case of 'perf test' failing on Powerpc.
>> Next time can you please state if this is for this merge window or for
>> the next?
>>
>> Will apply it for perf/core, for the next merge window.
> wait a sec, I believe Wang has posted an RFC a month ago that adds support
> for this properly instead of simply shutting up the error.

Yes. Please have a look at

http://lkml.kernel.org/g/1446029705-199659-3-git-send-email-wangnan0@huawei.com

and patch 23/31 - 31/31 in

http://lkml.kernel.org/g/1444826502-49291-1-git-send-email-wangnan0@huawei.com

We are working on a solution which truly utilizes bpf-output, including
filling event array and extracting BPF output through perf data to CTF
format. Now they are separated in multiple patchset, and I'd like to
resend them to Arnaldo in this week.

Thank you.

[SNIP]

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1273594

FromSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Date2015-11-20 00:40 +0100
Message-ID<qwGY1-7GJ-15@gated-at.bofh.it>
In reply to#1272737
Wangnan (F) [wangnan0@huawei.com] wrote:
| 
| 
| On 2015/11/19 7:14, Alexei Starovoitov wrote:
| >On Wed, Nov 18, 2015 at 05:50:39PM -0300, Arnaldo Carvalho de Melo wrote:
| >>Em Wed, Nov 18, 2015 at 11:26:04AM -0800, Sukadev Bhattiprolu escreveu:
| >>>>From 8f71d55dd3e27e6ca2138e3ed6dfeceb1c00a426 Mon Sep 17 00:00:00 2001
| >>>From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
| >>>Date: Wed, 18 Nov 2015 19:06:08 -0500
| >>>Subject: [PATCH] perf test: Add bpf-output event
| >>>
| >>>The kernel has added support for 'PERF_COUNT_SW_BPF_OUTPUT' but that is
| >>>missing from the perf tool. Among other things, results in the 'roundtrip
| >>>evsel->name check' test case of 'perf test' failing on Powerpc.
| >>Next time can you please state if this is for this merge window or for
| >>the next?
| >>
| >>Will apply it for perf/core, for the next merge window.
| >wait a sec, I believe Wang has posted an RFC a month ago that adds support
| >for this properly instead of simply shutting up the error.
| 
| Yes. Please have a look at
| 
| http://lkml.kernel.org/g/1446029705-199659-3-git-send-email-wangnan0@huawei.com
| 
| and patch 23/31 - 31/31 in
| 
| http://lkml.kernel.org/g/1444826502-49291-1-git-send-email-wangnan0@huawei.com
| 
| We are working on a solution which truly utilizes bpf-output, including
| filling event array and extracting BPF output through perf data to CTF
| format. Now they are separated in multiple patchset, and I'd like to
| resend them to Arnaldo in this week.

Ok. It looked like there was development going on around BPF so I put
in the stubs to avoid false positives in the perf test.  There is a BPF
filter test case that is also getting Skipped. Would this patchset address
that too?

Sukadev

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1273693

From"Wangnan (F)" <wangnan0@huawei.com>
Date2015-11-20 03:30 +0100
Message-ID<qwJCy-10e-15@gated-at.bofh.it>
In reply to#1273594

On 2015/11/20 7:29, Sukadev Bhattiprolu wrote:
> Wangnan (F) [wangnan0@huawei.com] wrote:
> |
> |
> | On 2015/11/19 7:14, Alexei Starovoitov wrote:
> | >On Wed, Nov 18, 2015 at 05:50:39PM -0300, Arnaldo Carvalho de Melo wrote:
> | >>Em Wed, Nov 18, 2015 at 11:26:04AM -0800, Sukadev Bhattiprolu escreveu:
> | >>>>From 8f71d55dd3e27e6ca2138e3ed6dfeceb1c00a426 Mon Sep 17 00:00:00 2001
> | >>>From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
> | >>>Date: Wed, 18 Nov 2015 19:06:08 -0500
> | >>>Subject: [PATCH] perf test: Add bpf-output event
> | >>>
> | >>>The kernel has added support for 'PERF_COUNT_SW_BPF_OUTPUT' but that is
> | >>>missing from the perf tool. Among other things, results in the 'roundtrip
> | >>>evsel->name check' test case of 'perf test' failing on Powerpc.
> | >>Next time can you please state if this is for this merge window or for
> | >>the next?
> | >>
> | >>Will apply it for perf/core, for the next merge window.
> | >wait a sec, I believe Wang has posted an RFC a month ago that adds support
> | >for this properly instead of simply shutting up the error.
> |
> | Yes. Please have a look at
> |
> | http://lkml.kernel.org/g/1446029705-199659-3-git-send-email-wangnan0@huawei.com
> |
> | and patch 23/31 - 31/31 in
> |
> | http://lkml.kernel.org/g/1444826502-49291-1-git-send-email-wangnan0@huawei.com
> |
> | We are working on a solution which truly utilizes bpf-output, including
> | filling event array and extracting BPF output through perf data to CTF
> | format. Now they are separated in multiple patchset, and I'd like to
> | resend them to Arnaldo in this week.
>
> Ok. It looked like there was development going on around BPF so I put
> in the stubs to avoid false positives in the perf test.  There is a BPF
> filter test case that is also getting Skipped. Would this patchset address
> that too?

Do you mean this?

$ ./perf test bpf
37: Test BPF filter                                          :
37.1: Test basic BPF filtering                               : Skip

To make it pass you need to build BPF compiling environment first.

First of all you must be root:

$ ./perf test -v bpf
37: Test BPF filter                                          :
37.1: Test basic BPF filtering                               :
--- start ---
test child forked, pid 19359
Only root can run BPF test
test child finished with -2
---- end ----
Test BPF filter subtest 0: Skip


Then it would tell you how to setup your LLVM environment:

$ sudo -s
# ./perf test -v bpf
37: Test BPF filter                                          :
37.1: Test basic BPF filtering                               :
--- start ---
test child forked, pid 19463
ERROR:    unable to find clang.
Hint:    Try to install latest clang/llvm to support BPF. Check your $PATH
          and 'clang-path' option in [llvm] section of ~/.perfconfig.
          LLVM 3.7 or newer is required. Which can be found from 
http://llvm.org
          You may want to try git trunk:
              git clone http://llvm.org/git/llvm.git
                   and
              git clone http://llvm.org/git/clang.git

          Or fetch the latest clang/llvm 3.7 from pre-built llvm 
packages for
          debian/ubuntu:
              http://llvm.org/apt

          If you are using old version of clang, change 
'clang-bpf-cmd-template'
          option in [llvm] section of ~/.perfconfig to:

            "$CLANG_EXEC $CLANG_OPTIONS $KERNEL_INC_OPTIONS \
               -working-directory $WORKING_DIR -c $CLANG_SOURCE \
               -emit-llvm -o - | /path/to/llc -march=bpf -filetype=obj -o -"
          (Replace /path/to/llc with path to your llc)

Failed to compile test case: 'Basic BPF llvm compiling test'
Unable to get BPF object, fix 'perf test LLVM' first
test child finished with -2
---- end ----
Test BPF filter subtest 0: Skip


Set your clang path to ~/.perfconfig

# cat ~/.perfconfig
[llvm]
     clang-path = "/opt/llvm-3.7.0/x86_64-oe-linux-clang"

Then try 'perf test LLVM', fix all failure:

# ./perf test LLVM
35: Test LLVM searching and compiling                        :
35.1: Basic BPF llvm compiling test                          : Ok
35.2: Test kbuild searching                                  : Ok
35.3: Compile source for BPF prologue generation test        : Ok

After that you can try perf test BPF:

# ./perf test BPF
37: Test BPF filter                                          :
37.1: Test basic BPF filtering                               : Ok
37.2: Test BPF prologue generation                           : Ok

Thank you.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web