xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC] xen/netback: Count ring slots properly when larger MTU sizes are used
@ 2012-08-13  0:12 Palagummi, Siva
  2012-08-13  8:27 ` Jan Beulich
  0 siblings, 1 reply; 10+ messages in thread
From: Palagummi, Siva @ 2012-08-13  0:12 UTC (permalink / raw)
  To: xen-devel@lists.xen.org


[-- Attachment #1.1: Type: text/plain, Size: 358 bytes --]

Hi,

I ran into an issue where netback driver is crashing with BUG_ON(npo.meta_prod > ARRAY_SIZE(netbk->meta)). It is happening in Intel 10Gbps network when larger mtu values  are used. The problem seems to be  the way the slots are counted. After applying this patch things ran fine in my environment. I request to validate my changes.

Thanks
Siva


[-- Attachment #1.2: Type: text/html, Size: 2233 bytes --]

[-- Attachment #2: netback_slots_counting.patch --]
[-- Type: application/octet-stream, Size: 1637 bytes --]

From: Siva Palagummi <Siva.Palagummi@ca.com>

count variable in xen_netbk_rx_action need to be incremented
correctly to take into account of extra slots required when skb_headlen is 
greater than PAGE_SIZE when larger MTU values are used. Without this change 
BUG_ON(npo.meta_prod > ARRAY_SIZE(netbk->meta)) is causing 
netback thread to exit.

While inspecting the code, it looked like we also need to take care of
incrementing the count variable when gso_size is non zero.

The problem is seen with linux 3.2.2 kernel on Intel 10Gbps network.


Signed-off-by: Siva Palagummi <Siva.Palagummi@ca.com>
---

diff -uprN a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
--- a/drivers/net/xen-netback/netback.c	2012-01-25 19:39:32.000000000 -0500
+++ b/drivers/net/xen-netback/netback.c	2012-08-12 15:50:50.000000000 -0400
@@ -623,6 +623,24 @@ static void xen_netbk_rx_action(struct x
 
 		count += nr_frags + 1;
 
+		/*
+		 * The logic here should be somewhat similar to
+		 * xen_netbk_count_skb_slots. In case of larger MTU size,
+		 * skb head length may be more than a PAGE_SIZE. We need to
+		 * consider ring slots consumed by that data. If we do not,
+		 * then within this loop itself we end up consuming more meta
+		 * slots turning the BUG_ON below. With this fix we may end up
+		 * iterating through xen_netbk_rx_action multiple times
+		 * instead of crashing netback thread.
+		 */
+
+
+		count += DIV_ROUND_UP(skb_headlen(skb), PAGE_SIZE);
+
+		if (skb_shinfo(skb)->gso_size)
+			count++;
+
 		__skb_queue_tail(&rxq, skb);
 
 		/* Filled the batch queue? */

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

end of thread, other threads:[~2012-08-22 14:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-13  0:12 [PATCH RFC] xen/netback: Count ring slots properly when larger MTU sizes are used Palagummi, Siva
2012-08-13  8:27 ` Jan Beulich
2012-08-14 21:17   ` Palagummi, Siva
2012-08-21 13:14     ` Ian Campbell
2012-08-22 13:14       ` Palagummi, Siva
2012-08-22 13:22         ` Ian Campbell
2012-08-22 13:30           ` Palagummi, Siva
2012-08-22 13:40             ` Ian Campbell
2012-08-22 14:32               ` Palagummi, Siva
2012-08-22 14:39                 ` Ian Campbell

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