Skip to contentSkip to conversation

ath10k: Remove ATH10K_STATE_RESTARTED in simulate fw crash

PATCH Superseded Wen Gong 5 participants 14 messages Nov 14, 2018 – May 28, 2019 Qualcomm Atheros ATH10K wireless driver

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Wen Gong

author
#0 lore raw

PATCH 1/1 ath10k: Remove ATH10K_STATE_RESTARTED in simulate fw crash

When test simulate firmware crash, it is easy to trigger error. command:
echo soft > /sys/kernel/debug/ieee80211/phyxx/ath10k/simulate_fw_crash.

If input more than two times continuously, then it will have error. Error message:
ath10k_pci 0000:02:00.0: failed to set vdev 1 RX wake policy: -108 ath10k_pci 0000:02:00.0: device is wedged, will not restart

It is because the state has not changed to ATH10K_STATE_ON immediately, then it will have more than two simulate crash process running meanwhile, and complete/wakeup some field twice, it destroy the normal recovery process.

Tested with QCA6174 PCI with firmware WLAN.RM.4.4.1-00109-QCARMSWPZ-1, but this will also affect QCA9377 PCI. It's not a regression with new firmware releases.

---
 drivers/net/wireless/ath/ath10k/debug.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/ath/ath10k/debug.c +1 -2
index ada29a4..dc8700b 100644
@@ -569,8 +569,7 @@ static ssize_t ath10k_write_simulate_fw_crash(struct file *file,
 
 	mutex_lock(&ar->conf_mutex);
 
-	if (ar->state != ATH10K_STATE_ON &&
-	    ar->state != ATH10K_STATE_RESTARTED) {
+	if (ar->state != ATH10K_STATE_ON) {
 		ret = -ENETDOWN;
 		goto exit;
 	}
Signature · 1 line
1.9.1
#1 lore raw
Quoted 10 lines · Wen Gong

When test simulate firmware crash, it is easy to trigger error. command:
echo soft > /sys/kernel/debug/ieee80211/phyxx/ath10k/simulate_fw_crash.

If input more than two times continuously, then it will have error. Error message:
ath10k_pci 0000:02:00.0: failed to set vdev 1 RX wake policy: -108 ath10k_pci 0000:02:00.0: device is wedged, will not restart

Quoted 4 lines

It is because the state has not changed to ATH10K_STATE_ON immediately, then it will have more than two simulate crash process running meanwhile, and complete/wakeup some field twice, it destroy the normal recovery process.

This was intended to allow testing not only firmware crash path (and recovery) but also firmware crash while recovering from a firmware crash.

Michał

#2 lore raw
Quoted 8 lines
Quoted 4 lines

It is because the state has not changed to ATH10K_STATE_ON immediately, then it will have more than two simulate crash process running meanwhile, and complete/wakeup some field twice, it destroy the normal recovery process.

This was intended to allow testing not only firmware crash path (and recovery) but also firmware crash while recovering from a firmware crash.

If firmware is recovering from crash, then simulate a new crash will trigger error. So remove it.

Quoted 7 lines

Michał

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

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

#3 lore raw
Quoted 11 lines · Wen Gong
Quoted 9 lines
Quoted 5 lines

It is because the state has not changed to ATH10K_STATE_ON immediately, then it will have more than two simulate crash process running meanwhile, and complete/wakeup some field twice, it destroy the normal recovery process.

This was intended to allow testing not only firmware crash path (and recovery) but also firmware crash while recovering from a firmware crash.

If firmware is recovering from crash, then simulate a new crash will trigger error. So remove it.

That's actually a feature, not a bug. If firmware crashes while driver is restarting after a crash then its likely going to fail again and again causing a crash-restart loop which can affect system performance and responsiveness. It's better to give up and let the system admin take over.

If it's still bothering you then please consider a crash counter threshold so that, e.g. after 5 crash-while-restarting it's going to give up. However I doubt it's worth the effort. My experience tells me firmware crashes during recovery are rarely, if at all, transient.

The simulated fw crash is not representative here. It's a mere tool to test driver code.

Michał

#4 lore raw
Quoted 18 lines
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines

It is because the state has not changed to ATH10K_STATE_ON immediately, then it will have more than two simulate crash process running meanwhile, and complete/wakeup some field twice, it destroy the normal recovery process.

This was intended to allow testing not only firmware crash path (and recovery) but also firmware crash while recovering from a firmware crash.

If firmware is recovering from crash, then simulate a new crash will trigger

error.

Quoted 1 line

So remove it.

That's actually a feature, not a bug. If firmware crashes while driver is restarting after a crash then its likely going to fail again and again causing a crash-restart loop which can affect system performance and responsiveness. It's better to give up and let the system admin take over.

Quoted 7 lines

If it's still bothering you then please consider a crash counter threshold so that, e.g. after 5 crash-while-restarting it's going to give up. However I doubt it's worth the effort. My experience tells me firmware crashes during recovery are rarely, if at all, transient.

The simulated fw crash is not representative here. It's a mere tool to test driver code.

The simulated fw crash is only a tool for user to trigger fw crash with command, This change's purpose is to disallow user to trigger fw crash if the fw is not in a Normal state.

If the fw is in recovering state triggered by user's command or by fw, then it will disallow user to run command to trigger fw crash again until fw become to a normal State.

Quoted 3 lines

Michał

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

#5 lore raw
Quoted 22 lines · Wen Gong
Quoted 22 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines

It is because the state has not changed to ATH10K_STATE_ON immediately, then it will have more than two simulate crash process running meanwhile, and complete/wakeup some field twice, it destroy the normal recovery process.

This was intended to allow testing not only firmware crash path (and recovery) but also firmware crash while recovering from a firmware crash.

If firmware is recovering from crash, then simulate a new crash will trigger

error.

Quoted 1 line

So remove it.

That's actually a feature, not a bug. If firmware crashes while driver is restarting after a crash then its likely going to fail again and again causing a crash-restart loop which can affect system performance and responsiveness. It's better to give up and let the system admin take over.

If it's still bothering you then please consider a crash counter threshold so that, e.g. after 5 crash-while-restarting it's going to give up. However I doubt it's worth the effort. My experience tells me firmware crashes during recovery are rarely, if at all, transient.

Quoted 5 lines
Quoted 2 lines

The simulated fw crash is not representative here. It's a mere tool to test driver code.

The simulated fw crash is only a tool for user to trigger fw crash with command

I think Michal knows what simulate_fw_crash as he is the one who implemented it in commit 278c4a85e626 :)

Quoted 6 lines

This change's purpose is to disallow user to trigger fw crash if the fw is not in a Normal state.

If the fw is in recovering state triggered by user's command or by fw, then it will disallow user to run command to trigger fw crash again until fw become to a normal State.

I agree with Michal here and his proposal about having a crash counter sounds like a good to me. So I'm dropping this patch.

Signature · 6 lines
Kalle Valo

_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
#6 lore raw
Quoted 9 lines · Kalle Valo
Quoted 6 lines

This change's purpose is to disallow user to trigger fw crash if the fw is not in a Normal state.

If the fw is in recovering state triggered by user's command or by fw, then it will disallow user to run command to trigger fw crash again until fw become to a normal State.

I agree with Michal here and his proposal about having a crash counter sounds like a good to me. So I'm dropping this patch.

Bah, missed a word again. I meant "sounds like a good idea to me".

Signature · 6 lines
Kalle Valo

_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
#7 lore raw
In reply to Michał Kazior
Quoted 14 lines

-----Original Message-----
From: Michał Kazior <[email protected]>
Sent: Monday, January 7, 2019 4:36 PM
To: Wen Gong <[email protected]>
Cc: Wen Gong <[email protected]>; linux-wireless <linux- [email protected]>; [email protected]
Subject: [EXT] Re: [PATCH] ath10k: Remove ATH10K_STATE_RESTARTED in simulate fw crash
That's actually a feature, not a bug. If firmware crashes while driver is restarting after a crash then its likely going to fail again and again causing a crash-restart loop which can affect system performance and responsiveness. It's better to give up and let the system admin take over.

Quoted 8 lines

If it's still bothering you then please consider a crash counter threshold so that, e.g. after 5 crash-while-restarting it's going to give up. However I doubt it's worth the effort. My experience tells me firmware crashes during recovery are rarely, if at all, transient.

The simulated fw crash is not representative here. It's a mere tool to test driver code.

Hi Michal,
There have a stress test case for the simulate fw crash, it will simulate fw crash in a very short time for each test, this will trigger the stress test fail. The simulate fw crash process should not be run parallel, after this patch, the Stress test case will pass.

Quoted 2 lines

Michał

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

#8 lore raw
Quoted 22 lines

-----Original Message-----
From: Wen Gong
Sent: Monday, April 1, 2019 2:11 PM
To: 'Michał Kazior' <[email protected]>
Cc: Wen Gong <[email protected]>; linux-wireless <linux- [email protected]>; [email protected]
Subject: RE: [EXT] Re: [PATCH] ath10k: Remove ATH10K_STATE_RESTARTED in simulate fw crash

Quoted 9 lines

If it's still bothering you then please consider a crash counter threshold so that, e.g. after 5 crash-while-restarting it's going to give up. However I doubt it's worth the effort. My experience tells me firmware crashes during recovery are rarely, if at all, transient.

The simulated fw crash is not representative here. It's a mere tool to test driver code.

Quoted 7 lines

Hi Michal,
There have a stress test case for the simulate fw crash, it will simulate fw crash
in a very short time for each test, this will trigger the stress test fail. The simulate fw crash process should not be run parallel, after this patch, the Stress test case will pass.

Quoted 1 line

Hi Michał,
Do you have some new comments?

Quoted 1 line
Quoted 1 line

Michał

#9 lore raw
Quoted 26 lines · Wen Gong
Quoted 18 lines

-----Original Message-----
From: Wen Gong
Sent: Monday, April 1, 2019 2:11 PM
To: 'Michał Kazior' <[email protected]>
Cc: Wen Gong <[email protected]>; linux-wireless <linux- [email protected]>; [email protected]
Subject: RE: [EXT] Re: [PATCH] ath10k: Remove ATH10K_STATE_RESTARTED in simulate fw crash

Quoted 9 lines

If it's still bothering you then please consider a crash counter threshold so that, e.g. after 5 crash-while-restarting it's going to give up. However I doubt it's worth the effort. My experience tells me firmware crashes during recovery are rarely, if at all, transient.

The simulated fw crash is not representative here. It's a mere tool to test driver code.

Quoted 7 lines

Hi Michal,
There have a stress test case for the simulate fw crash, it will simulate fw crash
in a very short time for each test, this will trigger the stress test fail. The simulate fw crash process should not be run parallel, after this patch, the Stress test case will pass.

Quoted 1 line
Quoted 2 lines

Hi Michał,
Do you have some new comments?

My original use case was to be able to exercise the driver's robustness in handling nested fw crashes, IOW crash-within-a-crash.

Your test case, as far as I understand, intends to perform consecutive, non-nested fw crash simulation stress test.

Both of these are mutually exclusive and your patch fixes your test case at the expense of breaking my original case.

To satisfy both I would suggest you either expose ar->state via debugfs and make your test procedure wait for that to get back into ON state before simulating a crash again, or to extend the set of current simulate_fw_crash commands (currently just: soft, hard, assert, hw-restart) to something that allows expressing the intent whether crash-in-crash prevention is intended (your case) or not (my original case).

This could be for example something like this:
echo soft wait-ready > simulate_fw_crash

The "wait-ready" extra keyword would imply crash-in-crash prevention. This would keep existing tools working (both behavior and syntax) and would allow your test case to be implemented.

Michał

#10 lore raw
Quoted 37 lines

From: Michał Kazior <[email protected]>
Sent: Tuesday, April 9, 2019 1:27 AM
To: Wen Gong <[email protected]>
Cc: Wen Gong <[email protected]>; linux-wireless <linux- [email protected]>; [email protected]
Subject: [EXT] Re: [PATCH] ath10k: Remove ATH10K_STATE_RESTARTED in simulate fw crash

Quoted 5 lines
Quoted 5 lines

Hi Michal,
There have a stress test case for the simulate fw crash, it will simulate fw crash
in a very short time for each test, this will trigger the stress test fail. The simulate fw crash process should not be run parallel, after this patch,

the

Quoted 5 lines
Quoted 2 lines

Stress test case will pass.

Quoted 1 line

Hi Michał,
Do you have some new comments?

My original use case was to be able to exercise the driver's robustness in handling nested fw crashes, IOW crash-within-a-crash.

Your test case, as far as I understand, intends to perform consecutive, non-nested fw crash simulation stress test.

Both of these are mutually exclusive and your patch fixes your test case at the expense of breaking my original case.

To satisfy both I would suggest you either expose ar->state via debugfs and make your test procedure wait for that to get back into ON state before simulating a crash again, or to extend the set of current simulate_fw_crash commands (currently just: soft, hard, assert, hw-restart) to something that allows expressing the intent whether crash-in-crash prevention is intended (your case) or not (my original case).

Quoted 7 lines

This could be for example something like this:
echo soft wait-ready > simulate_fw_crash

The "wait-ready" extra keyword would imply crash-in-crash prevention. This would keep existing tools working (both behavior and syntax) and would allow your test case to be implemented.

Is it easy to change your existing tools?
I want to change it to: echo soft skip-ready > simulate_fw_crash The "skip-ready" extra keyword would imply crash-in-crash, *not* prevention. My test tools is hard to change.

Quoted 2 lines

Michał

#11 lore raw
Quoted 12 lines · Wen Gong
Quoted 12 lines

From: Michał Kazior <[email protected]>
To satisfy both I would suggest you either expose ar->state via debugfs and make your test procedure wait for that to get back into ON state before simulating a crash again, or to extend the set of current simulate_fw_crash commands (currently just: soft, hard, assert, hw-restart) to something that allows expressing the intent whether crash-in-crash prevention is intended (your case) or not (my original case).

This could be for example something like this:
echo soft wait-ready > simulate_fw_crash

Quoted 8 lines
Quoted 4 lines

The "wait-ready" extra keyword would imply crash-in-crash prevention. This would keep existing tools working (both behavior and syntax) and would allow your test case to be implemented.

Is it easy to change your existing tools?
I want to change it to: echo soft skip-ready > simulate_fw_crash The "skip-ready" extra keyword would imply crash-in-crash, *not* prevention. My test tools is hard to change.

In case you're talking about the test framework we run for ChromeOS validation, no, it's not hard at all to change. As long as there's a good reason.

I haven't closely followed this, but judging by the above summary, it's probably more reasonable for our test framework to only simulate FW crashes after the driver returns to "ready" (or at least, if we do crash-in-crash, don't expect the driver to recover?). I expect we can work with whatever mechanism you implement for that (exposing the "state", or providing a new simulate_fw_crash mode).

Brian

#12 lore raw
Quoted 38 lines

-----Original Message-----
From: Brian Norris <[email protected]>
Sent: Wednesday, April 10, 2019 7:25 AM
To: Wen Gong <[email protected]>
Cc: Michał Kazior <[email protected]>; Wen Gong <[email protected]>; linux-wireless <[email protected]>; [email protected]
Subject: [EXT] Re: [PATCH] ath10k: Remove ATH10K_STATE_RESTARTED in simulate fw crash

Quoted 12 lines · Wen Gong
Quoted 12 lines

From: Michał Kazior <[email protected]>
To satisfy both I would suggest you either expose ar->state via debugfs and make your test procedure wait for that to get back into ON state before simulating a crash again, or to extend the set of current simulate_fw_crash commands (currently just: soft, hard, assert, hw-restart) to something that allows expressing the intent whether crash-in-crash prevention is intended (your case) or not (my original case).

This could be for example something like this:
echo soft wait-ready > simulate_fw_crash

Quoted 7 lines
Quoted 4 lines

The "wait-ready" extra keyword would imply crash-in-crash prevention. This would keep existing tools working (both behavior and syntax) and would allow your test case to be implemented.

Is it easy to change your existing tools?
I want to change it to: echo soft skip-ready > simulate_fw_crash The "skip-ready" extra keyword would imply crash-in-crash, *not*

prevention.

Quoted 1 line

My test tools is hard to change.

In case you're talking about the test framework we run for ChromeOS validation, no, it's not hard at all to change. As long as there's a good reason.

Quoted 7 lines

I haven't closely followed this, but judging by the above summary, it's probably more reasonable for our test framework to only simulate FW crashes after the driver returns to "ready" (or at least, if we do crash-in-crash, don't expect the driver to recover?). I expect we can work with whatever mechanism you implement for that (exposing the "state", or providing a new simulate_fw_crash mode).

If ChromeOS is easy to change tool,
I think I will change the mechanism of the simulate_fw_crash. Then all tools will work normally.

Quoted 1 line

Brian

#13 lore raw
Quoted 10 lines

-----Original Message-----
From: ath10k <[email protected]> On Behalf Of Wen Gong
Sent: Wednesday, April 10, 2019 10:45 AM
To: Brian Norris <[email protected]>
Cc: Michał Kazior <[email protected]>; linux-wireless <linux- [email protected]>; [email protected]; Wen Gong <[email protected]>
Subject: [EXT] RE: [PATCH] ath10k: Remove ATH10K_STATE_RESTARTED in simulate fw crash

Quoted 4 lines

If ChromeOS is easy to change tool,
I think I will change the mechanism of the simulate_fw_crash. Then all tools will work normally.

New patch uploaded
https://patchwork.kernel.org/patch/10897587/
[v2] ath10k: Remove ATH10K_STATE_RESTARTED in simulate fw crash