All of lore.kernel.org
 help / color / mirror / Atom feed
* Potential deadlock in KNI RX path
@ 2016-04-06 20:22 Jay Rolette
  2016-04-07 14:33 ` Ferruh Yigit
  0 siblings, 1 reply; 5+ messages in thread
From: Jay Rolette @ 2016-04-06 20:22 UTC (permalink / raw)
  To: DPDK; +Cc: Neil Horman

Over a year ago, Neil pointed out that calling netif_rx() from
kni_net_rx_normal() was a bug and could cause lockups. Here's the comment:

http://dpdk.org/ml/archives/dev/2015-March/015783.html

Looking at the current code base, it is still calling netif_rx() instead of
netif_rx_ni() as suggested.

Did that fall through the cracks or is there disagreement about whether it
was the right thing to do?

Thanks,
Jay

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

* Re: Potential deadlock in KNI RX path
  2016-04-06 20:22 Potential deadlock in KNI RX path Jay Rolette
@ 2016-04-07 14:33 ` Ferruh Yigit
  2016-04-07 15:55   ` [PATCH] kni: fix possible deadlock Ferruh Yigit
  2016-04-07 17:58   ` Potential deadlock in KNI RX path Jay Rolette
  0 siblings, 2 replies; 5+ messages in thread
From: Ferruh Yigit @ 2016-04-07 14:33 UTC (permalink / raw)
  To: Jay Rolette, DPDK; +Cc: Neil Horman

On 4/6/2016 9:22 PM, Jay Rolette wrote:
> Over a year ago, Neil pointed out that calling netif_rx() from
> kni_net_rx_normal() was a bug and could cause lockups. Here's the comment:
> 
> http://dpdk.org/ml/archives/dev/2015-March/015783.html
> 
> Looking at the current code base, it is still calling netif_rx() instead of
> netif_rx_ni() as suggested.
> 
> Did that fall through the cracks or is there disagreement about whether it
> was the right thing to do?
> 
> Thanks,
> Jay
> 
Hi Jay,

Using netif_rx_ni() looks like correct thing to do. I will send a patch
for it.

But we poll on this function, this means doing lots of
preempt_disable/enable(); which may have a negative effect on
performance. Although I did very brief test and did not observed any
performance degradation.

It can be great if somebody out already using KNI do some performance
analysis with the patch.

Another observation, for multiple kthread mode, the ksoftirq threads CPU
consumption removed when switched to netif_rx_ni(), I remember in mail
list somebody complained about ksoftirq CPU usage increase for this case.

Regards,
ferruh

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

* [PATCH] kni: fix possible deadlock
  2016-04-07 14:33 ` Ferruh Yigit
@ 2016-04-07 15:55   ` Ferruh Yigit
  2016-04-07 17:29     ` Thomas Monjalon
  2016-04-07 17:58   ` Potential deadlock in KNI RX path Jay Rolette
  1 sibling, 1 reply; 5+ messages in thread
From: Ferruh Yigit @ 2016-04-07 15:55 UTC (permalink / raw)
  To: dev; +Cc: Jay Rolette, Neil Horman, Ferruh Yigit

netif_rx() should be used in interrupt context. Replace it with
netif_rx_ni() which is safe to use in process context.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 lib/librte_eal/linuxapp/kni/kni_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c b/lib/librte_eal/linuxapp/kni/kni_net.c
index e02edcb..cfa8339 100644
--- a/lib/librte_eal/linuxapp/kni/kni_net.c
+++ b/lib/librte_eal/linuxapp/kni/kni_net.c
@@ -175,7 +175,7 @@ kni_net_rx_normal(struct kni_dev *kni)
 			skb->ip_summed = CHECKSUM_UNNECESSARY;
 
 			/* Call netif interface */
-			netif_rx(skb);
+			netif_rx_ni(skb);
 
 			/* Update statistics */
 			kni->stats.rx_bytes += len;
-- 
2.5.5

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

* Re: [PATCH] kni: fix possible deadlock
  2016-04-07 15:55   ` [PATCH] kni: fix possible deadlock Ferruh Yigit
@ 2016-04-07 17:29     ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2016-04-07 17:29 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Jay Rolette, Neil Horman

2016-04-07 16:55, Ferruh Yigit:
> netif_rx() should be used in interrupt context. Replace it with
> netif_rx_ni() which is safe to use in process context.
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied, thanks

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

* Re: Potential deadlock in KNI RX path
  2016-04-07 14:33 ` Ferruh Yigit
  2016-04-07 15:55   ` [PATCH] kni: fix possible deadlock Ferruh Yigit
@ 2016-04-07 17:58   ` Jay Rolette
  1 sibling, 0 replies; 5+ messages in thread
From: Jay Rolette @ 2016-04-07 17:58 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: DPDK, Neil Horman

On Thu, Apr 7, 2016 at 9:33 AM, Ferruh Yigit <ferruh.yigit@intel.com> wrote:

> On 4/6/2016 9:22 PM, Jay Rolette wrote:
> > Over a year ago, Neil pointed out that calling netif_rx() from
> > kni_net_rx_normal() was a bug and could cause lockups. Here's the
> comment:
> >
> > http://dpdk.org/ml/archives/dev/2015-March/015783.html
> >
> > Looking at the current code base, it is still calling netif_rx() instead
> of
> > netif_rx_ni() as suggested.
> >
> > Did that fall through the cracks or is there disagreement about whether
> it
> > was the right thing to do?
> >
> > Thanks,
> > Jay
> >
> Hi Jay,
>
> Using netif_rx_ni() looks like correct thing to do. I will send a patch
> for it.
>
> But we poll on this function, this means doing lots of
> preempt_disable/enable(); which may have a negative effect on
> performance. Although I did very brief test and did not observed any
> performance degradation.
>
> It can be great if somebody out already using KNI do some performance
> analysis with the patch.
>
> Another observation, for multiple kthread mode, the ksoftirq threads CPU
> consumption removed when switched to netif_rx_ni(), I remember in mail
> list somebody complained about ksoftirq CPU usage increase for this case.
>

Thanks Ferruh. We'll make that change in our local repo and run it through
its paces.

Jay

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

end of thread, other threads:[~2016-04-07 17:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-06 20:22 Potential deadlock in KNI RX path Jay Rolette
2016-04-07 14:33 ` Ferruh Yigit
2016-04-07 15:55   ` [PATCH] kni: fix possible deadlock Ferruh Yigit
2016-04-07 17:29     ` Thomas Monjalon
2016-04-07 17:58   ` Potential deadlock in KNI RX path Jay Rolette

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.