2 Star 0 Fork 32

我们17走/gazelle

forked from src-openEuler/gazelle 
Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
0267-rpc-fix-rpc_sync_call-spinlock-block-when-msg-be-rec.patch 2.80 KB
Copy Edit Raw Blame History
From 870caa8931a9f6a068172e56d7e401cd4b9b4086 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Tue, 8 Oct 2024 20:39:37 +0800
Subject: [PATCH] rpc: fix rpc_sync_call spinlock block when msg be recalled
---
src/lstack/core/lstack_thread_rpc.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/lstack/core/lstack_thread_rpc.c b/src/lstack/core/lstack_thread_rpc.c
index 7f77c12..aed792d 100644
--- a/src/lstack/core/lstack_thread_rpc.c
+++ b/src/lstack/core/lstack_thread_rpc.c
@@ -97,13 +97,19 @@ static void rpc_msg_free(struct rpc_msg *msg)
}
__rte_always_inline
-static void rpc_async_call(rpc_queue *queue, struct rpc_msg *msg)
+static void rpc_call(rpc_queue *queue, struct rpc_msg *msg)
{
- msg->sync_flag = 0;
lockless_queue_mpsc_push(&queue->queue, &msg->queue_node);
intr_wakeup(queue->queue_id, INTR_REMOTE_EVENT);
}
+__rte_always_inline
+static void rpc_async_call(rpc_queue *queue, struct rpc_msg *msg)
+{
+ msg->sync_flag = 0;
+ rpc_call(queue, msg);
+}
+
__rte_always_inline
static int rpc_sync_call(rpc_queue *queue, struct rpc_msg *msg)
{
@@ -112,8 +118,7 @@ static int rpc_sync_call(rpc_queue *queue, struct rpc_msg *msg)
pthread_spin_trylock(&msg->lock);
msg->sync_flag = 1;
- lockless_queue_mpsc_push(&queue->queue, &msg->queue_node);
- intr_wakeup(queue->queue_id, INTR_REMOTE_EVENT);
+ rpc_call(queue, msg);
// waiting stack unlock
pthread_spin_lock(&msg->lock);
@@ -209,7 +214,7 @@ static void callback_close(struct rpc_msg *msg)
if (sock && __atomic_load_n(&sock->call_num, __ATOMIC_ACQUIRE) > 0) {
msg->recall_flag = 1;
- rpc_async_call(&stack->rpc_queue, msg); /* until stack_send recall finish */
+ rpc_call(&stack->rpc_queue, msg); /* until stack_send recall finish */
return;
}
@@ -228,7 +233,7 @@ static void callback_shutdown(struct rpc_msg *msg)
if (sock && __atomic_load_n(&sock->call_num, __ATOMIC_ACQUIRE) > 0) {
msg->recall_flag = 1;
- rpc_async_call(&stack->rpc_queue, msg);
+ rpc_call(&stack->rpc_queue, msg);
return;
}
@@ -586,7 +591,7 @@ static void callback_tcp_send(struct rpc_msg *msg)
if (ret > 0 || NETCONN_IS_DATAOUT(sock)) {
if (__atomic_load_n(&sock->call_num, __ATOMIC_ACQUIRE) == 1) {
msg->recall_flag = 1;
- rpc_async_call(&stack->rpc_queue, msg);
+ rpc_call(&stack->rpc_queue, msg);
return;
}
}
@@ -675,7 +680,7 @@ static void callback_replenish_sendring(struct rpc_msg *msg)
msg->result = do_lwip_replenish_sendring(stack, sock);
if (msg->result == true) {
msg->recall_flag = 1;
- rpc_async_call(&stack->rpc_queue, msg);
+ rpc_call(&stack->rpc_queue, msg);
}
}
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/together17/gazelle.git
git@gitee.com:together17/gazelle.git
together17
gazelle
gazelle
master

Search

0d507c66 1850385 C8b1a773 1850385