* [ath9k-devel] [PATCH] ath10k: avoid infinite loop
[not found] <87wqrhcqxq.fsf@kamboji.qca.qualcomm.com>
@ 2013-05-06 7:33 ` Michal Kazior
2013-05-07 14:00 ` Kalle Valo
2013-05-06 7:47 ` [ath9k-devel] [RFT] ath10k: retry target reset Michal Kazior
1 sibling, 1 reply; 6+ messages in thread
From: Michal Kazior @ 2013-05-06 7:33 UTC (permalink / raw)
To: ath9k-devel
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
drivers/net/wireless/ath/ath10k/pci.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index ca09a44..41e58da 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -457,9 +457,11 @@ void ath10k_do_pci_wake(struct ath10k *ar)
break;
}
- if (tot_delay > PCIE_WAKE_TIMEOUT)
- ath10k_warn("keep_awake_count %d\n",
+ if (tot_delay > PCIE_WAKE_TIMEOUT) {
+ ath10k_warn("target takes too long to wake up (awake count %d)\n",
atomic_read(&ar_pci->keep_awake_count));
+ break;
+ }
udelay(curr_delay);
tot_delay += curr_delay;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [ath9k-devel] [RFT] ath10k: retry target reset
[not found] <87wqrhcqxq.fsf@kamboji.qca.qualcomm.com>
2013-05-06 7:33 ` [ath9k-devel] [PATCH] ath10k: avoid infinite loop Michal Kazior
@ 2013-05-06 7:47 ` Michal Kazior
2013-05-09 6:57 ` Kalle Valo
1 sibling, 1 reply; 6+ messages in thread
From: Michal Kazior @ 2013-05-06 7:47 UTC (permalink / raw)
To: ath9k-devel
Sometimes the device just won't reset cleanly
without retrying. This seems to depend on the host
hardware.
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
I can't reproduce the issue on my hw. Can someone
confirm if this fixes the problem?
drivers/net/wireless/ath/ath10k/pci.c | 48 +++++++++++++++++++++++++--------
1 file changed, 37 insertions(+), 11 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 41e58da..3ae9298 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -422,15 +422,19 @@ static bool ath10k_pci_target_is_awake(struct ath10k *ar)
return (RTC_STATE_V_GET(val) == RTC_STATE_V_ON);
}
-static void ath10k_pci_wait(struct ath10k *ar)
+static int ath10k_pci_wait(struct ath10k *ar)
{
int n = 100;
while (n-- && !ath10k_pci_target_is_awake(ar))
msleep(10);
- if (n < 0)
+ if (n < 0) {
ath10k_warn("Unable to wakeup target\n");
+ return -EIO;
+ }
+
+ return 0;
}
void ath10k_do_pci_wake(struct ath10k *ar)
@@ -1931,7 +1935,12 @@ static int ath10k_pci_start_intr_legacy(struct ath10k *ar)
ar_pci->mem + PCIE_LOCAL_BASE_ADDRESS +
PCIE_SOC_WAKE_ADDRESS);
- ath10k_pci_wait(ar);
+ ret = ath10k_pci_wait(ar);
+ if (ret) {
+ ath10k_err("target did not wake up\n");
+ free_irq(ar_pci->pdev->irq, ar);
+ return ret;
+ }
/*
* A potential race occurs here: The CORE_BASE write
@@ -2019,13 +2028,18 @@ static int ath10k_pci_reset_target(struct ath10k *ar)
{
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
int wait_limit = 300; /* 3 sec */
+ int ret = 0;
/* Wait for Target to finish initialization before we proceed. */
iowrite32(PCIE_SOC_WAKE_V_MASK,
ar_pci->mem + PCIE_LOCAL_BASE_ADDRESS +
PCIE_SOC_WAKE_ADDRESS);
- ath10k_pci_wait(ar);
+ ret = ath10k_pci_wait(ar);
+ if (ret) {
+ ath10k_warn("target did not wake up\n");
+ goto exit;
+ }
while (wait_limit-- &&
!(ioread32(ar_pci->mem + FW_INDICATOR_ADDRESS) &
@@ -2040,18 +2054,19 @@ static int ath10k_pci_reset_target(struct ath10k *ar)
}
if (wait_limit < 0) {
- ath10k_err("Target stalled\n");
+ ath10k_warn("target stalled\n");
iowrite32(PCIE_SOC_WAKE_RESET,
ar_pci->mem + PCIE_LOCAL_BASE_ADDRESS +
PCIE_SOC_WAKE_ADDRESS);
- return -EIO;
+ ret = -EIO;
+ goto exit;
}
+exit:
iowrite32(PCIE_SOC_WAKE_RESET,
ar_pci->mem + PCIE_LOCAL_BASE_ADDRESS +
PCIE_SOC_WAKE_ADDRESS);
-
- return 0;
+ return ret;
}
static void ath10k_pci_device_reset(struct ath10k_pci *ar_pci)
@@ -2128,6 +2143,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
struct ath10k *ar;
struct ath10k_pci *ar_pci;
u32 lcr_val;
+ int reset_retries = 3;
ath10k_dbg(ATH10K_DBG_PCI, "%s\n", __func__);
@@ -2252,11 +2268,21 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
* is in an unexpected state. We try to catch that here in order to
* reset the Target and retry the probe.
*/
- ath10k_pci_device_reset(ar_pci);
+ while (reset_retries-- > 0) {
+ ath10k_pci_device_reset(ar_pci);
- ret = ath10k_pci_reset_target(ar);
- if (ret)
+ ret = ath10k_pci_reset_target(ar);
+ if (ret == 0)
+ break;
+
+ ath10k_warn("retrying to reset target (%d tries left)\n",
+ reset_retries);
+ }
+
+ if (ret) {
+ ath10k_err("could not reset target (%d)\n", ret);
goto err_intr;
+ }
if (ath10k_target_ps) {
ath10k_dbg(ATH10K_DBG_PCI, "on-chip power save enabled\n");
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [ath9k-devel] [PATCH] ath10k: avoid infinite loop
2013-05-06 7:33 ` [ath9k-devel] [PATCH] ath10k: avoid infinite loop Michal Kazior
@ 2013-05-07 14:00 ` Kalle Valo
0 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2013-05-07 14:00 UTC (permalink / raw)
To: ath9k-devel
Michal Kazior <michal.kazior@tieto.com> writes:
> Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Thanks, applied.
--
Kalle Valo
^ permalink raw reply [flat|nested] 6+ messages in thread
* [ath9k-devel] [RFT] ath10k: retry target reset
2013-05-06 7:47 ` [ath9k-devel] [RFT] ath10k: retry target reset Michal Kazior
@ 2013-05-09 6:57 ` Kalle Valo
2013-05-09 7:22 ` Michal Kazior
0 siblings, 1 reply; 6+ messages in thread
From: Kalle Valo @ 2013-05-09 6:57 UTC (permalink / raw)
To: ath9k-devel
Michal Kazior <michal.kazior@tieto.com> writes:
> Sometimes the device just won't reset cleanly
> without retrying. This seems to depend on the host
> hardware.
>
> Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
> ---
>
> I can't reproduce the issue on my hw. Can someone
> confirm if this fixes the problem?
If you are referencing to the crash I reported to you privately, I have
seen that problem only once and haven't been able to reproduce since. So
I can't really test this patch.
> @@ -1931,7 +1935,12 @@ static int ath10k_pci_start_intr_legacy(struct ath10k *ar)
> ar_pci->mem + PCIE_LOCAL_BASE_ADDRESS +
> PCIE_SOC_WAKE_ADDRESS);
>
> - ath10k_pci_wait(ar);
> + ret = ath10k_pci_wait(ar);
> + if (ret) {
> + ath10k_err("target did not wake up\n");
> + free_irq(ar_pci->pdev->irq, ar);
> + return ret;
> + }
>
> /*
> * A potential race occurs here: The CORE_BASE write
> @@ -2019,13 +2028,18 @@ static int ath10k_pci_reset_target(struct ath10k *ar)
> {
> struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
> int wait_limit = 300; /* 3 sec */
> + int ret = 0;
>
> /* Wait for Target to finish initialization before we proceed. */
> iowrite32(PCIE_SOC_WAKE_V_MASK,
> ar_pci->mem + PCIE_LOCAL_BASE_ADDRESS +
> PCIE_SOC_WAKE_ADDRESS);
>
> - ath10k_pci_wait(ar);
> + ret = ath10k_pci_wait(ar);
> + if (ret) {
> + ath10k_warn("target did not wake up\n");
> + goto exit;
You have same warnings messages in different places now. I recommend
adding "..for start" and "...for reset", or something like that, to
exactly identify the warning location. Example:
ath10k_warn("target did not wake up for reset\n");
--
Kalle Valo
^ permalink raw reply [flat|nested] 6+ messages in thread
* [ath9k-devel] [RFT] ath10k: retry target reset
2013-05-09 6:57 ` Kalle Valo
@ 2013-05-09 7:22 ` Michal Kazior
2013-05-09 8:27 ` Kalle Valo
0 siblings, 1 reply; 6+ messages in thread
From: Michal Kazior @ 2013-05-09 7:22 UTC (permalink / raw)
To: ath9k-devel
On 09/05/13 08:57, Kalle Valo wrote:
> Michal Kazior <michal.kazior@tieto.com> writes:
>
>> Sometimes the device just won't reset cleanly
>> without retrying. This seems to depend on the host
>> hardware.
>>
>> Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
>> ---
>>
>> I can't reproduce the issue on my hw. Can someone
>> confirm if this fixes the problem?
>
> If you are referencing to the crash I reported to you privately, I have
> seen that problem only once and haven't been able to reproduce since. So
> I can't really test this patch.
Yes. This is both fortunate, and unfortunate :) The patch is actually my
best guess what that issue might've been related to.
> You have same warnings messages in different places now. I recommend
> adding "..for start" and "...for reset", or something like that, to
> exactly identify the warning location. Example:
>
> ath10k_warn("target did not wake up for reset\n");
Good catch. Thanks!
-- Pozdrawiam / Best regards, Michal Kazior.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [ath9k-devel] [RFT] ath10k: retry target reset
2013-05-09 7:22 ` Michal Kazior
@ 2013-05-09 8:27 ` Kalle Valo
0 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2013-05-09 8:27 UTC (permalink / raw)
To: ath9k-devel
Michal Kazior <michal.kazior@tieto.com> writes:
> On 09/05/13 08:57, Kalle Valo wrote:
>> Michal Kazior <michal.kazior@tieto.com> writes:
>>
>>> Sometimes the device just won't reset cleanly
>>> without retrying. This seems to depend on the host
>>> hardware.
>>>
>>> Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
>>> ---
>>>
>>> I can't reproduce the issue on my hw. Can someone
>>> confirm if this fixes the problem?
>>
>> If you are referencing to the crash I reported to you privately, I have
>> seen that problem only once and haven't been able to reproduce since. So
>> I can't really test this patch.
>
> Yes. This is both fortunate, and unfortunate :) The patch is actually
> my best guess what that issue might've been related to.
At least your patch should help with the symptoms after the problem
appears. I will let you know if I see the problem again.
--
Kalle Valo
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-05-09 8:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <87wqrhcqxq.fsf@kamboji.qca.qualcomm.com>
2013-05-06 7:33 ` [ath9k-devel] [PATCH] ath10k: avoid infinite loop Michal Kazior
2013-05-07 14:00 ` Kalle Valo
2013-05-06 7:47 ` [ath9k-devel] [RFT] ath10k: retry target reset Michal Kazior
2013-05-09 6:57 ` Kalle Valo
2013-05-09 7:22 ` Michal Kazior
2013-05-09 8:27 ` Kalle Valo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.