linux-stable/tools
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
..
accounting
arch tools headers UAPI s390: Sync ptrace.h kernel headers 2021-03-06 16:54:23 -03:00
bootconfig tools/bootconfig: Add tracing_on support to helper scripts 2021-01-14 10:32:20 -05:00
bpf New features: 2021-02-22 13:59:43 -08:00
build perf build: Move feature cleanup under tools/build 2021-03-06 16:54:24 -03:00
cgroup
debugging docs: Update documentation to reflect what TAINT_CPU_OUT_OF_SPEC means 2020-12-08 10:53:58 -07:00
edid
firewire
firmware
gpio tools: gpio: remove uAPI v1 code no longer used by selftests 2021-02-15 11:43:28 +01:00
hv
iio
include tools headers UAPI: Sync kvm.h headers with the kernel sources 2021-03-06 16:54:23 -03:00
io_uring
kvm/kvm_stat tools/kvm_stat: Exempt time-based counters 2020-12-11 19:18:51 -05:00
laptop
leds
lib New features: 2021-02-22 13:59:43 -08:00
memory-model tools/memory-model: Fix typo in klitmus7 compatibility table 2021-01-04 14:40:50 -08:00
objtool Rework of the X86 irq stack handling: 2021-02-24 16:32:23 -08:00
pci
pcmcia
perf perf bench numa: Fix the condition checks for max number of NUMA nodes 2021-03-06 16:54:25 -03:00
power platform-drivers-x86 for v5.12-1 2021-02-22 08:50:01 -08:00
scripts New features: 2021-02-22 13:59:43 -08:00
spi
testing * Doc fixes 2021-03-04 11:26:17 -08:00
thermal/tmon
time
tracing tracing/tools: fix a couple of spelling mistakes 2021-02-25 12:54:16 -05:00
usb
virtio tools/virtio: add barrier for aarch64 2020-12-18 16:14:30 -05:00
vm
wmi
Makefile tracing/tools: Add the latency-collector to tools directory 2021-02-12 11:52:59 -05:00