kni: use netif_rx instead of netif_receive_skb in which ocurr deallock on userpace contex
PATCH v2 1/1 kni: use netif_rx instead of netif_receive_skb in which ocurr deallock on userpace contex
Per netif_receive_skb function description, it may only be called from interrupt contex, but KNI is run on kthread that like as user-space contex. It may occur deallock, if netif_receive_skb called from kthread, so it should be repleaced by netif_rx or adding local_bh_disable/enable around netif_receive_skb.
--- lib/librte_eal/linuxapp/kni/kni_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_eal/linuxapp/kni/kni_net.c +1 -1
@@ -179,7 +179,7 @@ kni_net_rx_normal(struct kni_dev *kni) skb->ip_summed =CHECKSUM_UNNECESSARY ;/* Call netif interface */ -netif_receive_skb (skb); +netif_rx (skb);/* Update statistics */ kni->stats.rx_bytes += len;
Signature · 1 line
2.0.0
A message that is not in the archive (sent off-list or not yet received): 1405093044-3264-1-git-send-email-blue119-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Hi,
2014-07-11 23:37, Yao-Po Wang:
lib/librte_eal/linuxapp/kni/kni_net.c kni_net_rx_normal(struct kni_dev *kni) · line 182
Quoted 13 lines
Per
netif_receive_skbfunction description, it may only be called from interrupt contex, but KNI is run on kthread that like as user-space contex. It may occur deallock, ifnetif_receive_skbcalled from kthread, so it should be repleaced bynetif_rxor adding local_bh_disable/enable aroundnetif_receive_skb.Signed-off-by Yao-Po Wang <[email protected]>lib/librte_eal/linuxapp/kni/kni_net.c +1
-1/* Call netif interface */ -netif_receive_skb (skb); +netif_rx (skb);
Is there someone confident to approve this change?
Signature · 1 line
Thomas
Quoted 11 lines · Thomas Monjalon
Hi,
2014-07-11 23:37, Yao-Po Wang:
Quoted 7 lines
Per
netif_receive_skbfunction description, it may only be called from interrupt contex, but KNI is run on kthread that like as user-space contex. It may occur deallock, ifnetif_receive_skbcalled from kthread, so it should be repleaced bynetif_rxor adding local_bh_disable/enable aroundnetif_receive_skb.Signed-off-by Yao-Po Wang <[email protected]>
Quoted 7 lines
lib/librte_eal/linuxapp/kni/kni_net.c kni_net_rx_normal(struct kni_dev *kni) · line 182
Quoted 5 lines
lib/librte_eal/linuxapp/kni/kni_net.c +1
-1/* Call netif interface */ -netif_receive_skb (skb); +netif_rx (skb);Is there someone confident to approve this change?
Yao-Po is correct.
Please see this comment In Linux source code .
http://lxr.free-electrons.com/source/net/core/dev.c#L3715
Context:
All todays network drivers use(ixgbe is no exception) NAPI which is a soft irq context of the receive flow .
This is the context in which netif_receive_skb should be called in. KNI is not soft IRQ context so the generic netif_rx is the right function.
Quoted 3 lines
--
Thomas
A message that is not in the archive (sent off-list or not yet received): CAKfHP0UixroQedaZVSFfnq0+fHWiRmyszYop+S0vPskpmkMJmg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
2014-07-17 15:24, Alex Markuze:
Quoted 23 lines
On Thu, Jul 17, 2014 at 3:02 PM, Thomas Monjalon
Quoted 9 lines
2014-07-11 23:37, Yao-Po Wang:
Quoted 7 lines
Per
netif_receive_skbfunction description, it may only be called from interrupt contex, but KNI is run on kthread that like as user-space contex. It may occur deallock, ifnetif_receive_skbcalled from kthread, so it should be repleaced bynetif_rxor adding local_bh_disable/enable aroundnetif_receive_skb.Signed-off-by Yao-Po Wang <[email protected]>Quoted 7 lines
lib/librte_eal/linuxapp/kni/kni_net.c kni_net_rx_normal(struct kni_dev *kni) · line 182
Quoted 5 lines
lib/librte_eal/linuxapp/kni/kni_net.c +1
-1/* Call netif interface */ -netif_receive_skb (skb); +netif_rx (skb);Is there someone confident to approve this change?
Yao-Po is correct.
Please see this comment In Linux source code .
http://lxr.free-electrons.com/source/net/core/dev.c#L3715
Quoted 6 lines
Context:
All todays network drivers use(ixgbe is no exception) NAPI which is a soft irq context of the receive flow .
This is the context in whichnetif_receive_skbshould be called in. KNI is not soft IRQ context so the genericnetif_rxis the right function.
Thanks for confirmation.
Assuming Acked-by: Alex Markuze <[email protected]>
Applied for version 1.7.1
Thanks
Signature · 1 line
Thomas