Skip to contentSkip to conversation

fix suspend/resume on b44

PATCH In review Pavel Machek 3 participants 6 messages Sep 20, 2005 – Sep 21, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix suspend/resume on b44

Fix suspend/resume on b44 by freeing/reacquiring irq. Otherwise it hangs on resume.

---
commit 7bdc8fc378f053bd4eb4210beb1d494485318512 tree 6e5679697b11eb70b73ff5275aafe7c34a90ffef parent 17cd36a6d0fc36b61fa558cade6a98a3e99a6992 author <pavel@amd.(none)> Tue, 20 Sep 2005 15:26:37 +0200 committer <pavel@amd.(none)> Tue, 20 Sep 2005 15:26:37 +0200

 drivers/net/b44.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/net/b44.c +5 -0
@@ -1930,6 +1930,8 @@ static int b44_suspend(struct pci_dev *p
 	b44_free_rings(bp);
 
 	spin_unlock_irq(&bp->lock);
+
+	free_irq(dev->irq, dev);
 	pci_disable_device(pdev);
 	return 0;
 }
@@ -1946,6 +1948,9 @@ static int b44_resume(struct pci_dev *pd
 	if (!netif_running(dev))
 		return 0;
 
+	if (request_irq(dev->irq, b44_interrupt, SA_SHIRQ, dev->name, dev))
+		printk(KERN_ERR PFX "%s: request_irq failed\n", dev->name);
+
 	spin_lock_irq(&bp->lock);
 
 	b44_init_rings(bp);
Signature · 1 line
if you have sharp zaurus hardware you don't need... you know my address
#1 lore raw
Quoted 19 lines · Pavel Machek

Fix suspend/resume on b44 by freeing/reacquiring irq. Otherwise it hangs on resume.

...

drivers/net/b44.c +2 -0
@@ -1930,6 +1930,8 @@ static int b44_suspend(struct pci_dev *p
 	b44_free_rings(bp);
 
 	spin_unlock_irq(&bp->lock);
+
+	free_irq(dev->irq, dev);
 	pci_disable_device(pdev);
 	return 0;
 }

drivers/net/b44.c static int b44_resume(struct pci_dev *pd · line 1956

Quoted 9 lines
drivers/net/b44.c +3 -0
@@ -1946,6 +1948,9 @@ static int b44_resume(struct pci_dev *pd
 	if (!netif_running(dev))
 		return 0;
 
+	if (request_irq(dev->irq, b44_interrupt, SA_SHIRQ, dev->name, dev))
+		printk(KERN_ERR PFX "%s: request_irq failed\n", dev->name);
+
 	spin_lock_irq(&bp->lock);
 
 	b44_init_rings(bp);

Why does it hang on suspend/resume?

This came up a while back and iirc we decided that adding free_irq() to every ->suspend() handler in the world was the wrong thing to do. Do I misremember?

#2 lore raw

Hi!

Quoted 21 lines
Quoted 21 lines
drivers/net/b44.c +5 -0
@@ -1930,6 +1930,8 @@ static int b44_suspend(struct pci_dev *p
 	b44_free_rings(bp);
 
 	spin_unlock_irq(&bp->lock);
+
+	free_irq(dev->irq, dev);
 	pci_disable_device(pdev);
 	return 0;
 }
@@ -1946,6 +1948,9 @@ static int b44_resume(struct pci_dev *pd
 	if (!netif_running(dev))
 		return 0;
 
+	if (request_irq(dev->irq, b44_interrupt, SA_SHIRQ, dev->name, dev))
+		printk(KERN_ERR PFX "%s: request_irq failed\n", dev->name);
+
 	spin_lock_irq(&bp->lock);
 
Quoted 8 lines

drivers/net/b44.c static int b44_resume(struct pci_dev *pd · line 1956

Quoted 2 lines
drivers/net/b44.c +0 -0
 	b44_init_rings(bp);

Why does it hang on suspend/resume?

This came up a while back and iirc we decided that adding free_irq() to every ->suspend() handler in the world was the wrong thing to do. Do I misremember?

No, you remember right, but b44 needed that free_irq/request_irq even because those ACPI changes. I'm not exactly sure why, something went very wrong otherwise.

Pavel

Signature · 1 line
Boycott Kodak -- for their patent abuse against Java.
#3 lore raw
Quoted 29 lines · Pavel Machek

Hi!

Quoted 26 lines
Quoted 14 lines
drivers/net/b44.c +2 -0
@@ -1930,6 +1930,8 @@ static int b44_suspend(struct pci_dev *p
 	b44_free_rings(bp);
 
 	spin_unlock_irq(&bp->lock);
+
+	free_irq(dev->irq, dev);
 	pci_disable_device(pdev);
 	return 0;
 }

drivers/net/b44.c static int b44_resume(struct pci_dev *pd · line 1956

Quoted 9 lines
drivers/net/b44.c +3 -0
@@ -1946,6 +1948,9 @@ static int b44_resume(struct pci_dev *pd
 	if (!netif_running(dev))
 		return 0;
 
+	if (request_irq(dev->irq, b44_interrupt, SA_SHIRQ, dev->name, dev))
+		printk(KERN_ERR PFX "%s: request_irq failed\n", dev->name);
+
 	spin_lock_irq(&bp->lock);
 
 	b44_init_rings(bp);

Why does it hang on suspend/resume?

Quoted 7 lines
Quoted 3 lines

This came up a while back and iirc we decided that adding free_irq() to every ->suspend() handler in the world was the wrong thing to do. Do I misremember?

No, you remember right, but b44 needed that free_irq/request_irq even because those ACPI changes. I'm not exactly sure why, something went very wrong otherwise.

Well I guess we should work out what went wrong ;)

What are the symptoms? Screaming interrupt? Can't immediately see why. Does the screaming interrupt detetor trigger and disable the IRQ Line?

#4 lore raw

Hi!

Quoted 30 lines
Quoted 30 lines
Quoted 29 lines
Quoted 14 lines
drivers/net/b44.c +2 -0
@@ -1930,6 +1930,8 @@ static int b44_suspend(struct pci_dev *p
 	b44_free_rings(bp);
 
 	spin_unlock_irq(&bp->lock);
+
+	free_irq(dev->irq, dev);
 	pci_disable_device(pdev);
 	return 0;
 }

drivers/net/b44.c static int b44_resume(struct pci_dev *pd · line 1956

Quoted 9 lines
drivers/net/b44.c +3 -0
@@ -1946,6 +1948,9 @@ static int b44_resume(struct pci_dev *pd
 	if (!netif_running(dev))
 		return 0;
 
+	if (request_irq(dev->irq, b44_interrupt, SA_SHIRQ, dev->name, dev))
+		printk(KERN_ERR PFX "%s: request_irq failed\n", dev->name);
+
 	spin_lock_irq(&bp->lock);
 
 	b44_init_rings(bp);

Why does it hang on suspend/resume?

This came up a while back and iirc we decided that adding free_irq() to every ->suspend() handler in the world was the wrong thing to do. Do I misremember?

Quoted 8 lines
Quoted 3 lines

No, you remember right, but b44 needed that free_irq/request_irq even because those ACPI changes. I'm not exactly sure why, something went very wrong otherwise.

Well I guess we should work out what went wrong ;)

What are the symptoms? Screaming interrupt? Can't immediately see why. Does the screaming interrupt detetor trigger and disable the IRQ Line?

No, it seems like BUG() triggers in
b44. https://bugzilla.novell.com/show_bug.cgi?id=116088 is for basically 2.6.13 kernel (but it was in something as old as 2.6.5, too).

Setting machine into suspend to disk with loaded module b44. While resuming,
kernel oopses and machine freezes after reloading data from swap. Image will be
appended.

If this can not be fixed in time, we could add this module to UNLOAD_MODULES_BEFORE_SUSPEND in powersave configuratiion.

Pavel

Signature · 1 line
if you have sharp zaurus hardware you don't need... you know my address
#5 lore raw
Quoted 39 lines · Pavel Machek

Hi!

Quoted 36 lines
Quoted 26 lines
Quoted 26 lines
Quoted 14 lines
drivers/net/b44.c +2 -0
@@ -1930,6 +1930,8 @@ static int b44_suspend(struct pci_dev *p
 	b44_free_rings(bp);
 
 	spin_unlock_irq(&bp->lock);
+
+	free_irq(dev->irq, dev);
 	pci_disable_device(pdev);
 	return 0;
 }

drivers/net/b44.c static int b44_resume(struct pci_dev *pd · line 1956

Quoted 9 lines
drivers/net/b44.c +3 -0
@@ -1946,6 +1948,9 @@ static int b44_resume(struct pci_dev *pd
 	if (!netif_running(dev))
 		return 0;
 
+	if (request_irq(dev->irq, b44_interrupt, SA_SHIRQ, dev->name, dev))
+		printk(KERN_ERR PFX "%s: request_irq failed\n", dev->name);
+
 	spin_lock_irq(&bp->lock);
 
 	b44_init_rings(bp);

Why does it hang on suspend/resume?

Quoted 7 lines
Quoted 3 lines

This came up a while back and iirc we decided that adding free_irq() to every ->suspend() handler in the world was the wrong thing to do. Do I misremember?

No, you remember right, but b44 needed that free_irq/request_irq even because those ACPI changes. I'm not exactly sure why, something went very wrong otherwise.

Well I guess we should work out what went wrong ;)

Quoted 8 lines
Quoted 2 lines

What are the symptoms? Screaming interrupt? Can't immediately see why. Does the screaming interrupt detetor trigger and disable the IRQ Line?

No, it seems like BUG() triggers in
b44. https://bugzilla.novell.com/show_bug.cgi?id=116088 is for basically 2.6.13 kernel (but it was in something as old as 2.6.5, too).

That's here:

static void b44_tx(struct b44 *bp)

{
	u32 cur, cons;

	cur  = br32(bp, B44_DMATX_STAT) & DMATX_STAT_CDMASK;
	cur /= sizeof(struct dma_desc);

	/* XXX needs updating when NETIF_F_SG is supported */
	for (cons = bp->tx_cons; cons != cur; cons = NEXT_TX(cons)) {
		struct ring_info *rp = &bp->tx_buffers[cons];
		struct sk_buff *skb = rp->skb;

		if (unlikely(skb == NULL))
			BUG();

So I'd assume that the newly-woken driver took an interrupt, decided that a Tx interrupt was pending then went BUG when it discovered that it hadn't sent anything.

Would be good to find out the value of istat in b44_interrupt() and poke maintainers, rather than proferring strange workarounds ;)