netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net] tipc: increase timeout in tipc_sk_enqueue()
@ 2021-09-13  9:28 Hoang Le
  2021-09-13 11:50 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Hoang Le @ 2021-09-13  9:28 UTC (permalink / raw)
  To: jmaloy, maloy, ying.xue, kuba, davem, netdev, tipc-discussion,
	eric.dumazet

In tipc_sk_enqueue() we use hardcoded 2 jiffies to extract
socket buffer from generic queue to particular socket.
The 2 jiffies is too short in case there are other high priority
tasks get CPU cycles for multiple jiffies update. As result, no
buffer could be enqueued to particular socket.

To solve this, we switch to use constant timeout 20msecs.
Then, the function will be expired between 2 jiffies (CONFIG_100HZ)
and 20 jiffies (CONFIG_1000HZ).

Fixes: c637c1035534 ("tipc: resolve race problem at unicast message reception")
Acked-by: Jon Maloy <jmaloy@redhat.com>
Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au>
---
 net/tipc/socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index a0a27d87f631..ad570c2450be 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -2423,7 +2423,7 @@ static int tipc_sk_backlog_rcv(struct sock *sk, struct sk_buff *skb)
 static void tipc_sk_enqueue(struct sk_buff_head *inputq, struct sock *sk,
 			    u32 dport, struct sk_buff_head *xmitq)
 {
-	unsigned long time_limit = jiffies + 2;
+	unsigned long time_limit = jiffies + usecs_to_jiffies(20000);
 	struct sk_buff *skb;
 	unsigned int lim;
 	atomic_t *dcnt;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [net] tipc: increase timeout in tipc_sk_enqueue()
  2021-09-13  9:28 [net] tipc: increase timeout in tipc_sk_enqueue() Hoang Le
@ 2021-09-13 11:50 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-09-13 11:50 UTC (permalink / raw)
  To: Hoang Le
  Cc: jmaloy, maloy, ying.xue, kuba, davem, netdev, tipc-discussion,
	eric.dumazet

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Mon, 13 Sep 2021 16:28:52 +0700 you wrote:
> In tipc_sk_enqueue() we use hardcoded 2 jiffies to extract
> socket buffer from generic queue to particular socket.
> The 2 jiffies is too short in case there are other high priority
> tasks get CPU cycles for multiple jiffies update. As result, no
> buffer could be enqueued to particular socket.
> 
> To solve this, we switch to use constant timeout 20msecs.
> Then, the function will be expired between 2 jiffies (CONFIG_100HZ)
> and 20 jiffies (CONFIG_1000HZ).
> 
> [...]

Here is the summary with links:
  - [net] tipc: increase timeout in tipc_sk_enqueue()
    https://git.kernel.org/netdev/net/c/f4bb62e64c88

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-13 11:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13  9:28 [net] tipc: increase timeout in tipc_sk_enqueue() Hoang Le
2021-09-13 11:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).