netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH,RFC] gianfar: fix BUG under load after introduction of skb recycling
@ 2009-05-23 11:51 Lennert Buytenhek
  2009-05-24 15:32 ` Michael Guntsche
  0 siblings, 1 reply; 3+ messages in thread
From: Lennert Buytenhek @ 2009-05-23 11:51 UTC (permalink / raw)
  To: Andy Fleming, Michael Guntsche
  Cc: davem, netdev, linux-kernel, Rafael J. Wysocki

Since commit 0fd56bb5be6455d0d42241e65aed057244665e5e ("gianfar:
Add support for skb recycling"), gianfar puts skbuffs that are in
the rx ring back onto the recycle list as-is in case there was a
receive error, but this breaks the following invariant: that all
skbuffs on the recycle list have skb->data = skb->head + NET_SKB_PAD.

The RXBUF_ALIGNMENT realignment done in gfar_new_skb() will be done
twice on skbuffs recycled in this way, causing there not to be enough
room in the skb anymore to receive a full packet, eventually leading
to an skb_over_panic from gfar_clean_rx_ring() -> skb_put().

Resetting the skb->data pointer to skb->head + NET_SKB_PAD before
putting the skb back onto the recycle list restores the mentioned
invariant, and should fix this issue.

Reported-by: Michael Guntsche <mike@it-loops.com>
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
---
This might/should/could fix http://bugzilla.kernel.org/show_bug.cgi?id=13293

Michael, can you re-test with this version of the patch?
Andy, can you see if this is OK with you?

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index b2c4967..a051918 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1885,8 +1885,17 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit)
 
 			if (unlikely(!newskb))
 				newskb = skb;
-			else if (skb)
+			else if (skb) {
+				/*
+				 * We need to reset ->data to what it
+				 * was before gfar_new_skb() re-aligned
+				 * it to an RXBUF_ALIGNMENT boundary
+				 * before we put the skb back on the
+				 * recycle list.
+				 */
+				skb->data = skb->head + NET_SKB_PAD;
 				__skb_queue_head(&priv->rx_recycle, skb);
+			}
 		} else {
 			/* Increment the number of packets */
 			dev->stats.rx_packets++;
-- 
1.5.6.4


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

* Re: [PATCH,RFC] gianfar: fix BUG under load after introduction of skb recycling
  2009-05-23 11:51 [PATCH,RFC] gianfar: fix BUG under load after introduction of skb recycling Lennert Buytenhek
@ 2009-05-24 15:32 ` Michael Guntsche
  2009-05-25  7:42   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Guntsche @ 2009-05-24 15:32 UTC (permalink / raw)
  To: Lennert Buytenhek
  Cc: Andy Fleming, davem, netdev, linux-kernel, Rafael J. Wysocki


On May 23, 2009, at 13:51, Lennert Buytenhek wrote:

> Since commit 0fd56bb5be6455d0d42241e65aed057244665e5e ("gianfar:
> Add support for skb recycling"), gianfar puts skbuffs that are in
> the rx ring back onto the recycle list as-is in case there was a
> receive error, but this breaks the following invariant: that all
> skbuffs on the recycle list have skb->data = skb->head + NET_SKB_PAD.
>
>
> Michael, can you re-test with this version of the patch?
> Andy, can you see if this is OK with you?

Hi, I have been running tests with this patch for the last 6 hours and  
had no panics so far.
So it fixes the issues I am seeing as well.

Hope this helps,
Michael

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

* Re: [PATCH,RFC] gianfar: fix BUG under load after introduction of skb recycling
  2009-05-24 15:32 ` Michael Guntsche
@ 2009-05-25  7:42   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2009-05-25  7:42 UTC (permalink / raw)
  To: mike; +Cc: buytenh, afleming, netdev, linux-kernel, rjw

From: Michael Guntsche <mike@it-loops.com>
Date: Sun, 24 May 2009 17:32:05 +0200

> 
> On May 23, 2009, at 13:51, Lennert Buytenhek wrote:
> 
>> Since commit 0fd56bb5be6455d0d42241e65aed057244665e5e ("gianfar:
>> Add support for skb recycling"), gianfar puts skbuffs that are in
>> the rx ring back onto the recycle list as-is in case there was a
>> receive error, but this breaks the following invariant: that all
>> skbuffs on the recycle list have skb->data = skb->head + NET_SKB_PAD.
>>
>>
>> Michael, can you re-test with this version of the patch?
>> Andy, can you see if this is OK with you?
> 
> Hi, I have been running tests with this patch for the last 6 hours and
> had no panics so far.
> So it fixes the issues I am seeing as well.

Since it's now tested, I am applying this to net-2.6 to expedite it's
inclusion into 2.6.30

Thanks.

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

end of thread, other threads:[~2009-05-25  7:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-23 11:51 [PATCH,RFC] gianfar: fix BUG under load after introduction of skb recycling Lennert Buytenhek
2009-05-24 15:32 ` Michael Guntsche
2009-05-25  7:42   ` David Miller

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