Skip to contentSkip to conversation

perf test: Add watchpoint test

PATCH Applied Ravi Bangoria 3 participants 7 messages Sep 10, 2018 – Sep 12, 2018 perf events

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf test: Add watchpoint test

We don't have perf test available to test watchpoint functionality. Add simple set of tests:
- Read only watchpoint
- Write only watchpoint
- Read / Write watchpoint
- Runtime watchpoint modification

Ex on powerpc:

  $ sudo ./perf test 22
  22: Watchpoint                                            :
  22.1: Read Only Watchpoint                                : Ok
  22.2: Write Only Watchpoint                               : Ok
  22.3: Read / Write Watchpoint                             : Ok
  22.4: Modify Watchpoint                                   : Ok
---
 tools/perf/tests/Build          |   1 +
 tools/perf/tests/builtin-test.c |   9 ++
 tools/perf/tests/tests.h        |   3 +
 tools/perf/tests/wp.c           | 225 ++++++++++++++++++++++++++++++++
 4 files changed, 238 insertions(+)
 create mode 100644 tools/perf/tests/wp.c
tools/perf/tests/Build +1 -0
index 6c108fa79ae3..0b2b8305c965 100644
@@ -21,6 +21,7 @@ perf-y += python-use.o
 perf-y += bp_signal.o
 perf-y += bp_signal_overflow.o
 perf-y += bp_account.o
+perf-y += wp.o
 perf-y += task-exit.o
 perf-y += sw-clock.o
 perf-y += mmap-thread-lookup.o
tools/perf/tests/builtin-test.c +9 -0
index d7a5e1b9aa6f..54ca7d87236f 100644
@@ -120,6 +120,15 @@ static struct test generic_tests[] = {
 		.func = test__bp_accounting,
 		.is_supported = test__bp_signal_is_supported,
 	},
+	{
+		.desc = "Watchpoint",
+		.func = test__wp,
+		.subtest = {
+			.skip_if_fail	= false,
+			.get_nr		= test__wp_subtest_get_nr,
+			.get_desc	= test__wp_subtest_get_desc,
+		},
+	},
 	{
 		.desc = "Number of exit events of a simple workload",
 		.func = test__task_exit,
tools/perf/tests/tests.h +3 -0
index a9760e790563..8e26a4148f30 100644
@@ -59,6 +59,9 @@ int test__python_use(struct test *test, int subtest);
 int test__bp_signal(struct test *test, int subtest);
 int test__bp_signal_overflow(struct test *test, int subtest);
 int test__bp_accounting(struct test *test, int subtest);
+int test__wp(struct test *test, int subtest);
+const char *test__wp_subtest_get_desc(int subtest);
+int test__wp_subtest_get_nr(void);
 int test__task_exit(struct test *test, int subtest);
 int test__mem(struct test *test, int subtest);
 int test__sw_clock_freq(struct test *test, int subtest);
tools/perf/tests/wp.c new file +225 -0

225 lines not on this page · raw message

Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Ravi Bangoria

We don't have perf test available to test watchpoint functionality. Add simple set of tests:
- Read only watchpoint
- Write only watchpoint
- Read / Write watchpoint
- Runtime watchpoint modification

Quoted 7 lines

Ex on powerpc:

  $ sudo ./perf test 22
  22: Watchpoint                                            :
  22.1: Read Only Watchpoint                                : Ok
  22.2: Write Only Watchpoint                               : Ok
  22.3: Read / Write Watchpoint                             : Ok
  22.4: Modify Watchpoint                                   : Ok

cool, thanks!

jirka

maintainer Applied
#2 lore raw

Em Mon, Sep 10, 2018 at 12:31:54PM +0200, Jiri Olsa escreveu:

Quoted 16 lines · Ravi Bangoria
Quoted 7 lines

We don't have perf test available to test watchpoint functionality. Add simple set of tests:
- Read only watchpoint
- Write only watchpoint
- Read / Write watchpoint
- Runtime watchpoint modification

Quoted 7 lines

Ex on powerpc:

  $ sudo ./perf test 22
  22: Watchpoint                                            :
  22.1: Read Only Watchpoint                                : Ok
  22.2: Write Only Watchpoint                               : Ok
  22.3: Read / Write Watchpoint                             : Ok
  22.4: Modify Watchpoint                                   : Ok
Quoted 3 lines

cool, thanks!

Thanks, applied.

- Arnaldo

#3 lore raw

Em Mon, Sep 10, 2018 at 10:47:54AM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 17 lines

Em Mon, Sep 10, 2018 at 12:31:54PM +0200, Jiri Olsa escreveu:

Quoted 16 lines · Ravi Bangoria
Quoted 14 lines

We don't have perf test available to test watchpoint functionality. Add simple set of tests:
- Read only watchpoint
- Write only watchpoint
- Read / Write watchpoint
- Runtime watchpoint modification

Ex on powerpc:

  $ sudo ./perf test 22
  22: Watchpoint                                            :
  22.1: Read Only Watchpoint                                : Ok
  22.2: Write Only Watchpoint                               : Ok
  22.3: Read / Write Watchpoint                             : Ok
  22.4: Modify Watchpoint                                   : Ok
Quoted 5 lines
Quoted 3 lines

cool, thanks!

Thanks, applied.

While testing, I got curious, as a 'perf test' user, why one of the tests had the "Skip" result:

[root@seventh ~]# perf test watchpoint

22: Watchpoint                                            :
22.1: Read Only Watchpoint                                : Skip
22.2: Write Only Watchpoint                               : Ok
22.3: Read / Write Watchpoint                             : Ok
22.4: Modify Watchpoint                                   : Ok

[root@seventh ~]#

I tried with 'perf test -v watchpoint' but that didn't help, perhaps you could add some message after the "Skip" telling why it skipped that test? I.e. hardware doesn't have that capability, kernel driver not yet supporting that, something else?

- Arnaldo

#4 lore raw

Em Mon, Sep 10, 2018 at 11:18:30AM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 16 lines

Em Mon, Sep 10, 2018 at 10:47:54AM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 15 lines

Em Mon, Sep 10, 2018 at 12:31:54PM +0200, Jiri Olsa escreveu:

Quoted 9 lines · Ravi Bangoria
Quoted 7 lines

Ex on powerpc:

  $ sudo ./perf test 22
  22: Watchpoint                                            :
  22.1: Read Only Watchpoint                                : Ok
  22.2: Write Only Watchpoint                               : Ok
  22.3: Read / Write Watchpoint                             : Ok
  22.4: Modify Watchpoint                                   : Ok
Quoted 3 lines

cool, thanks!

Thanks, applied.

Oops, fails when cross-building it to mips, I'll try to fix after lunch:

  18   109.48 debian:experimental           : Ok   gcc (Debian 8.2.0-4) 8.2.0
  19    42.66 debian:experimental-x-arm64   : Ok   aarch64-linux-gnu-gcc (Debian 8.1.0-12) 8.1.0
  20    22.33 debian:experimental-x-mips    : FAIL mips-linux-gnu-gcc (Debian 8.1.0-12) 8.1.0
  21    20.05 debian:experimental-x-mips64  : FAIL mips64-linux-gnuabi64-gcc (Debian 8.1.0-12) 8.1.0
  22    22.85 debian:experimental-x-mipsel  : FAIL mipsel-linux-gnu-gcc (Debian 8.1.0-12) 8.1.0

CC /tmp/build/perf/tests/bp_account.o
CC /tmp/build/perf/tests/wp.o
tests/wp.c:5:10: fatal error: arch-tests.h: No such file or directory

 #include "arch-tests.h"
          ^~~~~~~~~~~~~~

compilation terminated.
mv: cannot stat '/tmp/build/perf/tests/.wp.o.tmp': No such file or directory make[4]: *** [/git/linux/tools/build/Makefile.build:97: /tmp/build/perf/tests/wp.o] Error 1 make[4]: *** Waiting for unfinished jobs....
CC /tmp/build/perf/util/record.o
CC /tmp/build/perf/util/srcline.o
make[3]: *** [/git/linux/tools/build/Makefile.build:139: tests] Error 2 make[2]: *** [Makefile.perf:507: /tmp/build/perf/perf-in.o] Error 2
make[2]: *** Waiting for unfinished jobs....

#5 lore raw
Quoted 12 lines · Arnaldo Carvalho de Melo

Em Mon, Sep 10, 2018 at 11:18:30AM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 10 lines

Em Mon, Sep 10, 2018 at 10:47:54AM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 9 lines

Em Mon, Sep 10, 2018 at 12:31:54PM +0200, Jiri Olsa escreveu:

Quoted 8 lines · Ravi Bangoria
Quoted 7 lines

Ex on powerpc:

  $ sudo ./perf test 22
  22: Watchpoint                                            :
  22.1: Read Only Watchpoint                                : Ok
  22.2: Write Only Watchpoint                               : Ok
  22.3: Read / Write Watchpoint                             : Ok
  22.4: Modify Watchpoint                                   : Ok
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

cool, thanks!

Thanks, applied.

Oops, fails when cross-building it to mips, I'll try to fix after lunch:

Sorry for bit late reply. Will send v2 with the fix.

Thanks
Ravi

Quoted 22 lines
  18   109.48 debian:experimental           : Ok   gcc (Debian 8.2.0-4) 8.2.0
  19    42.66 debian:experimental-x-arm64   : Ok   aarch64-linux-gnu-gcc (Debian 8.1.0-12) 8.1.0
  20    22.33 debian:experimental-x-mips    : FAIL mips-linux-gnu-gcc (Debian 8.1.0-12) 8.1.0
  21    20.05 debian:experimental-x-mips64  : FAIL mips64-linux-gnuabi64-gcc (Debian 8.1.0-12) 8.1.0
  22    22.85 debian:experimental-x-mipsel  : FAIL mipsel-linux-gnu-gcc (Debian 8.1.0-12) 8.1.0

CC /tmp/build/perf/tests/bp_account.o
CC /tmp/build/perf/tests/wp.o
tests/wp.c:5:10: fatal error: arch-tests.h: No such file or directory

 #include "arch-tests.h"
          ^~~~~~~~~~~~~~

compilation terminated.
mv: cannot stat '/tmp/build/perf/tests/.wp.o.tmp': No such file or directory make[4]: *** [/git/linux/tools/build/Makefile.build:97: /tmp/build/perf/tests/wp.o] Error 1 make[4]: *** Waiting for unfinished jobs....
CC /tmp/build/perf/util/record.o
CC /tmp/build/perf/util/srcline.o
make[3]: *** [/git/linux/tools/build/Makefile.build:139: tests] Error 2 make[2]: *** [Makefile.perf:507: /tmp/build/perf/perf-in.o] Error 2
make[2]: *** Waiting for unfinished jobs....

#6 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 10 lines

While testing, I got curious, as a 'perf test' user, why one of the tests had the "Skip" result:

[root@seventh ~]# perf test watchpoint

22: Watchpoint                                            :
22.1: Read Only Watchpoint                                : Skip
22.2: Write Only Watchpoint                               : Ok
22.3: Read / Write Watchpoint                             : Ok
22.4: Modify Watchpoint                                   : Ok
Quoted 6 lines

[root@seventh ~]#

I tried with 'perf test -v watchpoint' but that didn't help, perhaps you could add some message after the "Skip" telling why it skipped that test? I.e. hardware doesn't have that capability, kernel driver not yet supporting that, something else?

Sure will add a message:

pr_debug("Hardware does not support read only watchpoints.");

Ravi