perf bench breakpoint: Skip run if no breakpoints available
authorKajol Jain <kjain@linux.ibm.com>
Wed, 23 Aug 2023 07:51:03 +0000 (13:21 +0530)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 23 Aug 2023 11:39:02 +0000 (08:39 -0300)
commit9823ae6f68786aff4fbe870897aee1abc0b01fda
tree245c603559f88bc79c2bae1c9eed886c7ef8cee7
parent7a46404b3c01e61807f69a02c81a9e3f3a1b9b0f
perf bench breakpoint: Skip run if no breakpoints available

Based on commit 7d54a4acd8c1de3e ("perf test: Skip watchpoint tests if
no watchpoints available"), hardware breakpoints are not available for
power9 platform and because of that 'perf bench breakpoint' run fails on
power9 platform.

Add code to check for the return value of perf_event_open() in the
breakpoint run and skip the 'perf bench breakpoint' run, if hardware
breakpoints are not available.

Result on power9 system before patch changes:

  [command]# perf bench breakpoint thread
  perf_event_open: No such device

Result on power9 system after patch changes:

  [command]# ./perf bench breakpoint thread
  Skipping perf bench breakpoint thread: No hardware support

Reported-by: Disha Goel <disgoel@linux.vnet.ibm.com>
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
Acked-by: Naveen N Rao <naveen@kernel.org>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Disha Goel <disgoel@linux.ibm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230823075103.190565-1-kjain@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/bench/breakpoint.c