dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
* [memnic PATCH] linux: fix to disable softirq before netif_receive_skb()
@ 2014-06-06  7:54 Hiroshi Shimamoto
       [not found] ` <7F861DC0615E0C47A872E6F3C5FCDDBD01101844-ZmjkEB1lVlLt6d3pZDjeaEtBU8KWyXPq@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Hiroshi Shimamoto @ 2014-06-06  7:54 UTC (permalink / raw)
  To: dev-VfR2kkLFssw@public.gmane.org; +Cc: Hayato Momma

From: Hiroshi Shimamoto <h-shimamoto-ehU+Cx/zZe18UrSeD/g0lQ@public.gmane.org>

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-ehU+Cx/zZe18UrSeD/g0lQ@public.gmane.org>
Reviewed-by: Hayato Momma <h-momma-JhyGz2TFV9J8UrSeD/g0lQ@public.gmane.org>
---
 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 related	[flat|nested] 2+ messages in thread

* Re: [memnic PATCH] linux: fix to disable softirq before netif_receive_skb()
       [not found] ` <7F861DC0615E0C47A872E6F3C5FCDDBD01101844-ZmjkEB1lVlLt6d3pZDjeaEtBU8KWyXPq@public.gmane.org>
@ 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-VfR2kkLFssw, 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-ehU+Cx/zZe18UrSeD/g0lQ@public.gmane.org>
> Reviewed-by: Hayato Momma <h-momma-JhyGz2TFV9J8UrSeD/g0lQ@public.gmane.org>

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 [memnic PATCH] linux: fix to disable softirq before netif_receive_skb() Hiroshi Shimamoto
     [not found] ` <7F861DC0615E0C47A872E6F3C5FCDDBD01101844-ZmjkEB1lVlLt6d3pZDjeaEtBU8KWyXPq@public.gmane.org>
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).