27 #define _THREAD_AFFINITY
40 .
name =
"receive-cpu-set",
46 .name =
"worker-cpu-set",
52 .name =
"verdict-cpu-set",
58 .name =
"management-cpu-set",
68 #if !defined __CYGWIN__ && !defined OS_WIN32 && !defined __OpenBSD__ && !defined sun
70 static hwloc_topology_t topology = NULL;
78 if (new_affinity == NULL) {
79 FatalError(
"Unable to allocate memory for new CPU affinity type");
83 if (new_affinity->
name == NULL) {
84 FatalError(
"Unable to allocate memory for new CPU affinity type name");
86 new_affinity->
parent = parent;
90 new_affinity->
lcpu[i] = 0;
103 FatalError(
"Unable to reallocate memory for children CPU affinity types");
116 if (parent == NULL || interface_name == NULL || parent->
nb_children == 0 ||
121 for (uint32_t i = 0; i < parent->
nb_children; i++) {
123 strcmp(parent->
children[i]->
name, interface_name) == 0) {
140 if (
name == NULL || *
name ==
'\0') {
152 if (parent_affinity == NULL) {
157 if (interface_name != NULL) {
161 return child_affinity;
164 return parent_affinity;
178 const char *
name,
const char *interface_name)
190 if (parent_affinity == NULL) {
195 if (interface_name != NULL) {
198 if (child_affinity != NULL) {
199 return child_affinity;
203 return AllocAndInitAffinityType(
name, interface_name, parent_affinity);
206 return parent_affinity;
209 #if !defined __CYGWIN__ && !defined OS_WIN32 && !defined __OpenBSD__ && !defined sun
210 static void AffinitySetupInit(
void)
220 for (j = 0; j < ncpu; j++) {
228 const char *
name,
SCConfNode *node,
void (*Callback)(
int i,
void *data),
void *data)
239 if (!strcmp(lnode->
val,
"all")) {
243 }
else if (strchr(lnode->
val,
'-') != NULL) {
244 char *sep = strchr(lnode->
val,
'-');
258 SCLogError(
"%s: upper bound (%d) of cpu set is too high, only %d cpu(s)",
name, b,
269 for (i = a; i<= b; i++) {
279 static void AffinityCallback(
int i,
void *data)
281 CPU_SET(i, (cpu_set_t *)data);
284 static int BuildCpuset(
const char *
name,
SCConfNode *node, cpu_set_t *cpu)
292 static const char *GetAffinitySetName(
const char *val)
294 if (strcmp(val,
"decode-cpu-set") == 0 || strcmp(val,
"stream-cpu-set") == 0 ||
295 strcmp(val,
"reject-cpu-set") == 0 || strcmp(val,
"output-cpu-set") == 0) {
299 return (strcmp(val,
"detect-cpu-set") == 0) ?
"worker-cpu-set" : val;
309 if (cpu_node != NULL) {
310 if (BuildCpuset(setname, cpu_node, &taf->
cpu_set) < 0) {
311 SCLogWarning(
"Failed to parse CPU set for %s", setname);
314 SCLogWarning(
"Unable to find 'cpu' node for set %s", setname);
322 const char *priority, cpu_set_t *cpuset,
const char *setname)
326 if (BuildCpuset(setname, node, cpuset) < 0) {
327 SCLogWarning(
"Failed to parse %s priority CPU set for %s", priority, setname);
330 SCLogDebug(
"Unable to find '%s' priority for set %s", priority, setname);
338 static int SetupDefaultPriority(
342 if (default_node == NULL) {
346 if (strcmp(default_node->
val,
"low") == 0) {
348 }
else if (strcmp(default_node->
val,
"medium") == 0) {
350 }
else if (strcmp(default_node->
val,
"high") == 0) {
353 SCLogError(
"Unknown default CPU affinity priority: %s", default_node->
val);
357 SCLogConfig(
"Using default priority '%s' for set %s", default_node->
val, setname);
365 static int SetupAffinityPriority(
372 if (prio_node == NULL) {
376 BuildPriorityCpuset(taf, prio_node,
"low", &taf->
lowprio_cpu, setname);
377 BuildPriorityCpuset(taf, prio_node,
"medium", &taf->
medprio_cpu, setname);
378 BuildPriorityCpuset(taf, prio_node,
"high", &taf->
hiprio_cpu, setname);
379 return SetupDefaultPriority(taf, prio_node, setname);
389 if (mode_node == NULL) {
393 if (strcmp(mode_node->
val,
"exclusive") == 0) {
395 }
else if (strcmp(mode_node->
val,
"balanced") == 0) {
411 if (threads_node == NULL) {
431 static char rootpath[] =
"threading.cpu-affinity";
432 static char path[1024] = { 0 };
433 char subpath[256] = { 0 };
439 if (taf->
parent != NULL) {
441 subpath,
sizeof(subpath),
"%s.interface-specific-cpu-set.", taf->
parent->
name);
442 if (r < 0 || r >= (
long)
sizeof(subpath)) {
451 long r = snprintf(path,
sizeof(path),
"%s.%s%s", rootpath, subpath, taf->
name);
452 if (r < 0 || r >= (
long)
sizeof(path)) {
453 SCLogError(
"Unable to build YAML path for CPU affinity %s", taf->
name);
470 static bool IsWorkerCpuSet(
const char *setname)
472 return (strcmp(setname,
"worker-cpu-set") == 0);
478 static bool IsReceiveCpuSet(
const char *setname)
480 return (strcmp(setname,
"receive-cpu-set") == 0);
494 const char *interface_name = NULL;
496 if (strcmp(child_node->
name,
"interface") == 0) {
497 interface_name = child_node->
val;
501 if (interface_name == NULL) {
507 if (iface_taf == NULL) {
508 SCLogError(
"Failed to allocate CPU affinity type for interface: %s", interface_name);
512 SetupCpuSets(iface_taf, iface_node, interface_name);
513 if (SetupAffinityPriority(iface_taf, iface_node, interface_name) < 0) {
516 if (SetupAffinityMode(iface_taf, iface_node) < 0) {
519 if (SetupAffinityThreads(iface_taf, iface_node) < 0) {
531 char if_af[] =
"interface-specific-cpu-set";
533 if (per_iface_node == NULL) {
539 if (strcmp(iface_node->
val,
"interface") == 0) {
540 if (SetupSingleIfaceAffinity(taf, iface_node) < 0) {
555 static bool AffinityConfigIsLegacy(
void)
557 static bool is_using_legacy_affinity_format =
false;
560 is_using_legacy_affinity_format =
false;
562 return is_using_legacy_affinity_format;
567 return is_using_legacy_affinity_format;
575 if (strstr(affinity->
name,
"-cpu-set") == NULL) {
576 is_using_legacy_affinity_format =
true;
577 return is_using_legacy_affinity_format;
581 return is_using_legacy_affinity_format;
590 #if !defined __CYGWIN__ && !defined OS_WIN32 && !defined __OpenBSD__ && !defined sun
593 AffinityConfigIsLegacy();
606 char *v = AffinityConfigIsLegacy() ? affinity->
val : affinity->
name;
607 const char *setname = GetAffinitySetName(v);
608 if (setname == NULL) {
614 SCLogError(
"Failed to allocate CPU affinity type: %s", setname);
618 SCLogConfig(
"Found CPU affinity definition for \"%s\"", setname);
620 SCConfNode *aff_query_node = AffinityConfigIsLegacy() ? affinity->head.tqh_first : affinity;
621 SetupCpuSets(taf, aff_query_node, setname);
622 if (SetupAffinityPriority(taf, aff_query_node, setname) < 0) {
623 SCLogError(
"Failed to setup priority for CPU affinity type: %s", setname);
626 if (SetupAffinityMode(taf, aff_query_node) < 0) {
627 SCLogError(
"Failed to setup mode for CPU affinity type: %s", setname);
630 if (SetupAffinityThreads(taf, aff_query_node) < 0) {
631 SCLogError(
"Failed to setup threads for CPU affinity type: %s", setname);
635 if (!AffinityConfigIsLegacy() && (IsWorkerCpuSet(setname) || IsReceiveCpuSet(setname))) {
636 if (SetupPerIfaceAffinity(taf, affinity) < 0) {
637 SCLogError(
"Failed to setup per-interface affinity for CPU affinity type: %s",
646 #if !defined __CYGWIN__ && !defined OS_WIN32 && !defined __OpenBSD__ && !defined sun
648 static int HwLocDeviceNumaGet(hwloc_topology_t topo, hwloc_obj_t obj)
650 #if HWLOC_VERSION_MAJOR >= 2 && HWLOC_VERSION_MINOR >= 5
653 struct hwloc_location location;
655 location.type = HWLOC_LOCATION_TYPE_OBJECT;
656 location.location.object = obj;
658 int result = hwloc_get_local_numanode_objs(topo, &location, &num_nodes, nodes, 0);
659 if (result == 0 && num_nodes > 0 && num_nodes <=
MAX_NUMA_NODES) {
660 return nodes[0]->logical_index;
665 hwloc_obj_t non_io_ancestor = hwloc_get_non_io_ancestor_obj(topo, obj);
666 if (non_io_ancestor == NULL) {
671 hwloc_obj_t numa_node = NULL;
672 while ((numa_node = hwloc_get_next_obj_by_type(topo, HWLOC_OBJ_NUMANODE, numa_node)) != NULL) {
673 if (hwloc_bitmap_isset(non_io_ancestor->nodeset, numa_node->os_index)) {
674 return numa_node->logical_index;
681 static hwloc_obj_t HwLocDeviceGetByKernelName(hwloc_topology_t topo,
const char *interface_name)
683 hwloc_obj_t obj = NULL;
685 while ((obj = hwloc_get_next_osdev(topo, obj)) != NULL) {
686 if (obj->attr->osdev.type == HWLOC_OBJ_OSDEV_NETWORK &&
687 strcmp(obj->name, interface_name) == 0) {
688 hwloc_obj_t parent = obj->parent;
690 if (parent->type == HWLOC_OBJ_PCI_DEVICE) {
693 parent = parent->parent;
709 static int PcieAddressToComponents(
const char *pcie_address,
unsigned int *domain,
710 unsigned int *bus,
unsigned int *device,
unsigned int *
function)
713 if (sscanf(pcie_address,
"%x:%x:%x.%x", domain, bus, device,
function) != 4) {
714 if (sscanf(pcie_address,
"%x:%x.%x", bus, device,
function) != 3) {
723 static hwloc_obj_t HwLocDeviceGetByPcie(hwloc_topology_t topo,
const char *pcie_address)
725 hwloc_obj_t obj = NULL;
726 unsigned int domain, bus, device,
function;
727 int r = PcieAddressToComponents(pcie_address, &domain, &bus, &device, &
function);
729 while ((obj = hwloc_get_next_pcidev(topo, obj)) != NULL) {
730 if (obj->attr->pcidev.domain == domain && obj->attr->pcidev.bus == bus &&
731 obj->attr->pcidev.dev == device && obj->attr->pcidev.func ==
function) {
739 static void HwlocObjectDump(hwloc_obj_t obj,
const char *iface_name)
742 SCLogDebug(
"No object found for the given PCIe address.\n");
746 static char pcie_address[32];
747 snprintf(pcie_address,
sizeof(pcie_address),
"%04x:%02x:%02x.%x", obj->attr->pcidev.domain,
748 obj->attr->pcidev.bus, obj->attr->pcidev.dev, obj->attr->pcidev.func);
749 SCLogDebug(
"Interface (%s / %s) has NUMA ID %d", iface_name, pcie_address,
750 HwLocDeviceNumaGet(topology, obj));
752 SCLogDebug(
"Object type: %s\n", hwloc_obj_type_string(obj->type));
753 SCLogDebug(
"Logical index: %u\n", obj->logical_index);
756 if (obj->type == HWLOC_OBJ_PCI_DEVICE) {
757 SCLogDebug(
" Domain: %04x\n", obj->attr->pcidev.domain);
758 SCLogDebug(
" Bus: %02x\n", obj->attr->pcidev.bus);
759 SCLogDebug(
" Device: %02x\n", obj->attr->pcidev.dev);
760 SCLogDebug(
" Function: %01x\n", obj->attr->pcidev.func);
761 SCLogDebug(
" Class ID: %04x\n", obj->attr->pcidev.class_id);
762 SCLogDebug(
" Vendor ID: %04x\n", obj->attr->pcidev.vendor_id);
763 SCLogDebug(
" Device ID: %04x\n", obj->attr->pcidev.device_id);
764 SCLogDebug(
" Subvendor ID: %04x\n", obj->attr->pcidev.subvendor_id);
765 SCLogDebug(
" Subdevice ID: %04x\n", obj->attr->pcidev.subdevice_id);
766 SCLogDebug(
" Revision: %02x\n", obj->attr->pcidev.revision);
767 SCLogDebug(
" Link speed: %f GB/s\n", obj->attr->pcidev.linkspeed);
769 SCLogDebug(
" No PCI device attributes available.\n");
789 static int TopologyInitialize(
void)
791 if (topology == NULL) {
792 if (hwloc_topology_init(&topology) == -1) {
797 if (hwloc_topology_set_flags(topology, HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM) == -1 ||
798 hwloc_topology_set_io_types_filter(topology, HWLOC_TYPE_FILTER_KEEP_ALL) == -1 ||
799 hwloc_topology_load(topology) == -1) {
801 hwloc_topology_destroy(topology);
811 if (topology != NULL) {
812 hwloc_topology_destroy(topology);
819 hwloc_obj_t if_obj = HwLocDeviceGetByKernelName(topology,
tv->
iface_name);
820 if (if_obj == NULL) {
821 if_obj = HwLocDeviceGetByPcie(topology,
tv->
iface_name);
828 int32_t numa_id = HwLocDeviceNumaGet(topology, if_obj);
845 static bool CPUIsFromNuma(uint16_t ncpu, uint16_t numa)
849 int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NUMANODE);
850 hwloc_obj_t numa_node = NULL;
852 uint16_t found_numa = 0;
855 if (depth == HWLOC_TYPE_DEPTH_UNKNOWN) {
859 while ((numa_node = hwloc_get_next_obj_by_depth(topology, depth, numa_node)) != NULL) {
860 hwloc_cpuset_t cpuset = hwloc_bitmap_alloc();
861 if (cpuset == NULL) {
865 hwloc_bitmap_copy(cpuset, numa_node->cpuset);
867 if (hwloc_bitmap_isset(cpuset, core_id)) {
868 SCLogDebug(
"Core %d - NUMA %d", core_id, numa_node->logical_index);
870 found_numa = numa_node->logical_index;
871 hwloc_bitmap_free(cpuset);
874 hwloc_bitmap_free(cpuset);
878 if (found && numa == found_numa) {
898 uint16_t cpu = taf->
lcpu[numa_node];
900 (!CPU_ISSET(cpu, &taf->
cpu_set) || !CPUIsFromNuma(cpu, (uint16_t)numa_node))) {
904 taf->
lcpu[numa_node] =
905 (CPU_ISSET(cpu, &taf->
cpu_set) && CPUIsFromNuma(cpu, (uint16_t)numa_node))
908 return (CPU_ISSET(cpu, &taf->
cpu_set) && CPUIsFromNuma(cpu, (uint16_t)numa_node)) ? (int16_t)cpu
914 if (iface_numa != -1) {
915 return FindCPUInNumaNode(iface_numa, taf);
923 if (iface_numa == nid) {
927 int16_t cpu = FindCPUInNumaNode(nid, taf);
929 SCLogPerf(
"CPU %d from NUMA %d assigned to a network interface located on NUMA %d", cpu,
948 uint16_t cpu = taf->
lcpu[0];
952 while (!CPU_ISSET(cpu, &taf->
cpu_set) && attempts < 2) {
953 cpu = (cpu + 1) % num_procs;
960 taf->
lcpu[0] = cpu + 1;
966 uint16_t attempts = 0;
968 while (attempts < 2) {
969 cpu = CPUSelectFromNuma(iface_numa, taf);
971 cpu = CPUSelectAlternative(iface_numa, taf);
980 return (uint16_t)cpu;
983 return CPUSelectDefault(taf);
988 if (iface_numa < 0) {
989 return CPUSelectDefault(taf);
992 return CPUSelectFromNumaOrDefault(iface_numa, taf);
995 static bool AutopinEnabled(
void)
1001 return (
bool)autopin;
1009 #if !defined __CYGWIN__ && !defined OS_WIN32 && !defined __OpenBSD__ && !defined sun
1010 int iface_numa = -1;
1011 if (AutopinEnabled()) {
1013 if (TopologyShouldAutopin(
tv, taf)) {
1014 if (TopologyInitialize() < 0) {
1015 SCLogError(
"Failed to initialize topology for CPU affinity");
1018 iface_numa = InterfaceGetNumaNode(
tv);
1021 static bool printed =
false;
1025 "threading.autopin option is enabled but hwloc support is not compiled in. "
1026 "Make sure to pass --enable-hwloc to configure when building Suricata.");
1032 ncpu = GetNextAvailableCPU(iface_numa, taf);
1033 SCLogDebug(
"Setting affinity on CPU %d", ncpu);
1046 #if !defined __CYGWIN__ && !defined OS_WIN32 && !defined __OpenBSD__ && !defined sun
1049 if (CPU_ISSET(i, &taf->
cpu_set)) {
1077 if (CPU_ISSET(i, &tmpcset)) {
1103 #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
1109 static void ResetAffinityForTest(
void)
1140 taf->
name =
"management-cpu-set";
1142 taf->
name =
"worker-cpu-set";
1144 taf->
name =
"verdict-cpu-set";
1146 taf->
name =
"receive-cpu-set";
1158 static int ThreadingAffinityTest01(
void)
1162 ResetAffinityForTest();
1163 const char *config =
"%YAML 1.1\n"
1167 " management-cpu-set:\n"
1169 " worker-cpu-set:\n"
1170 " cpu: [ 1, 2, 3 ]\n";
1194 static int ThreadingAffinityTest02(
void)
1198 ResetAffinityForTest();
1200 const char *config =
"%YAML 1.1\n"
1204 " - worker-cpu-set:\n"
1223 static int ThreadingAffinityTest03(
void)
1227 ResetAffinityForTest();
1229 const char *config =
"%YAML 1.1\n"
1233 " worker-cpu-set:\n"
1234 " cpu: [ \"0-3\" ]\n";
1253 static int ThreadingAffinityTest04(
void)
1257 ResetAffinityForTest();
1259 const char *config =
"%YAML 1.1\n"
1263 " worker-cpu-set:\n"
1264 " cpu: [ 1, 3, 5 ]\n";
1285 static int ThreadingAffinityTest05(
void)
1289 ResetAffinityForTest();
1291 const char *config =
"%YAML 1.1\n"
1295 " worker-cpu-set:\n"
1296 " cpu: [ \"all\" ]\n";
1311 static int ThreadingAffinityTest06(
void)
1315 ResetAffinityForTest();
1317 const char *config =
"%YAML 1.1\n"
1321 " worker-cpu-set:\n"
1322 " cpu: [ 0, 1, 2, 3 ]\n"
1325 " medium: [ \"1-2\" ]\n"
1327 " default: \"medium\"\n";
1346 static int ThreadingAffinityTest07(
void)
1350 ResetAffinityForTest();
1352 const char *config =
"%YAML 1.1\n"
1356 " worker-cpu-set:\n"
1358 " mode: \"exclusive\"\n";
1373 static int ThreadingAffinityTest08(
void)
1377 ResetAffinityForTest();
1379 const char *config =
"%YAML 1.1\n"
1383 " worker-cpu-set:\n"
1384 " cpu: [ 0, 1, 2 ]\n"
1400 static int ThreadingAffinityTest09(
void)
1404 ResetAffinityForTest();
1406 const char *config =
"%YAML 1.1\n"
1410 " worker-cpu-set:\n"
1412 " interface-specific-cpu-set:\n"
1413 " - interface: \"eth0\"\n"
1415 " mode: \"exclusive\"\n";
1437 static int ThreadingAffinityTest10(
void)
1441 ResetAffinityForTest();
1443 const char *config =
"%YAML 1.1\n"
1447 " receive-cpu-set:\n"
1449 " interface-specific-cpu-set:\n"
1450 " - interface: \"eth0\"\n"
1452 " - interface: \"eth1\"\n"
1461 bool eth0_found =
false, eth1_found =
false;
1463 for (uint32_t i = 0; i < receive_taf->
nb_children; i++) {
1465 if (strcmp(iface_taf->
name,
"eth0") == 0) {
1466 if (CPU_ISSET(1, &iface_taf->
cpu_set) && CPU_ISSET(2, &iface_taf->
cpu_set) &&
1467 CPU_COUNT(&iface_taf->
cpu_set) == 2) {
1470 }
else if (strcmp(iface_taf->
name,
"eth1") == 0) {
1471 if (CPU_ISSET(3, &iface_taf->
cpu_set) && CPU_ISSET(4, &iface_taf->
cpu_set) &&
1472 CPU_COUNT(&iface_taf->
cpu_set) == 2) {
1487 static int ThreadingAffinityTest11(
void)
1491 ResetAffinityForTest();
1493 const char *config =
"%YAML 1.1\n"
1497 " worker-cpu-set:\n"
1499 " interface-specific-cpu-set:\n"
1500 " - interface: \"eth0\"\n"
1501 " cpu: [ 1, 2, 3 ]\n"
1503 " high: [ \"all\" ]\n"
1504 " default: \"high\"\n";
1526 static int ThreadingAffinityTest12(
void)
1530 ResetAffinityForTest();
1532 const char *config =
"%YAML 1.1\n"
1536 " management-cpu-set:\n"
1538 " receive-cpu-set:\n"
1540 " worker-cpu-set:\n"
1542 " interface-specific-cpu-set:\n"
1543 " - interface: \"eth0\"\n"
1544 " cpu: [ \"5-7\" ]\n"
1546 " high: [ \"all\" ]\n"
1547 " default: \"high\"\n"
1548 " verdict-cpu-set:\n"
1579 static int ThreadingAffinityTest13(
void)
1583 ResetAffinityForTest();
1585 const char *config =
"%YAML 1.1\n"
1589 " worker-cpu-set:\n"
1590 " cpu: [ \"invalid-cpu\" ]\n";
1605 static int ThreadingAffinityTest14(
void)
1609 ResetAffinityForTest();
1611 const char *config =
"%YAML 1.1\n"
1630 static int ThreadingAffinityTest15(
void)
1634 ResetAffinityForTest();
1636 const char *config =
"%YAML 1.1\n"
1640 " - management-cpu-set:\n"
1641 " cpu: [ \"3-1\" ]\n";
1656 static int ThreadingAffinityTest16(
void)
1660 ResetAffinityForTest();
1662 const char *config =
"%YAML 1.1\n"
1666 " - management-cpu-set:\n"
1668 " default: invalid_priority\n";
1681 static int ThreadingAffinityTest17(
void)
1685 ResetAffinityForTest();
1687 const char *config =
"%YAML 1.1\n"
1691 " - management-cpu-set:\n"
1692 " mode: invalid_mode\n";
1705 static int ThreadingAffinityTest18(
void)
1709 ResetAffinityForTest();
1711 const char *config =
"%YAML 1.1\n"
1715 " - management-cpu-set:\n"
1729 static int ThreadingAffinityTest19(
void)
1733 ResetAffinityForTest();
1735 const char *config =
"%YAML 1.1\n"
1739 " - management-cpu-set:\n"
1753 static int ThreadingAffinityTest20(
void)
1757 ResetAffinityForTest();
1759 const char *config =
"%YAML 1.1\n"
1763 " - management-cpu-set:\n"
1764 " threads: invalid_number\n";
1777 static int ThreadingAffinityTest21(
void)
1781 ResetAffinityForTest();
1783 const char *config =
"%YAML 1.1\n"
1787 " - management-cpu-set:\n"
1788 " cpu: [ 0-99999 ]\n";
1801 static int ThreadingAffinityTest22(
void)
1805 ResetAffinityForTest();
1807 const char *config =
"%YAML 1.1\n"
1811 " worker-cpu-set:\n"
1812 " interface-specific-cpu-set:\n"
1813 " - interface: eth0\n"
1815 " interface-specific-cpu-set:\n"
1816 " - interface: eth1\n"
1837 static int ThreadingAffinityTest23(
void)
1841 ResetAffinityForTest();
1843 const char *config =
"%YAML 1.1\n"
1847 " worker-cpu-set:\n"
1848 " cpu: [ 1, 2, 3 ]\n";
1874 static int ThreadingAffinityTest24(
void)
1878 ResetAffinityForTest();
1880 const char *config =
"%YAML 1.1\n"
1884 " - worker-cpu-set:\n"
1885 " interface-specific-cpu-set:\n"
1887 " mode: exclusive\n"
1888 " - interface_name: eth0\n"
1905 static int ThreadingAffinityTest25(
void)
1907 ResetAffinityForTest();
1917 FAIL_IF_NOT(child1 && child2 && child3 && child4);
1933 static int ThreadingAffinityTest26(
void)
1935 ResetAffinityForTest();
1938 memset(&test_taf, 0,
sizeof(test_taf));
1940 char long_name[1024];
1941 memset(long_name,
'a',
sizeof(long_name) - 1);
1942 long_name[
sizeof(long_name) - 1] =
'\0';
1943 test_taf.
name = long_name;
1949 FAIL_IF(path == NULL || strcmp(path,
"threading.cpu-affinity") != 0);
1958 static int ThreadingAffinityTest27(
void)
1962 ResetAffinityForTest();
1964 const char *config =
"%YAML 1.1\n"
1968 " management-cpu-set:\n"
1970 " - worker-cpu-set:\n"
1994 #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
1995 UtRegisterTest(
"ThreadingAffinityTest01", ThreadingAffinityTest01);
1996 UtRegisterTest(
"ThreadingAffinityTest02", ThreadingAffinityTest02);
1997 UtRegisterTest(
"ThreadingAffinityTest03", ThreadingAffinityTest03);
1998 UtRegisterTest(
"ThreadingAffinityTest04", ThreadingAffinityTest04);
1999 UtRegisterTest(
"ThreadingAffinityTest05", ThreadingAffinityTest05);
2000 UtRegisterTest(
"ThreadingAffinityTest06", ThreadingAffinityTest06);
2001 UtRegisterTest(
"ThreadingAffinityTest07", ThreadingAffinityTest07);
2002 UtRegisterTest(
"ThreadingAffinityTest08", ThreadingAffinityTest08);
2003 UtRegisterTest(
"ThreadingAffinityTest09", ThreadingAffinityTest09);
2004 UtRegisterTest(
"ThreadingAffinityTest10", ThreadingAffinityTest10);
2005 UtRegisterTest(
"ThreadingAffinityTest11", ThreadingAffinityTest11);
2006 UtRegisterTest(
"ThreadingAffinityTest12", ThreadingAffinityTest12);
2007 UtRegisterTest(
"ThreadingAffinityTest13", ThreadingAffinityTest13);
2008 UtRegisterTest(
"ThreadingAffinityTest14", ThreadingAffinityTest14);
2009 UtRegisterTest(
"ThreadingAffinityTest15", ThreadingAffinityTest15);
2010 UtRegisterTest(
"ThreadingAffinityTest16", ThreadingAffinityTest16);
2011 UtRegisterTest(
"ThreadingAffinityTest17", ThreadingAffinityTest17);
2012 UtRegisterTest(
"ThreadingAffinityTest18", ThreadingAffinityTest18);
2013 UtRegisterTest(
"ThreadingAffinityTest19", ThreadingAffinityTest19);
2014 UtRegisterTest(
"ThreadingAffinityTest20", ThreadingAffinityTest20);
2015 UtRegisterTest(
"ThreadingAffinityTest21", ThreadingAffinityTest21);
2016 UtRegisterTest(
"ThreadingAffinityTest22", ThreadingAffinityTest22);
2017 UtRegisterTest(
"ThreadingAffinityTest23", ThreadingAffinityTest23);
2018 UtRegisterTest(
"ThreadingAffinityTest24", ThreadingAffinityTest24);
2019 UtRegisterTest(
"ThreadingAffinityTest25", ThreadingAffinityTest25);
2020 UtRegisterTest(
"ThreadingAffinityTest26", ThreadingAffinityTest26);
2021 UtRegisterTest(
"ThreadingAffinityTest27", ThreadingAffinityTest27);