public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sky2: avoid pci write posting after disabling irqs
@ 2014-11-30 11:56 Lino Sanfilippo
  2014-11-30 17:54 ` Stephen Hemminger
  2014-12-06  5:34 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Lino Sanfilippo @ 2014-11-30 11:56 UTC (permalink / raw)
  To: stephen; +Cc: mlindner, netdev, linux-kernel, Lino Sanfilippo

In sky2_change_mtu setting B0_IMSK to 0 may be delayed due to PCI write posting
which could result in irqs being still active when synchronize_irq is called.
Since we are not prepared to handle any further irqs after synchronize_irq
(our resources are freed after that) force the write by a consecutive read from
the same register.
Similar situation in sky2_all_down: Here we disabled irqs by a write to B0_IMSK
but did not ensure that this write took place before synchronize_irq. Fix that
too.

Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de>
---
 drivers/net/ethernet/marvell/sky2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index bd33662..f14544c 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -2419,6 +2419,7 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu)
 
 	imask = sky2_read32(hw, B0_IMSK);
 	sky2_write32(hw, B0_IMSK, 0);
+	sky2_read32(hw, B0_IMSK);
 
 	dev->trans_start = jiffies;	/* prevent tx timeout */
 	napi_disable(&hw->napi);
@@ -3487,8 +3488,8 @@ static void sky2_all_down(struct sky2_hw *hw)
 	int i;
 
 	if (hw->flags & SKY2_HW_IRQ_SETUP) {
-		sky2_read32(hw, B0_IMSK);
 		sky2_write32(hw, B0_IMSK, 0);
+		sky2_read32(hw, B0_IMSK);
 
 		synchronize_irq(hw->pdev->irq);
 		napi_disable(&hw->napi);
-- 
1.9.1

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

* Re: [PATCH] sky2: avoid pci write posting after disabling irqs
  2014-11-30 11:56 [PATCH] sky2: avoid pci write posting after disabling irqs Lino Sanfilippo
@ 2014-11-30 17:54 ` Stephen Hemminger
  2014-12-06  5:34 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2014-11-30 17:54 UTC (permalink / raw)
  To: Lino Sanfilippo; +Cc: mlindner, netdev, linux-kernel

On Sun, 30 Nov 2014 12:56:51 +0100
Lino Sanfilippo <LinoSanfilippo@gmx.de> wrote:

> In sky2_change_mtu setting B0_IMSK to 0 may be delayed due to PCI write posting
> which could result in irqs being still active when synchronize_irq is called.
> Since we are not prepared to handle any further irqs after synchronize_irq
> (our resources are freed after that) force the write by a consecutive read from
> the same register.
> Similar situation in sky2_all_down: Here we disabled irqs by a write to B0_IMSK
> but did not ensure that this write took place before synchronize_irq. Fix that
> too.
> 
> Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de>

Looks correct.

Acked-by: Stephen Hemminger <stephen@networkplumber.org>

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

* Re: [PATCH] sky2: avoid pci write posting after disabling irqs
  2014-11-30 11:56 [PATCH] sky2: avoid pci write posting after disabling irqs Lino Sanfilippo
  2014-11-30 17:54 ` Stephen Hemminger
@ 2014-12-06  5:34 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-12-06  5:34 UTC (permalink / raw)
  To: LinoSanfilippo; +Cc: stephen, mlindner, netdev, linux-kernel

From: Lino Sanfilippo <LinoSanfilippo@gmx.de>
Date: Sun, 30 Nov 2014 12:56:51 +0100

> In sky2_change_mtu setting B0_IMSK to 0 may be delayed due to PCI write posting
> which could result in irqs being still active when synchronize_irq is called.
> Since we are not prepared to handle any further irqs after synchronize_irq
> (our resources are freed after that) force the write by a consecutive read from
> the same register.
> Similar situation in sky2_all_down: Here we disabled irqs by a write to B0_IMSK
> but did not ensure that this write took place before synchronize_irq. Fix that
> too.
> 
> Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de>

Applied.

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

end of thread, other threads:[~2014-12-06  5:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-30 11:56 [PATCH] sky2: avoid pci write posting after disabling irqs Lino Sanfilippo
2014-11-30 17:54 ` Stephen Hemminger
2014-12-06  5:34 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox