From 47cd3249e65dd2ea6859f95ee4f71a5a01099a0c Mon Sep 17 00:00:00 2001 From: jiangheng Date: Wed, 14 Dec 2022 10:12:14 +0800 Subject: [PATCH] fix kernel event thread bind numa failed (cherry picked from commit 260671c59a82ca12d63f635683c968b002c1ad92) --- ...kernel-event-thread-bind-numa-failed.patch | 134 ++++++++++++++++++ gazelle.spec | 6 +- 2 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 0154-fix-kernel-event-thread-bind-numa-failed.patch diff --git a/0154-fix-kernel-event-thread-bind-numa-failed.patch b/0154-fix-kernel-event-thread-bind-numa-failed.patch new file mode 100644 index 0000000..766f0ba --- /dev/null +++ b/0154-fix-kernel-event-thread-bind-numa-failed.patch @@ -0,0 +1,134 @@ +From be7a7d55a672a72328f1a6844c610152ea142053 Mon Sep 17 00:00:00 2001 +From: jianheng +Date: Wed, 14 Dec 2022 09:51:36 +0800 +Subject: [PATCH] fix kernel event thread bind numa failed + +--- + src/lstack/core/lstack_cfg.c | 13 +++++------- + src/lstack/core/lstack_protocol_stack.c | 28 ++++++++++--------------- + src/lstack/include/lstack_cfg.h | 3 ++- + 3 files changed, 18 insertions(+), 26 deletions(-) + +diff --git a/src/lstack/core/lstack_cfg.c b/src/lstack/core/lstack_cfg.c +index 1731c0f..81452e8 100644 +--- a/src/lstack/core/lstack_cfg.c ++++ b/src/lstack/core/lstack_cfg.c +@@ -329,11 +329,10 @@ static int32_t stack_idle_cpuset(struct protocol_stack *stack, cpu_set_t *exclud + return 0; + } + +-int32_t init_stack_numa_cpuset(void) ++int32_t init_stack_numa_cpuset(struct protocol_stack *stack) + { + int32_t ret; + struct cfg_params *cfg = get_global_cfg_params(); +- struct protocol_stack_group *stack_group = get_protocol_stack_group(); + + cpu_set_t stack_cpuset; + CPU_ZERO(&stack_cpuset); +@@ -344,12 +343,10 @@ int32_t init_stack_numa_cpuset(void) + CPU_SET(cfg->wakeup[idx], &stack_cpuset); + } + +- for (int32_t idx = 0; idx < stack_group->stack_num; ++idx) { +- ret = stack_idle_cpuset(stack_group->stacks[idx], &stack_cpuset); +- if (ret < 0) { +- LSTACK_LOG(ERR, LSTACK, "thread_get_cpuset stack_%d failed\n", idx); +- return -1; +- } ++ ret = stack_idle_cpuset(stack, &stack_cpuset); ++ if (ret < 0) { ++ LSTACK_LOG(ERR, LSTACK, "thread_get_cpuset stack(%u) failed\n", stack->tid); ++ return -1; + } + + return 0; +diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c +index d5830f1..c0925a1 100644 +--- a/src/lstack/core/lstack_protocol_stack.c ++++ b/src/lstack/core/lstack_protocol_stack.c +@@ -352,21 +352,18 @@ static struct protocol_stack *stack_thread_init(uint16_t queue_id) + } + + if (init_stack_value(stack, queue_id) != 0) { +- sem_post(&stack_group->thread_phase1); +- free(stack); +- return NULL; ++ goto END; + } + ++ if (init_stack_numa_cpuset(stack) < 0) { ++ goto END; ++ } + if (create_affiliate_thread(queue_id, stack_group->wakeup_enable) < 0) { +- sem_post(&stack_group->thread_phase1); +- free(stack); +- return NULL; ++ goto END; + } + + if (thread_affinity_init(stack->cpu_id) != 0) { +- sem_post(&stack_group->thread_phase1); +- free(stack); +- return NULL; ++ goto END; + } + RTE_PER_LCORE(_lcore_id) = stack->cpu_id; + +@@ -376,9 +373,7 @@ static struct protocol_stack *stack_thread_init(uint16_t queue_id) + + if (use_ltran()) { + if (client_reg_thrd_ring() != 0) { +- sem_post(&stack_group->thread_phase1); +- free(stack); +- return NULL; ++ goto END; + } + } + +@@ -394,6 +389,10 @@ static struct protocol_stack *stack_thread_init(uint16_t queue_id) + } + + return stack; ++END: ++ sem_post(&stack_group->thread_phase1); ++ free(stack); ++ return NULL; + } + + static void wakeup_kernel_event(struct protocol_stack *stack) +@@ -526,11 +525,6 @@ int32_t init_protocol_stack(void) + return -1; + } + +- ret = init_stack_numa_cpuset(); +- if (ret < 0) { +- return -1; +- } +- + return 0; + } + +diff --git a/src/lstack/include/lstack_cfg.h b/src/lstack/include/lstack_cfg.h +index 7075bbc..fe92bc9 100644 +--- a/src/lstack/include/lstack_cfg.h ++++ b/src/lstack/include/lstack_cfg.h +@@ -16,6 +16,7 @@ + + #include + ++#include "lstack_protocol_stack.h" + #include "gazelle_opt.h" + + #define BASE_BIN_SCALE 2 +@@ -97,6 +98,6 @@ int gazelle_copy_param(const char *param, bool is_double, + int *argc, char argv[][PATH_MAX]); + + int match_host_addr(uint32_t ipv4); +-int32_t init_stack_numa_cpuset(void); ++int32_t init_stack_numa_cpuset(struct protocol_stack *stack); + + #endif /* GAZELLE_NET_CFG_H */ +-- +2.33.0 + diff --git a/gazelle.spec b/gazelle.spec index 7d0bc2a..7e438a2 100644 --- a/gazelle.spec +++ b/gazelle.spec @@ -2,7 +2,7 @@ Name: gazelle Version: 1.0.1 -Release: 29 +Release: 30 Summary: gazelle is a high performance user-mode stack License: MulanPSL-2.0 URL: https://gitee.com/openeuler/gazelle @@ -168,6 +168,7 @@ Patch9150: 0150-add-pdump-support-in-ltran.patch Patch9151: 0151-dfx-gazellectl-add-pcb-wins-info.patch Patch9152: 0152-fix-genarate-out-event-untimely.patch Patch9153: 0153-rxtx-mbuf-pool-size-config-by-conf.patch +Patch9154: 0154-fix-kernel-event-thread-bind-numa-failed.patch %description %{name} is a high performance user-mode stack. @@ -208,6 +209,9 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b %config(noreplace) %{conf_path}/ltran.conf %changelog +* Wed Dec 14 2022 jiangheng - 1.0.1-30 +- fix kernel event thread bind nuam failed + * Tue Dec 13 2022 wuchangsheng - 1.0.1-29 - dfx add pcb windows info rxtx mbuf pool size config by conf