netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ibm emac: Don't call napi_complete if napi_reschedule failed
@ 2013-10-29 23:50 Alistair Popple
  2013-10-29 23:50 ` [PATCH 2/2] ibm emac: Fix locking for enable/disable eob irq Alistair Popple
  2013-10-30  2:58 ` [PATCH 1/2] ibm emac: Don't call napi_complete if napi_reschedule failed David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Alistair Popple @ 2013-10-29 23:50 UTC (permalink / raw)
  To: netdev, davem; +Cc: benh, Alistair Popple

This patch fixes a bug which would trigger the BUG_ON() at
net/core/dev.c:4156. It was found that this was due to continuing
processing in the current poll call even when the call to
napi_reschedule failed, indicating the device was already on the
polling list. This resulted in an extra call to napi_complete which
triggered the BUG_ON().

This patch ensures that we only contine processing rotting packets in
the current mal_poll call if we are not already on the polling list.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
---
 drivers/net/ethernet/ibm/emac/mal.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm/emac/mal.c
index 856ea66..dcb623a 100644
--- a/drivers/net/ethernet/ibm/emac/mal.c
+++ b/drivers/net/ethernet/ibm/emac/mal.c
@@ -442,15 +442,11 @@ static int mal_poll(struct napi_struct *napi, int budget)
 		if (unlikely(mc->ops->peek_rx(mc->dev) ||
 			     test_bit(MAL_COMMAC_RX_STOPPED, &mc->flags))) {
 			MAL_DBG2(mal, "rotting packet" NL);
-			if (napi_reschedule(napi))
-				mal_disable_eob_irq(mal);
-			else
-				MAL_DBG2(mal, "already in poll list" NL);
-
-			if (budget > 0)
-				goto again;
-			else
+			if (!napi_reschedule(napi))
 				goto more_work;
+
+			mal_disable_eob_irq(mal);
+			goto again;
 		}
 		mc->ops->poll_tx(mc->dev);
 	}
-- 
1.7.10.4

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

* [PATCH 2/2] ibm emac: Fix locking for enable/disable eob irq
  2013-10-29 23:50 [PATCH 1/2] ibm emac: Don't call napi_complete if napi_reschedule failed Alistair Popple
@ 2013-10-29 23:50 ` Alistair Popple
  2013-10-30  2:58   ` David Miller
  2013-10-30  2:58 ` [PATCH 1/2] ibm emac: Don't call napi_complete if napi_reschedule failed David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Alistair Popple @ 2013-10-29 23:50 UTC (permalink / raw)
  To: netdev, davem; +Cc: benh, Alistair Popple

Calls to mal_enable_eob_irq perform a read-write-modify of a dcr to
enable device irqs which is protected by a spin lock. However calls to
mal_disable_eob_irq do not take the corresponding lock.

This patch resolves the problem by ensuring that calls to
mal_disable_eob_irq also take the lock.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
---
 drivers/net/ethernet/ibm/emac/mal.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm/emac/mal.c
index dcb623a..2d2e1dd 100644
--- a/drivers/net/ethernet/ibm/emac/mal.c
+++ b/drivers/net/ethernet/ibm/emac/mal.c
@@ -263,7 +263,9 @@ static inline void mal_schedule_poll(struct mal_instance *mal)
 {
 	if (likely(napi_schedule_prep(&mal->napi))) {
 		MAL_DBG2(mal, "schedule_poll" NL);
+		spin_lock(&mal->lock);
 		mal_disable_eob_irq(mal);
+		spin_unlock(&mal->lock);
 		__napi_schedule(&mal->napi);
 	} else
 		MAL_DBG2(mal, "already in poll" NL);
@@ -445,7 +447,9 @@ static int mal_poll(struct napi_struct *napi, int budget)
 			if (!napi_reschedule(napi))
 				goto more_work;
 
+			spin_lock_irqsave(&mal->lock, flags);
 			mal_disable_eob_irq(mal);
+			spin_unlock_irqrestore(&mal->lock, flags);
 			goto again;
 		}
 		mc->ops->poll_tx(mc->dev);
-- 
1.7.10.4

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

* Re: [PATCH 1/2] ibm emac: Don't call napi_complete if napi_reschedule failed
  2013-10-29 23:50 [PATCH 1/2] ibm emac: Don't call napi_complete if napi_reschedule failed Alistair Popple
  2013-10-29 23:50 ` [PATCH 2/2] ibm emac: Fix locking for enable/disable eob irq Alistair Popple
@ 2013-10-30  2:58 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2013-10-30  2:58 UTC (permalink / raw)
  To: alistair; +Cc: netdev, benh

From: Alistair Popple <alistair@popple.id.au>
Date: Wed, 30 Oct 2013 10:50:37 +1100

> This patch fixes a bug which would trigger the BUG_ON() at
> net/core/dev.c:4156. It was found that this was due to continuing
> processing in the current poll call even when the call to
> napi_reschedule failed, indicating the device was already on the
> polling list. This resulted in an extra call to napi_complete which
> triggered the BUG_ON().
> 
> This patch ensures that we only contine processing rotting packets in
> the current mal_poll call if we are not already on the polling list.
> 
> Signed-off-by: Alistair Popple <alistair@popple.id.au>

Applied.

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

* Re: [PATCH 2/2] ibm emac: Fix locking for enable/disable eob irq
  2013-10-29 23:50 ` [PATCH 2/2] ibm emac: Fix locking for enable/disable eob irq Alistair Popple
@ 2013-10-30  2:58   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-10-30  2:58 UTC (permalink / raw)
  To: alistair; +Cc: netdev, benh

From: Alistair Popple <alistair@popple.id.au>
Date: Wed, 30 Oct 2013 10:50:38 +1100

> Calls to mal_enable_eob_irq perform a read-write-modify of a dcr to
> enable device irqs which is protected by a spin lock. However calls to
> mal_disable_eob_irq do not take the corresponding lock.
> 
> This patch resolves the problem by ensuring that calls to
> mal_disable_eob_irq also take the lock.
> 
> Signed-off-by: Alistair Popple <alistair@popple.id.au>

Applied.

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

end of thread, other threads:[~2013-10-30  2:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-29 23:50 [PATCH 1/2] ibm emac: Don't call napi_complete if napi_reschedule failed Alistair Popple
2013-10-29 23:50 ` [PATCH 2/2] ibm emac: Fix locking for enable/disable eob irq Alistair Popple
2013-10-30  2:58   ` David Miller
2013-10-30  2:58 ` [PATCH 1/2] ibm emac: Don't call napi_complete if napi_reschedule failed 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).