Skip to contentSkip to conversation

ath10k: fix vdev-start timeout on error

PATCH Superseded [email protected] 2 participants 5 messages Jul 13, 2018 Qualcomm Atheros ATH10K wireless driver

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath10k: fix vdev-start timeout on error

From: Ben Greear <[email protected]>

The vdev-start-response message should cause the completion to fire, even in the error case. Otherwise, the user still gets no useful information and everything is blocked until the timeout period.

Add some warning text to print out the invalid status code to aid debugging.

---
 drivers/net/wireless/ath/ath10k/wmi.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath10k/wmi.c +9 -3
index a60de71..ec4cd1e 100644
@@ -3443,12 +3443,18 @@ void ath10k_wmi_event_vdev_start_resp(struct ath10k *ar, struct sk_buff *skb)
 	ret = ath10k_wmi_pull_vdev_start(ar, skb, &arg);
 	if (ret) {
 		ath10k_warn(ar, "failed to parse vdev start event: %d\n", ret);
-		return;
+		goto out;
 	}
 
-	if (WARN_ON(__le32_to_cpu(arg.status)))
-		return;
+	if (WARN_ON_ONCE(__le32_to_cpu(arg.status))) {
+		ath10k_warn(ar, "vdev-start-response reports status error: %d\n",
+			    __le32_to_cpu(arg.status));
+		/* Setup is done one way or another though, so we should still
+		 * do the completion, so don't return here.
+		 */
+	}
 
+out:
 	complete(&ar->vdev_setup_done);
 }
 
Signature · 7 lines
2.4.11


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
#1 lore raw
Quoted 29 lines · On 13 July 2018 at 19:08, <[email protected]> wrote:

From: Ben Greear <[email protected]>

The vdev-start-response message should cause the completion to fire, even in the error case. Otherwise, the user still gets no useful information and everything is blocked until the timeout period.

Add some warning text to print out the invalid status code to aid debugging.

---
 drivers/net/wireless/ath/ath10k/wmi.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath10k/wmi.c +1 -3
index a60de71..ec4cd1e 100644
@@ -3443,12 +3443,18 @@ void ath10k_wmi_event_vdev_start_resp(struct ath10k *ar, struct sk_buff *skb)
        ret = ath10k_wmi_pull_vdev_start(ar, skb, &arg);
        if (ret) {
                ath10k_warn(ar, "failed to parse vdev start event: %d\n", ret);
-               return;
+               goto out;
        }
 
-       if (WARN_ON(__le32_to_cpu(arg.status)))
-               return;

drivers/net/wireless/ath/ath10k/wmi.c void ath10k_wmi_event_vdev_start_resp(struct ath10k *ar, struct sk_buff *skb) · line 3458

Quoted 10 lines
drivers/net/wireless/ath/ath10k/wmi.c +8 -0
+       if (WARN_ON_ONCE(__le32_to_cpu(arg.status))) {
+               ath10k_warn(ar, "vdev-start-response reports status error: %d\n",
+                           __le32_to_cpu(arg.status));
+               /* Setup is done one way or another though, so we should still
+                * do the completion, so don't return here.
+                */
+       }
 
+out:
        complete(&ar->vdev_setup_done);

With this the waiter can no longer tell if vdev_start succeeded or not. It'll always think it succeeded even if arg.status or parsing failed. Waiter instead of erroring out will continue to play out happy scenario and may end up crashing firmware.

Not stalling is nice, but I'd argue the status should be propagated back to the waiter so it can error-check.

Michal

_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k

author
#2 lore raw
Quoted 46 lines · Michał Kazior
Quoted 29 lines · On 13 July 2018 at 19:08, <[email protected]> wrote:

From: Ben Greear <[email protected]>

The vdev-start-response message should cause the completion to fire, even in the error case. Otherwise, the user still gets no useful information and everything is blocked until the timeout period.

Add some warning text to print out the invalid status code to aid debugging.

---
 drivers/net/wireless/ath/ath10k/wmi.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath10k/wmi.c +1 -3
index a60de71..ec4cd1e 100644
@@ -3443,12 +3443,18 @@ void ath10k_wmi_event_vdev_start_resp(struct ath10k *ar, struct sk_buff *skb)
        ret = ath10k_wmi_pull_vdev_start(ar, skb, &arg);
        if (ret) {
                ath10k_warn(ar, "failed to parse vdev start event: %d\n", ret);
-               return;
+               goto out;
        }
 
-       if (WARN_ON(__le32_to_cpu(arg.status)))
-               return;

drivers/net/wireless/ath/ath10k/wmi.c void ath10k_wmi_event_vdev_start_resp(struct ath10k *ar, struct sk_buff *skb) · line 3458

Quoted 10 lines
drivers/net/wireless/ath/ath10k/wmi.c +8 -0
+       if (WARN_ON_ONCE(__le32_to_cpu(arg.status))) {
+               ath10k_warn(ar, "vdev-start-response reports status error: %d\n",
+                           __le32_to_cpu(arg.status));
+               /* Setup is done one way or another though, so we should still
+                * do the completion, so don't return here.
+                */
+       }
 
+out:
        complete(&ar->vdev_setup_done);

With this the waiter can no longer tell if vdev_start succeeded or not. It'll always think it succeeded even if arg.status or parsing failed. Waiter instead of erroring out will continue to play out happy scenario and may end up crashing firmware.

Quoted 2 lines

Not stalling is nice, but I'd argue the status should be propagated back to the waiter so it can error-check.

So, maybe set ar->last_wmi_error = __le32_to_cpu(arg.status) before calling the complete and change the code that waits for vdev_setup_done to check that error code?

Or, maybe we need an error code specific to this call, ar->last_wmi_vdev_start_status?

Thanks,
Ben

Signature · 8 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
#3 lore raw
Quoted 59 lines · Ben Greear
Quoted 54 lines · Michał Kazior
Quoted 39 lines · On 13 July 2018 at 19:08, <[email protected]> wrote:

From: Ben Greear <[email protected]>

The vdev-start-response message should cause the completion to fire, even in the error case. Otherwise, the user still gets no useful information and everything is blocked until the timeout period.

Add some warning text to print out the invalid status code to aid debugging.

---
 drivers/net/wireless/ath/ath10k/wmi.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath10k/wmi.c +5 -3
index a60de71..ec4cd1e 100644
@@ -3443,12 +3443,18 @@ void ath10k_wmi_event_vdev_start_resp(struct
 ath10k *ar, struct sk_buff *skb)
        ret = ath10k_wmi_pull_vdev_start(ar, skb, &arg);
        if (ret) {
                ath10k_warn(ar, "failed to parse vdev start event: %d\n",
 ret);
-               return;
+               goto out;
        }
 
-       if (WARN_ON(__le32_to_cpu(arg.status)))
-               return;
+       if (WARN_ON_ONCE(__le32_to_cpu(arg.status))) {
+               ath10k_warn(ar, "vdev-start-response reports status
 error: %d\n",
+                           __le32_to_cpu(arg.status));
+               /* Setup is done one way or another though, so we should

still

drivers/net/wireless/ath/ath10k/wmi.c void ath10k_wmi_event_vdev_start_resp(struct ath10k *ar, struct sk_buff *skb) · line 3458

Quoted 6 lines
drivers/net/wireless/ath/ath10k/wmi.c +4 -0
+                * do the completion, so don't return here.
+                */
+       }
 
+out:
        complete(&ar->vdev_setup_done);

With this the waiter can no longer tell if vdev_start succeeded or not. It'll always think it succeeded even if arg.status or parsing failed. Waiter instead of erroring out will continue to play out happy scenario and may end up crashing firmware.

Quoted 2 lines

Not stalling is nice, but I'd argue the status should be propagated back to the waiter so it can error-check.

Quoted 7 lines

So, maybe set ar->last_wmi_error = __le32_to_cpu(arg.status) before calling the complete and change the code that waits for vdev_setup_done to check that
error code?

Or, maybe we need an error code specific to this call, ar->last_wmi_vdev_start_status?

Tough call. I can't find any compelling argument to prefer one over the other. Maybe last_wmi_error is a bit too generic?

Michał

_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k

author
#4 lore raw
Quoted 65 lines · Michał Kazior
Quoted 64 lines · Ben Greear
Quoted 54 lines · Michał Kazior
Quoted 39 lines · On 13 July 2018 at 19:08, <[email protected]> wrote:

From: Ben Greear <[email protected]>

The vdev-start-response message should cause the completion to fire, even in the error case. Otherwise, the user still gets no useful information and everything is blocked until the timeout period.

Add some warning text to print out the invalid status code to aid debugging.

---
 drivers/net/wireless/ath/ath10k/wmi.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath10k/wmi.c +5 -3
index a60de71..ec4cd1e 100644
@@ -3443,12 +3443,18 @@ void ath10k_wmi_event_vdev_start_resp(struct
 ath10k *ar, struct sk_buff *skb)
        ret = ath10k_wmi_pull_vdev_start(ar, skb, &arg);
        if (ret) {
                ath10k_warn(ar, "failed to parse vdev start event: %d\n",
 ret);
-               return;
+               goto out;
        }
 
-       if (WARN_ON(__le32_to_cpu(arg.status)))
-               return;
+       if (WARN_ON_ONCE(__le32_to_cpu(arg.status))) {
+               ath10k_warn(ar, "vdev-start-response reports status
 error: %d\n",
+                           __le32_to_cpu(arg.status));
+               /* Setup is done one way or another though, so we should

still

drivers/net/wireless/ath/ath10k/wmi.c void ath10k_wmi_event_vdev_start_resp(struct ath10k *ar, struct sk_buff *skb) · line 3458

Quoted 6 lines
drivers/net/wireless/ath/ath10k/wmi.c +4 -0
+                * do the completion, so don't return here.
+                */
+       }
 
+out:
        complete(&ar->vdev_setup_done);

With this the waiter can no longer tell if vdev_start succeeded or not. It'll always think it succeeded even if arg.status or parsing failed. Waiter instead of erroring out will continue to play out happy scenario and may end up crashing firmware.

Quoted 2 lines

Not stalling is nice, but I'd argue the status should be propagated back to the waiter so it can error-check.

So, maybe set ar->last_wmi_error = __le32_to_cpu(arg.status) before calling the complete and change the code that waits for vdev_setup_done to check that
error code?

Quoted 5 lines
Quoted 2 lines

Or, maybe we need an error code specific to this call, ar->last_wmi_vdev_start_status?

Tough call. I can't find any compelling argument to prefer one over the other. Maybe last_wmi_error is a bit too generic?

I was thinking some actions might require multiple wmi calls, and so each one we track would need its own variable.

I'll implement it with a more specific error code and post a new patch.

Thanks,
Ben

Signature · 8 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k