Hi Damjan,
We observed a failure when creating avf interfaces on two types of Arm CPUs, 
both are SMP system, only one numa-id.

Function vlib_pci_get_device_info() reads '/sys/bus/pci/devices/<devices 
id>/numa_node' to check which numa_node a NIC device resides in.
But on SMP system, -1 is returned as below example, and then later VPP uses -1 
to access some arrays which causes memory out-of-bound issue.

It seems that -1 is returned where the kernel doesn't have NUMA node 
information, and the kernel ABI documents -1 as a valid return value here:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/ABI/testing/sysfs-bus-pci#n285

Is it ok to just set di->numa_node to 0, if '/sys/bus/pci/devices/<devices 
id>/numa_node' returns -1 and there is only one numa node by checking 
'/sys/devices/system/node/online'?
  if (-1 == di->numa_node)
  {
    if ((err = clib_sysfs_read ("/sys/devices/system/node/online", "%U",
                                                 unformat_bitmap_list, &bmp)))
      clib_error_free (err);
    if (clib_bitmap_count_set_bits (bmp) == 1)
      di->numa_node = 0;
  }

$ cat /sys/bus/pci/devices/0000:03:00.0/numa_node
-1
$ cat /sys/devices/system/node/online
0
$ lscpu
Architecture:        aarch64
Byte Order:          Little Endian
CPU(s):              4
On-line CPU(s) list: 0-3
Thread(s) per core:  2
Core(s) per socket:  2
Socket(s):           1
NUMA node(s):        1
Vendor ID:           ARM
Model:               0
Stepping:            r1p0
BogoMIPS:            100.00
L1d cache:           64K
L1i cache:           64K
L2 cache:            1024K
L3 cache:            1024K
L4 cache:            8192K
NUMA node0 CPU(s):   0-3
Flags:               fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp 
asimdhp cpuid asimdrdm lrcpc dcpop asimddp

Thanks.
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#15739): https://lists.fd.io/g/vpp-dev/message/15739
Mute This Topic: https://lists.fd.io/mt/71898582/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to