backpot bugfix and doc

This commit is contained in:
wu-changsheng 2022-09-05 20:23:11 +08:00
parent 2d3fc1751b
commit 4cfcb245b8
10 changed files with 2973 additions and 2 deletions

View File

@ -0,0 +1,26 @@
From 4d5832685f7fbdb5314acdf04fbd0882357880ec Mon Sep 17 00:00:00 2001
From: wu-changsheng <wuchangsheng2@huawei.com>
Date: Tue, 2 Aug 2022 19:32:54 +0800
Subject: [PATCH 11/20] fix memcpy out bounds
---
src/lstack/core/lstack_stack_stat.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/lstack/core/lstack_stack_stat.c b/src/lstack/core/lstack_stack_stat.c
index 09aa04c..e8c5bc3 100644
--- a/src/lstack/core/lstack_stack_stat.c
+++ b/src/lstack/core/lstack_stack_stat.c
@@ -172,7 +172,8 @@ static void get_stack_stats(struct gazelle_stack_dfx_data *dfx, struct protocol_
lstack_get_low_power_info(&dfx->low_power_info);
- int32_t ret = memcpy_s(&dfx->data.pkts.stack_stat, sizeof(dfx->data.pkts), &stack->stats, sizeof(dfx->data.pkts));
+ int32_t ret = memcpy_s(&dfx->data.pkts.stack_stat, sizeof(struct gazelle_stack_stat),
+ &stack->stats, sizeof(struct gazelle_stack_stat));
if (ret != EOK) {
LSTACK_LOG(ERR, LSTACK, "memcpy_s err ret=%d \n", ret);
return;
--
2.23.0

View File

@ -0,0 +1,62 @@
From e0e21a4170ef062cb66288beb6800a7c43da7136 Mon Sep 17 00:00:00 2001
From: wu-changsheng <wuchangsheng2@huawei.com>
Date: Mon, 29 Aug 2022 16:54:20 +0800
Subject: [PATCH 15/20] fix miss send rpc msg err
---
src/lstack/core/lstack_lwip.c | 1 -
src/lstack/core/lstack_thread_rpc.c | 5 -----
src/lstack/include/lstack_protocol_stack.h | 1 -
3 files changed, 7 deletions(-)
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
index 96c6c96..35b67f5 100644
--- a/src/lstack/core/lstack_lwip.c
+++ b/src/lstack/core/lstack_lwip.c
@@ -321,7 +321,6 @@ void stack_send(struct rpc_msg *msg)
int32_t flags = msg->args[MSG_ARG_2].i;
struct protocol_stack *stack = get_protocol_stack();
- __atomic_store_n(&stack->in_send, false, __ATOMIC_RELEASE);
struct lwip_sock *sock = get_socket(fd);
if (sock == NULL) {
diff --git a/src/lstack/core/lstack_thread_rpc.c b/src/lstack/core/lstack_thread_rpc.c
index d0f5257..a6e9725 100644
--- a/src/lstack/core/lstack_thread_rpc.c
+++ b/src/lstack/core/lstack_thread_rpc.c
@@ -429,11 +429,7 @@ int32_t rpc_call_ioctl(int fd, long cmd, void *argp)
void rpc_call_send(int fd, const void *buf, size_t len, int flags)
{
- /* same stack don't repeat send msg */
struct protocol_stack *stack = get_protocol_stack_by_fd(fd);
- if (__atomic_load_n(&stack->in_send, __ATOMIC_ACQUIRE)) {
- return;
- }
struct rpc_msg *msg = rpc_msg_alloc(stack, stack_send);
if (msg == NULL) {
@@ -445,7 +441,6 @@ void rpc_call_send(int fd, const void *buf, size_t len, int flags)
msg->args[MSG_ARG_2].i = flags;
msg->self_release = 0;
- stack->in_send = true;
rpc_call(&stack->rpc_queue, msg);
}
diff --git a/src/lstack/include/lstack_protocol_stack.h b/src/lstack/include/lstack_protocol_stack.h
index 2a6aec7..36340ab 100644
--- a/src/lstack/include/lstack_protocol_stack.h
+++ b/src/lstack/include/lstack_protocol_stack.h
@@ -50,7 +50,6 @@ struct protocol_stack {
struct reg_ring_msg *reg_buf;
volatile bool low_power;
- volatile bool in_send __rte_cache_aligned;
lockless_queue rpc_queue __rte_cache_aligned;
char pad __rte_cache_aligned;
--
2.23.0

View File

@ -0,0 +1,37 @@
From 5d10ccf130b742f4e910568b642ac351a489c072 Mon Sep 17 00:00:00 2001
From: wu-changsheng <wuchangsheng2@huawei.com>
Date: Fri, 2 Sep 2022 19:26:05 +0800
Subject: [PATCH 17/20] fix proc can not exit due to lack of mem startup fail
---
src/lstack/core/lstack_protocol_stack.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index 4f1ad41..3009286 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -373,10 +373,12 @@ static struct protocol_stack *stack_thread_init(uint16_t queue_id)
struct protocol_stack *stack = malloc(sizeof(*stack));
if (stack == NULL) {
LSTACK_LOG(ERR, LSTACK, "malloc stack failed\n");
+ sem_post(&stack_group->thread_phase1);
return NULL;
}
if (init_stack_value(stack, queue_id) != 0) {
+ sem_post(&stack_group->thread_phase1);
free(stack);
return NULL;
}
@@ -389,6 +391,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;
}
--
2.23.0

View File

@ -0,0 +1,25 @@
From 27f6745def82693c661aaf0a1a6353790955755c Mon Sep 17 00:00:00 2001
From: wu-changsheng <wuchangsheng2@huawei.com>
Date: Sat, 3 Sep 2022 20:51:41 +0800
Subject: [PATCH 18/20] read data with err event
---
src/lstack/core/lstack_lwip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
index 35b67f5..10c2cd9 100644
--- a/src/lstack/core/lstack_lwip.c
+++ b/src/lstack/core/lstack_lwip.c
@@ -577,7 +577,7 @@ ssize_t read_stack_data(int32_t fd, void *buf, size_t len, int32_t flags)
GAZELLE_RETURN(EINVAL);
}
- if (sock->errevent > 0) {
+ if (sock->errevent > 0 && !NETCONN_IS_DATAIN(sock)) {
return 0;
}
--
2.23.0

View File

@ -0,0 +1,44 @@
From 138399196dcb2fb926cc2dbeedfcdb4bf1f1401b Mon Sep 17 00:00:00 2001
From: wu-changsheng <wuchangsheng2@huawei.com>
Date: Sat, 3 Sep 2022 21:31:15 +0800
Subject: [PATCH 19/20] del gazelle ring cons.tail atomic protect
---
src/common/dpdk_common.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/common/dpdk_common.h b/src/common/dpdk_common.h
index 987fbdd..1c3e7e8 100644
--- a/src/common/dpdk_common.h
+++ b/src/common/dpdk_common.h
@@ -141,7 +141,7 @@ static __rte_always_inline uint32_t gazelle_light_ring_dequeue_burst(struct rte_
static __rte_always_inline uint32_t gazelle_ring_sp_enqueue(struct rte_ring *r, void **obj_table, uint32_t n)
{
uint32_t head = __atomic_load_n(&r->cons.head, __ATOMIC_ACQUIRE);
- uint32_t tail = __atomic_load_n(&r->cons.tail, __ATOMIC_ACQUIRE);
+ uint32_t tail = r->cons.tail;
uint32_t entries = r->capacity + tail - head;
if (n > entries) {
@@ -158,8 +158,8 @@ static __rte_always_inline uint32_t gazelle_ring_sp_enqueue(struct rte_ring *r,
static __rte_always_inline uint32_t gazelle_ring_sc_dequeue(struct rte_ring *r, void **obj_table, uint32_t n)
{
- uint32_t cons = __atomic_load_n(&r->cons.tail, __ATOMIC_ACQUIRE);
uint32_t prod = __atomic_load_n(&r->prod.tail, __ATOMIC_ACQUIRE);
+ uint32_t cons = r->cons.tail;
uint32_t entries = prod - cons;
if (n > entries) {
@@ -172,7 +172,7 @@ static __rte_always_inline uint32_t gazelle_ring_sc_dequeue(struct rte_ring *r,
DEQUEUE_PTRS(r, &r[1], cons, obj_table, n, void *);
- __atomic_store_n(&r->cons.tail, cons + n, __ATOMIC_RELEASE);
+ r->cons.tail = cons + n;
return n;
}
--
2.23.0

View File

@ -0,0 +1,40 @@
From 09ca97c3777c5459fa8717e3ce298a62ff0c84e6 Mon Sep 17 00:00:00 2001
From: wu-changsheng <wuchangsheng2@huawei.com>
Date: Sat, 3 Sep 2022 21:50:27 +0800
Subject: [PATCH 20/20] fix send return vale
---
src/lstack/core/lstack_lwip.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
index 10c2cd9..5174e4c 100644
--- a/src/lstack/core/lstack_lwip.c
+++ b/src/lstack/core/lstack_lwip.c
@@ -256,12 +256,12 @@ static inline void del_data_out_event(struct lwip_sock *sock)
ssize_t write_stack_data(struct lwip_sock *sock, const void *buf, size_t len)
{
if (sock->errevent > 0) {
- return 0;
+ GAZELLE_RETURN(ENOTCONN);
}
uint32_t free_count = gazelle_ring_readable_count(sock->send_ring);
if (free_count == 0) {
- return -1;
+ return 0;
}
struct pbuf *pbuf = NULL;
@@ -293,7 +293,7 @@ ssize_t write_stack_data(struct lwip_sock *sock, const void *buf, size_t len)
}
}
- return (send_len <= 0) ? -1 : send_len;
+ return send_len;
}
static void do_lwip_send(int32_t fd, struct lwip_sock *sock, int32_t flags)
--
2.23.0

2668
0088-add-examples.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,25 @@
From 6c88041590ef9f79e85a243fa905267898f3ab98 Mon Sep 17 00:00:00 2001
From: wu-changsheng <wuchangsheng2@huawei.com>
Date: Mon, 5 Sep 2022 16:54:55 +0800
Subject: [PATCH] expand thread rpc msg pool size
---
src/lstack/core/lstack_thread_rpc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lstack/core/lstack_thread_rpc.c b/src/lstack/core/lstack_thread_rpc.c
index a6e9725..c9fc4e9 100644
--- a/src/lstack/core/lstack_thread_rpc.c
+++ b/src/lstack/core/lstack_thread_rpc.c
@@ -23,7 +23,7 @@
#include "lstack_dpdk.h"
#include "lstack_thread_rpc.h"
-#define RPC_MSG_MAX 32
+#define RPC_MSG_MAX 512
#define RPC_MSG_MASK (RPC_MSG_MAX - 1)
struct rpc_msg_pool {
struct rpc_msg msgs[RPC_MSG_MAX];
--
2.23.0

View File

@ -0,0 +1,33 @@
From 21ae5e6b6bc7baa02dbe934b28677ad9e0646447 Mon Sep 17 00:00:00 2001
From: wu-changsheng <wuchangsheng2@huawei.com>
Date: Tue, 6 Sep 2022 10:41:59 +0800
Subject: [PATCH] fix ltran sig handler get pid
---
src/ltran/main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/ltran/main.c b/src/ltran/main.c
index d1e4030..2e3af82 100644
--- a/src/ltran/main.c
+++ b/src/ltran/main.c
@@ -17,6 +17,7 @@
#include <syslog.h>
#include <sys/types.h>
#include <rte_malloc.h>
+#include <unistd.h>
#include "dpdk_common.h"
#include "ltran_log.h"
@@ -58,7 +59,7 @@ static void sig_default_handler(int32_t sig)
LTRAN_ERR("ltran dumpedcaught signal%d.\n", sig);
print_stack();
dpdk_kni_release();
- kill(getpt(), sig);
+ kill(getpid(), sig);
}
static void signal_init(void)
--
2.23.0

View File

@ -2,7 +2,7 @@
Name: gazelle
Version: 1.0.1
Release: 17
Release: 18
Summary: gazelle is a high performance user-mode stack
License: MulanPSL-2.0
URL: https://gitee.com/openeuler/gazelle
@ -56,7 +56,6 @@ Patch9038: 0038-refactor-event.patch
Patch9039: 0039-update-license-lockless-queue.patch
Patch9040: 0040-adapt-to-gazelle.patch
Patch9041: 0041-modify-securec-to-boundscheck.patch
Patch9042: 0042-fix-sock-invalid-address.patch
Patch9043: 0043-exit-lstack-process-after-ltran-instance-logout.patch
Patch9044: 0044-use-atomic-variales-to-count.patch
@ -97,6 +96,15 @@ Patch9078: 0078-fix-rpc-msg-out-of-bound.patch
Patch9079: 0079-fix-traversal-array-use-NULL-pointer.patch
Patch9080: 0080-same-stack-thread-don-t-repeate-send-msg.patch
Patch9081: 0081-modify-huge-dir-dir-name.patch
Patch9082: 0082-fix-memcpy-out-bounds.patch
Patch9083: 0083-fix-miss-send-rpc-msg-err.patch
Patch9084: 0084-fix-proc-can-not-exit-due-to-lack-of-mem-startup-fai.patch
Patch9085: 0085-read-data-with-err-event.patch
Patch9086: 0086-del-gazelle-ring-cons.tail-atomic-protect.patch
Patch9087: 0087-fix-send-return-vale.patch
Patch9088: 0088-add-examples.patch
Patch9089: 0089-expand-thread-rpc-msg-pool-size.patch
Patch9090: 0090-fix-ltran-sig_default_handler-kill-pid.patch
%description
%{name} is a high performance user-mode stack.
@ -137,6 +145,9 @@ install -Dpm 0640 %{_builddir}/%{name}-%{version}/src/ltran/ltran.conf %{b
%config(noreplace) %{conf_path}/ltran.conf
%changelog
* Mon Sep 05 2022 wuchangsheng <wuchangsheng2@huawei.com> - 1.0.1-18
- backport bugfix and doc
* Mon Aug 08 2022 fushanqing <fushanqing@kylinos.cn> - 1.0.1-17
- Unified license name specification