DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [memnic PATCH] linux: fix to disable softirq before netif_receive_skb()
@ 2014-06-06  7:54 Hiroshi Shimamoto
  2014-06-29 22:14 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Hiroshi Shimamoto @ 2014-06-06  7:54 UTC (permalink / raw)
  To: dev; +Cc: Hayato Momma

From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>

Calling netif_receive_skb() from memnic thread may cause deadlock, if
softirq is not disabled.

The netif_receive_skb() should be called in softirq context, but memnic
thread is not softirq context. That may conflict softirq work like a
timer handler in kernel network stack.

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Reviewed-by: Hayato Momma <h-momma@ce.jp.nec.com>
---
 linux/memnic_net.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/linux/memnic_net.c b/linux/memnic_net.c
index fadece6..a1b433a 100644
--- a/linux/memnic_net.c
+++ b/linux/memnic_net.c
@@ -133,8 +133,14 @@ static int memnic_thread(void *param)
 			continue;
 		}
 
+		local_bh_disable();
+		/*
+		 * Disable softirq here to avoid race between timers and
+		 * netif_receive_skb
+		 */
 		for (i = 0; i < n; i++)
 			netif_receive_skb(skbs[i]);
+		local_bh_enable();
 
 		cnt = 0;
 	}
-- 
1.8.4

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

* Re: [dpdk-dev] [memnic PATCH] linux: fix to disable softirq before netif_receive_skb()
  2014-06-06  7:54 [dpdk-dev] [memnic PATCH] linux: fix to disable softirq before netif_receive_skb() Hiroshi Shimamoto
@ 2014-06-29 22:14 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2014-06-29 22:14 UTC (permalink / raw)
  To: Hiroshi Shimamoto; +Cc: dev, Hayato Momma

> Calling netif_receive_skb() from memnic thread may cause deadlock, if
> softirq is not disabled.
> 
> The netif_receive_skb() should be called in softirq context, but memnic
> thread is not softirq context. That may conflict softirq work like a
> timer handler in kernel network stack.
> 
> Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> Reviewed-by: Hayato Momma <h-momma@ce.jp.nec.com>

Applied

Thanks
-- 
Thomas

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

end of thread, other threads:[~2014-06-29 22:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-06  7:54 [dpdk-dev] [memnic PATCH] linux: fix to disable softirq before netif_receive_skb() Hiroshi Shimamoto
2014-06-29 22:14 ` Thomas Monjalon

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).