Bug #7137
open"invalid cpu range" when trying to use CPU affinity
Description
More info: https://forum.suricata.io/t/cpu-affinity-with/4615
In a nutshell, I have this NUMA layout:
root# lscpu | grep NUMA
NUMA node(s): 2
NUMA node0 CPU(s): 0,2,4,6,8,10,12,14,16,18
NUMA node1 CPU(s): 1,3,5,7,9,11,13,15,17,19
The documentation (https://docs.suricata.io/en/latest/performance/high-performance-config.html) shows the following:
threading:
cpu-affinity:
- management-cpu-set:
cpu: [ "1-10" ] # include only these CPUs in affinity settings
- receive-cpu-set:
cpu: [ "0-10" ] # include only these CPUs in affinity settings
- worker-cpu-set:
cpu: [ "18-35", "54-71" ]
mode: "exclusive"
prio:
low: [ 0 ]
medium: [ "1" ]
high: [ "18-35","54-71" ]
default: "high"
When I apply this line high: [ "0,2,4,6,8,10,12,14,16", "1,3,5,7,9,11,13,15,17" ]
, Suricata fails to start with the error:
Error: affinity: worker-cpu-set: invalid cpu range (not an integer): "0,2,4,6,8,10,12,14,16"
How can I define these NUMA nodes? The documentation shows a way, but the software does not accept it in the configuration. Only consequtive CPU ranges work, e.g. "0-5", "10-15"
, but that's not how my NUMA looks like.
I'm using Debian 12 with Suricata 7.0.6-1~bpo12+1.
Updated by Victor Julien 5 months ago
You'll have to make it a proper yaml list
cpu: [ "0", "2", "4", ... ]
Updated by Victor Julien 5 months ago
- Related to Feature #6805: cpu-affinity: enhance CPU affinity logic with per-interface NUMA preferences added
- Related to Feature #7036: DPDK NUMA setup: choose correct CPUs from worker-cpu-set added
Updated by UPPER KEES 5 months ago ยท Edited
Victor Julien wrote in #note-2:
You'll have to make it a proper yaml list
[...]
That would make Suricata process the yaml list, but how would Suricata then still differentiate between the 2 different NUMA node sets? Wouldn't your suggested syntax be equal to defining 0-19?
At the moment I have 2 NICs connected, each one to a different NUMA node.
# cat /sys/class/net/enp130s0f1/device/numa_node
1
# cat /sys/class/net/eno1/device/numa_node
0
I want to able to configure 2 worker sets, each one attached to its NUMA node. The documentation shows that e.g. high: [ "18-35","54-71" ]
can be used. When using cpu: [ "0", "2", "4", ... ]
there wouldn't be 2 individual sets defined. Or am I still missing something from your example?
Updated by Jeff Lucovsky 5 months ago
Using Victor's suggestion, you can assign CPU workers to different cores (hence, numa nodes). Alternatively, you can use "0-19".
However, in the forum post you state that you want to use the even (odd) numbered cores for numa node 0 (1). Suricata doesn't support this.
@Lukas Sismis stated that you'd have to use 2 suricata instances (each with their own configuration file and NIC setting).