linux/tools/perf/bench
Athira Rajeev 394e4306b0 perf bench numa: Fix the condition checks for max number of NUMA nodes
In systems having higher node numbers available like node
255, perf numa bench will fail with SIGABORT.

  <<>>
  perf: bench/numa.c:1416: init: Assertion `!(g->p.nr_nodes > 64 || g->p.nr_nodes < 0)' failed.
  Aborted (core dumped)
  <<>>

Snippet from 'numactl -H' below on a powerpc system where the highest
node number available is 255:

  available: 6 nodes (0,8,252-255)
  node 0 cpus: <cpu-list>
  node 0 size: 519587 MB
  node 0 free: 516659 MB
  node 8 cpus: <cpu-list>
  node 8 size: 523607 MB
  node 8 free: 486757 MB
  node 252 cpus:
  node 252 size: 0 MB
  node 252 free: 0 MB
  node 253 cpus:
  node 253 size: 0 MB
  node 253 free: 0 MB
  node 254 cpus:
  node 254 size: 0 MB
  node 254 free: 0 MB
  node 255 cpus:
  node 255 size: 0 MB
  node 255 free: 0 MB
  node distances:
  node   0   8  252  253  254  255

Note: <cpu-list> expands to actual cpu list in the original output.
These nodes 252-255 are to represent the memory on GPUs and are valid
nodes.

The perf numa bench init code has a condition check to see if the number
of NUMA nodes (nr_nodes) exceeds MAX_NR_NODES. The value of MAX_NR_NODES
defined in perf code is 64. And the 'nr_nodes' is the value from
numa_max_node() which represents the highest node number available in the
system. In some systems where we could have NUMA node 255, this condition
check fails and results in SIGABORT.

The numa benchmark uses static value of MAX_NR_NODES in the code to
represent size of two NUMA node arrays and node bitmask used for setting
memory policy. Patch adds a fix to dynamically allocate size for the
two arrays and bitmask value based on the node numbers available in the
system. With the fix, perf numa benchmark will work with node configuration
on any system and thus removes the static MAX_NR_NODES value.

Signed-off-by: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Reviewed-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Link: http://lore.kernel.org/lkml/1614271802-1503-1-git-send-email-atrajeev@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-03-06 16:54:25 -03:00
..
bench.h perf bench: Add build-id injection benchmark 2020-10-13 10:59:42 -03:00
Build perf tools changes for v5.10: 1st batch 2020-10-17 11:47:46 -07:00
epoll-ctl.c perf env: Remove unneeded internal/cpumap inclusions 2021-02-12 17:35:48 -03:00
epoll-wait.c perf env: Remove unneeded internal/cpumap inclusions 2021-02-12 17:35:48 -03:00
find-bit-bench.c perf bench: Fix a couple of spelling mistakes in options text 2020-08-12 09:10:25 -03:00
futex-hash.c perf env: Remove unneeded internal/cpumap inclusions 2021-02-12 17:35:48 -03:00
futex-lock-pi.c perf env: Remove unneeded internal/cpumap inclusions 2021-02-12 17:35:48 -03:00
futex-requeue.c perf env: Remove unneeded internal/cpumap inclusions 2021-02-12 17:35:48 -03:00
futex-wake-parallel.c perf env: Remove unneeded internal/cpumap inclusions 2021-02-12 17:35:48 -03:00
futex-wake.c perf env: Remove unneeded internal/cpumap inclusions 2021-02-12 17:35:48 -03:00
futex.h perf bench: Move HAVE_PTHREAD_ATTR_SETAFFINITY_NP into bench.h 2018-11-21 12:00:32 -03:00
inject-buildid.c perf tools: Pass build_id object to filename__read_build_id() 2020-10-14 08:45:16 -03:00
kallsyms-parse.c perf bench: Add kallsyms parsing 2020-05-05 16:35:32 -03:00
mem-functions.c perf bench mem: Always memset source before memcpy 2020-08-13 09:34:26 -03:00
mem-memcpy-arch.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mem-memcpy-x86-64-asm-def.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mem-memcpy-x86-64-asm.S tools arch: Update arch/x86/lib/mem{cpy,set}_64.S copies used in 'perf bench mem memcpy' 2020-11-12 17:55:41 -03:00
mem-memset-arch.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mem-memset-x86-64-asm-def.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mem-memset-x86-64-asm.S tools arch: Update arch/x86/lib/mem{cpy,set}_64.S copies used in 'perf bench mem memcpy' 2020-11-12 17:55:41 -03:00
numa.c perf bench numa: Fix the condition checks for max number of NUMA nodes 2021-03-06 16:54:25 -03:00
sched-messaging.c perf tools: Cast (struct timeval).tv_sec when printing 2021-03-06 16:54:24 -03:00
sched-pipe.c perf tools: Cast (struct timeval).tv_sec when printing 2021-03-06 16:54:24 -03:00
synthesize.c perf bench: The do_run_multi_threaded() function must use IS_ERR(perf_session__new()) 2020-09-03 15:55:56 -03:00
syscall.c perf tools: Cast (struct timeval).tv_sec when printing 2021-03-06 16:54:24 -03:00