linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Clemens Buchacher <drizzd@aon.at>
To: Adrian Chadd <adrian@freebsd.org>
Cc: Mohammed Shafi <shafi.wireless@gmail.com>,
	linux-wireless@vger.kernel.org
Subject: Re: ath9k: irq storm after suspend/resume
Date: Mon, 3 Oct 2011 10:48:23 +0200	[thread overview]
Message-ID: <20111003084823.GA1521@ecki.lan> (raw)
In-Reply-To: <CAJ-VmokcM4KmzV7Rn9PA68iEiTJiPw=ffYgNFLDAHShxD0HNAg@mail.gmail.com>

(re-added linux-wireless)

On Fri, Sep 30, 2011 at 01:46:06PM +0800, Adrian Chadd wrote:
> 
> if (sc->sc_flags & SC_OP_INVALID) {
> printk(KERN_ERR "AR_INTR_SYNC_CAUSE: 0x%08x, AR_INTR_ASYNC_CAUSE: 0x%08x\n",
>     REG_READ(ah, AR_INTR_SYNC_CAUSE), REG_READ(ah, AR_INTR_ASYNC_CAUSE));
> printk(KERN_ERR "AR_IMR: 0x%08x, AR_ISR: 0x%08x\n",
>     REG_READ(ah, AR_IMR),
>     REG_READ(ah, AR_ISR));
>     return IRQ_NONE;
> }

I only output the first 99 and then every 2^n'th interrupt. The log
gets truncated otherwise. If I load the module first, then
suspend/resume, I get this until "nobody cared".

for 1, 2, ..., 99, 128, 256:
AR_INTR_SYNC_CAUSE: 0x00000000, AR_INTR_ASYNC_CAUSE: 0x00000000
AR_IMR: 0xdeadbeef, AR_ISR: 0xdeadbeef

for 512:
AR_INTR_SYNC_CAUSE: 0x00000000, AR_INTR_ASYNC_CAUSE: 0x00000000
AR_IMR: 0x00000000, AR_ISR: 0x00000208

for 1024:
AR_INTR_SYNC_CAUSE: 0x00000000, AR_INTR_ASYNC_CAUSE: 0x00000000
AR_IMR: 0x81800964, AR_ISR: 0x00000008

for 2048:
AR_INTR_SYNC_CAUSE: 0x00000000, AR_INTR_ASYNC_CAUSE: 0x00000000
AR_IMR: 0xdeadbeef, AR_ISR: 0xdeadbeef

for 2^12, 2^13, ..., 2^16
AR_INTR_SYNC_CAUSE: 0x00020000, AR_INTR_ASYNC_CAUSE: 0x00000000
AR_IMR: 0xdeadbeef, AR_ISR: 0xdeadbeef

The last ones indeed correspond to AR_INTR_SYNC_MAC_SLEEP_ACCESS
that you mentioned. Note that this output is interleaved with
device initialization. So I don't know if that causes the register
contents to become valid, or if it changes the contents.

If I suspend/resume first, then load the module, then wait for 500
ms after request_irq I get only zeroes, repeated 109 times:

for 1, 2, ..., 99, 2^7, 2^8, ..., 2^16:
AR_IMR: 0x00000000, AR_ISR: 0x00000000
AR_INTR_SYNC_CAUSE: 0x00000000, AR_INTR_ASYNC_CAUSE: 0x00000000

Clemens
---

diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index edaa784..634256b 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -16,6 +16,7 @@
 
 #include <linux/nl80211.h>
 #include <linux/delay.h>
+#include <linux/log2.h>
 #include "ath9k.h"
 #include "btcoex.h"
 
@@ -765,8 +766,19 @@ irqreturn_t ath_isr(int irq, void *dev)
 	 * touch anything. Note this can happen early
 	 * on if the IRQ is shared.
 	 */
-	if (sc->sc_flags & SC_OP_INVALID)
+	if (sc->sc_flags & SC_OP_INVALID) {
+		static int count = 0;
+		if (count < INT_MAX)
+			count++;
+		if (count < 100 || is_power_of_2(count)) {
+			printk(KERN_ERR "AR_INTR_SYNC_CAUSE: 0x%08x, AR_INTR_ASYNC_CAUSE: 0x%08x\n",
+					REG_READ(ah, AR_INTR_SYNC_CAUSE), REG_READ(ah, AR_INTR_ASYNC_CAUSE));
+			printk(KERN_ERR "AR_IMR: 0x%08x, AR_ISR: 0x%08x\n",
+					REG_READ(ah, AR_IMR),
+					REG_READ(ah, AR_ISR));
+		}
 		return IRQ_NONE;
+	}
 
 
 	/* shared irq, not for us */
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index d67d6ee..76006a9 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -246,20 +246,24 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	/* Will be cleared in ath9k_start() */
 	sc->sc_flags |= SC_OP_INVALID;
 
+	ret = ath9k_init_device(id->device, sc, &ath_pci_bus_ops);
+	if (ret) {
+		dev_err(&pdev->dev, "Failed to initialize device\n");
+		goto err_init;
+	}
+
+	printk(KERN_INFO "ath9k: requesting irq\n");
 	ret = request_irq(pdev->irq, ath_isr, IRQF_SHARED, "ath9k", sc);
 	if (ret) {
 		dev_err(&pdev->dev, "request_irq failed\n");
 		goto err_irq;
 	}
+	printk(KERN_INFO "wait 500 ms\n");
+	msleep(500);
+	printk(KERN_INFO "done waiting\n");
 
 	sc->irq = pdev->irq;
 
-	ret = ath9k_init_device(id->device, sc, &ath_pci_bus_ops);
-	if (ret) {
-		dev_err(&pdev->dev, "Failed to initialize device\n");
-		goto err_init;
-	}
-
 	ath9k_hw_name(sc->sc_ah, hw_name, sizeof(hw_name));
 	wiphy_info(hw->wiphy, "%s mem=0x%lx, irq=%d\n",
 		   hw_name, (unsigned long)mem, pdev->irq);

  parent reply	other threads:[~2011-10-03  9:48 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-27 11:32 ath9k: irq storm after suspend/resume Clemens Buchacher
2011-08-29  7:55 ` Mohammed Shafi
2011-08-29 11:53   ` Mohammed Shafi
2011-08-29 15:12     ` Mohammed Shafi
2011-08-30  6:41       ` Clemens Buchacher
2011-08-30  9:33         ` Mohammed Shafi
2011-08-30  9:41           ` Mohammed Shafi
2011-09-01  6:24           ` Clemens Buchacher
2011-09-26  9:24             ` Mohammed Shafi
2011-09-27 21:42               ` Clemens Buchacher
2011-09-29  8:18                 ` Mohammed Shafi
2011-09-29 10:33                   ` Adrian Chadd
2011-09-29 17:11                     ` Clemens Buchacher
     [not found]                     ` <CAD2nsn0Z2J4r4tN_fLjx5bbvz2bg6NVcQ8vppJbbNcgOF8pFew@mail.gmail.com>
     [not found]                       ` <CAJ-VmokcM4KmzV7Rn9PA68iEiTJiPw=ffYgNFLDAHShxD0HNAg@mail.gmail.com>
2011-10-03  8:48                         ` Clemens Buchacher [this message]
2011-10-04  7:58                           ` Adrian Chadd
2011-10-04 18:15                             ` Clemens Buchacher
2011-10-04 21:11                               ` Adrian Chadd
2011-10-05  6:28                                 ` Clemens Buchacher
2011-10-05 13:02                                   ` Adrian Chadd
2011-10-12 13:10                                     ` Mohammed Shafi
2011-10-15  9:39                                       ` Clemens Buchacher
2011-10-15 10:01                                         ` Adrian Chadd
2011-10-18  6:44                                           ` Clemens Buchacher
2011-10-18  7:05                                             ` Adrian Chadd
2011-10-21 10:22                                               ` Clemens Buchacher
2011-10-21 14:10                                                 ` Adrian Chadd
2011-10-21 19:03                                                   ` Clemens Buchacher
2011-10-21 20:20                                                   ` Clemens Buchacher
2011-10-22  0:47                                                     ` Adrian Chadd
2011-10-22  7:22                                                       ` Clemens Buchacher
2011-10-22  7:29                                                         ` Adrian Chadd
2011-10-04 18:36                             ` Clemens Buchacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111003084823.GA1521@ecki.lan \
    --to=drizzd@aon.at \
    --cc=adrian@freebsd.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=shafi.wireless@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).