diff --git a/0225-POSIX-fix-select-timeout-disable-and-build-failed-in.patch b/0225-POSIX-fix-select-timeout-disable-and-build-failed-in.patch new file mode 100644 index 0000000..dc2d007 --- /dev/null +++ b/0225-POSIX-fix-select-timeout-disable-and-build-failed-in.patch @@ -0,0 +1,41 @@ +From a1d1d5a6d24748883cfe6bb7018681bc3af00f87 Mon Sep 17 00:00:00 2001 +From: yinbin +Date: Mon, 22 Jul 2024 15:13:22 +0800 +Subject: [PATCH] POSIX: fix select timeout disable and build failed in + openEuler 2003 + +--- + src/lstack/api/lstack_wrap.c | 3 ++- + src/lstack/core/lstack_preload.c | 1 + + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c +index 976a3f3..397870e 100644 +--- a/src/lstack/api/lstack_wrap.c ++++ b/src/lstack/api/lstack_wrap.c +@@ -636,8 +636,9 @@ static int32_t do_sigaction(int32_t signum, const struct sigaction *act, struct + + static int32_t do_select(int32_t nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) + { ++ /* while input args are invalid, param timeout will steal be executed in kernel */ + if (nfds <= 0 || !(readfds || writefds || exceptfds)) { +- GAZELLE_RETURN(EINVAL); ++ return posix_api->select_fn(nfds, readfds, writefds, exceptfds, timeout); + } + + if (select_posix_path() == POSIX_KERNEL) { +diff --git a/src/lstack/core/lstack_preload.c b/src/lstack/core/lstack_preload.c +index 689d2bf..0a1df7d 100644 +--- a/src/lstack/core/lstack_preload.c ++++ b/src/lstack/core/lstack_preload.c +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + + #include + #include +-- +2.33.0 + diff --git a/0226-support-kernel-connect.patch b/0226-support-kernel-connect.patch new file mode 100644 index 0000000..3568380 --- /dev/null +++ b/0226-support-kernel-connect.patch @@ -0,0 +1,48 @@ +From 34a090b2cfb88cb2e711d02c0f3eddf3a3656fac Mon Sep 17 00:00:00 2001 +From: compile_success <980965867@qq.com> +Date: Fri, 19 Jul 2024 07:34:47 +0000 +Subject: [PATCH] support kernel connect + +--- + src/lstack/api/lstack_epoll.c | 2 +- + src/lstack/api/lstack_wrap.c | 10 +++++++++- + 2 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/src/lstack/api/lstack_epoll.c b/src/lstack/api/lstack_epoll.c +index 417499b..6426de4 100644 +--- a/src/lstack/api/lstack_epoll.c ++++ b/src/lstack/api/lstack_epoll.c +@@ -439,7 +439,7 @@ int32_t lstack_rtw_epoll_ctl(int32_t epfd, int32_t op, int32_t fd, struct epoll_ + + struct wakeup_poll *wakeup = epoll_sock->wakeup; + struct lwip_sock *sock = lwip_get_socket(fd); +- if (POSIX_IS_CLOSED(sock)) { ++ if (POSIX_IS_CLOSED(sock) || POSIX_IS_TYPE(sock, POSIX_KERNEL)) { + return posix_api->epoll_ctl_fn(epfd, op, fd, event); + } + +diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c +index b19990e..a6ea485 100644 +--- a/src/lstack/api/lstack_wrap.c ++++ b/src/lstack/api/lstack_wrap.c +@@ -317,8 +317,16 @@ static int32_t do_connect(int32_t s, const struct sockaddr *name, socklen_t name + ret = posix_api->connect_fn(s, name, namelen); + POSIX_SET_TYPE(sock, POSIX_KERNEL); + } else { ++ /* When the socket is POSIX_LWIP_OR_KERNEL, connect to lwip first and then connect to kernel. */ + ret = g_wrap_api->connect_fn(s, name, namelen); +- POSIX_SET_TYPE(sock, POSIX_LWIP); ++ if (ret == 0) { ++ POSIX_SET_TYPE(sock, POSIX_LWIP); ++ } else { ++ ret = posix_api->connect_fn(s, name, namelen); ++ if (ret == 0) { ++ POSIX_SET_TYPE(sock, POSIX_KERNEL); ++ } ++ } + } + + return ret; +-- +2.33.0 + diff --git a/0227-Check-the-return-of-lwip_init.patch b/0227-Check-the-return-of-lwip_init.patch new file mode 100644 index 0000000..5056f8a --- /dev/null +++ b/0227-Check-the-return-of-lwip_init.patch @@ -0,0 +1,29 @@ +From 7cb4456d14405d1d9dbeb890642a339ef13165da Mon Sep 17 00:00:00 2001 +From: Lemmy Huang +Date: Mon, 22 Jul 2024 15:09:33 +0800 +Subject: [PATCH] Check the return of lwip_init + +Signed-off-by: Lemmy Huang +--- + src/lstack/core/lstack_protocol_stack.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c +index 6f2e84e..2867711 100644 +--- a/src/lstack/core/lstack_protocol_stack.c ++++ b/src/lstack/core/lstack_protocol_stack.c +@@ -421,6 +421,11 @@ static struct protocol_stack *stack_thread_init(void *arg) + RTE_PER_LCORE(_lcore_id) = stack->cpu_id; + + lwip_init(); ++ /* Using errno to return lwip_init() result. */ ++ if (errno != 0) { ++ LSTACK_LOG(ERR, LSTACK, "lwip_init failed, errno %d\n", errno); ++ goto END; ++ } + + if (use_ltran()) { + if (client_reg_thrd_ring() != 0) { +-- +2.33.0 + diff --git a/0228-vitio_user-modify-mbuf-index-for-bond4.patch b/0228-vitio_user-modify-mbuf-index-for-bond4.patch new file mode 100644 index 0000000..a9833c4 --- /dev/null +++ b/0228-vitio_user-modify-mbuf-index-for-bond4.patch @@ -0,0 +1,60 @@ +From 0f841d29ed2f17f54bc4c13ef01f364ef4c633ac Mon Sep 17 00:00:00 2001 +From: hkk +Date: Sat, 20 Jul 2024 16:52:52 +0800 +Subject: [PATCH] vitio_user: modify mbuf index for bond4 + +--- + src/lstack/core/lstack_virtio.c | 6 ++++-- + src/ltran/ltran_dfx.c | 4 ++-- + 2 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/src/lstack/core/lstack_virtio.c b/src/lstack/core/lstack_virtio.c +index 36159c9..f907a99 100644 +--- a/src/lstack/core/lstack_virtio.c ++++ b/src/lstack/core/lstack_virtio.c +@@ -205,6 +205,7 @@ static int virtio_port_init(uint16_t port) + int retval; + uint16_t rx_queue_num = g_virtio_instance.rx_queue_num; + uint16_t tx_queue_num = g_virtio_instance.tx_queue_num; ++ int mbuf_total_num = get_global_cfg_params()->num_cpu * get_global_cfg_params()->num_process; + + LSTACK_LOG(INFO, LSTACK, "virtio_port_init port= %u rx_queue_num=%u tx_queue_num=%u \n", + port, rx_queue_num, tx_queue_num); +@@ -226,7 +227,8 @@ static int virtio_port_init(uint16_t port) + } + + for (uint16_t q = 0; q < tx_queue_num; q++) { +- retval = rte_eth_tx_queue_setup(port, q, VIRTIO_TX_RX_RING_SIZE, rte_eth_dev_socket_id(port), NULL); ++ retval = rte_eth_tx_queue_setup(port, q % mbuf_total_num, VIRTIO_TX_RX_RING_SIZE, ++ rte_eth_dev_socket_id(port), NULL); + if (retval < 0) { + LSTACK_LOG(ERR, LSTACK, "rte_eth_tx_queue_setup failed (queue %u) retval=%d \n", q, retval); + return retval; +@@ -341,4 +343,4 @@ bool virtio_distribute_pkg_to_kernel(uint16_t dst_port) + } + + return (port_map_get(dst_port) == 0); +-} +\ No newline at end of file ++} +diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c +index 005b09c..1bf5451 100644 +--- a/src/ltran/ltran_dfx.c ++++ b/src/ltran/ltran_dfx.c +@@ -1177,11 +1177,11 @@ static void gazelle_print_lstack_stat_virtio(void *buf, const struct gazelle_sta + struct gazelle_stat_lstack_virtio *virtio = &stat->data.virtio; + printf("\nStatistics of lstack virtio:\n"); + +- printf("\nlstack_port_id =%u virtio_port_id =%u rx_queue_num =%u tx_queue_num =%u \n", ++ printf("\nlstack_port_id: %u virtio_port_id: %u rx_queue_num: %u tx_queue_num: %u \n", + virtio->lstack_port_id, virtio->virtio_port_id, virtio->rx_queue_num, + virtio->tx_queue_num); + +- printf("\n%-8s %-8s %-8s %-8s %-8s\n", "queue_id", "rx_pkg", "rx_drop", "tx_pkg", "tx_drop"); ++ printf("\n%-8s %-8s %-8s %-8s %-8s\n", "queue_id", "rx_pkg", "rx_drop", "tx_pkg", "tx_drop"); + for (int i = 0; i < virtio->rx_queue_num; i++) { + printf("%-8d %-8lu %-8lu %-8lu %-8lu\n", i, + virtio->rx_pkg[i], virtio->rx_drop[i], virtio->tx_pkg[i], virtio->tx_drop[i]); +-- +2.33.0 + diff --git a/0229-fix-redis-coredump-when-hugetlbs-pagesize-is-1024M.patch b/0229-fix-redis-coredump-when-hugetlbs-pagesize-is-1024M.patch new file mode 100644 index 0000000..3a20129 --- /dev/null +++ b/0229-fix-redis-coredump-when-hugetlbs-pagesize-is-1024M.patch @@ -0,0 +1,48 @@ +From 5dff08d02b2561ca39d7e569b9870f7a315080f0 Mon Sep 17 00:00:00 2001 +From: yangchen +Date: Tue, 16 Jul 2024 22:24:04 +0800 +Subject: [PATCH] fix redis coredump when hugetlbs pagesize is 1024M + +--- + src/lstack/core/lstack_init.c | 16 +++++++++------- + 1 file changed, 9 insertions(+), 7 deletions(-) + +diff --git a/src/lstack/core/lstack_init.c b/src/lstack/core/lstack_init.c +index a5a4a4e..629c790 100644 +--- a/src/lstack/core/lstack_init.c ++++ b/src/lstack/core/lstack_init.c +@@ -113,8 +113,16 @@ void gazelle_exit(void) + /* 1: wait until app thread call send functio complete */ + sleep(1); + stack_group_exit(); ++} + ++void dpdk_exit(void) ++{ + if (!use_ltran()) { ++ int ret = rte_pdump_uninit(); ++ if (ret < 0) { ++ LSTACK_LOG(ERR, LSTACK, "rte_pdump_uninit failed\n"); ++ } ++ + #if RTE_VERSION < RTE_VERSION_NUM(23, 11, 0, 0) + dpdk_kni_release(); + #endif +@@ -126,13 +134,7 @@ __attribute__((destructor)) void gazelle_network_exit(void) + if (posix_api != NULL && !posix_api->use_kernel) { + lwip_exit(); + gazelle_exit(); +- } +- +- if (!use_ltran()) { +- int32_t ret = rte_pdump_uninit(); +- if (ret < 0) { +- LSTACK_LOG(ERR, LSTACK, "rte_pdump_uninit failed\n"); +- } ++ dpdk_exit(); + } + } + +-- +2.33.0 + diff --git a/gazelle.spec b/gazelle.spec index cd9627e..79e3502 100644 --- a/gazelle.spec +++ b/gazelle.spec @@ -2,7 +2,7 @@ Name: gazelle Version: 1.0.2 -Release: 51 +Release: 52 Summary: gazelle is a high performance user-mode stack License: MulanPSL-2.0 URL: https://gitee.com/openeuler/gazelle @@ -241,6 +241,11 @@ Patch9221: 0221-fix-EPOLLIN-event-dropd.patch Patch9222: 0222-cleancode-refactor-lwipgz_hlist.h.patch Patch9223: 0223-add-sem-post-when-update-event.patch Patch9224: 0224-cleancode-refactor-sys_now-and-lwip_ioctl.patch +Patch9225: 0225-POSIX-fix-select-timeout-disable-and-build-failed-in.patch +Patch9226: 0226-support-kernel-connect.patch +Patch9227: 0227-Check-the-return-of-lwip_init.patch +Patch9228: 0228-vitio_user-modify-mbuf-index-for-bond4.patch +Patch9229: 0229-fix-redis-coredump-when-hugetlbs-pagesize-is-1024M.patch %description %{name} is a high performance user-mode stack. @@ -282,6 +287,13 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b %config(noreplace) %{conf_path}/ltran.conf %changelog +* Thu Jul 25 2024 yangchen555 - 1.0.2-52 +- fix redis coredump when hugetlbs pagesize is 1024M +- vitio_user: modify mbuf index for bond4 +- Check the return of lwip_init +- support kernel connect +- POSIX: fix select timeout disable and build failed in openEuler 2003 + * Fri Jul 19 2024 yinbin6 - 1.0.2-51 - cleancode: refactor sys_now and lwip_ioctl - add sem post when update event