* [PATCH v2] ath10k: support firmware crash-by-assert
@ 2014-09-10 15:59 ` Kalle Valo
0 siblings, 0 replies; 8+ messages in thread
From: Kalle Valo @ 2014-09-10 15:59 UTC (permalink / raw)
To: ath10k; +Cc: linux-wireless
From: Ben Greear <greearb@candelatech.com>
10.1 firmware does not have an official way to
cause assert on purpose, but it can be done with
carefully crafted WMI command. This is a different
kind of crash from the 'hard' crash, which is
a bad memory dereference.
Different crashes decode in different manners, so
this will help the crash-report testing as well as
offer better ways to test firmware failure and
recovery.
kvalo: move the wmi command creation to debug.c, modify
the info print
Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/debug.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index f948a4d8ee59..c5d01058c2a3 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -565,6 +565,26 @@ static const struct file_operations fops_fw_stats = {
.llseek = default_llseek,
};
+/* This is a clean assert crash in firmware. */
+static int ath10k_debug_fw_assert(struct ath10k *ar)
+{
+ struct wmi_vdev_install_key_cmd *cmd;
+ struct sk_buff *skb;
+
+ skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd) + 16);
+ if (!skb)
+ return -ENOMEM;
+
+ cmd = (struct wmi_vdev_install_key_cmd *)skb->data;
+ memset(cmd, 0, sizeof(*cmd));
+
+ /* big enough number so that firmware asserts */
+ cmd->vdev_id = __cpu_to_le32(0x7ffe);
+
+ return ath10k_wmi_cmd_send(ar, skb,
+ ar->wmi.cmd->vdev_install_key_cmdid);
+}
+
static ssize_t ath10k_read_simulate_fw_crash(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
@@ -574,7 +594,10 @@ static ssize_t ath10k_read_simulate_fw_crash(struct file *file,
" WMI_FORCE_FW_HANG_ASSERT to firmware if FW"
" supports that command.\n `hard` - this will send"
" to firmware command with illegal parameters"
- " causing firmware crash.\n";
+ " causing firmware crash.\n"
+ "`assert` - this will send special illegal parameter"
+ " to firmware to cause assert failure"
+ " and crash.\n";
return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
}
@@ -623,6 +646,9 @@ static ssize_t ath10k_write_simulate_fw_crash(struct file *file,
*/
ret = ath10k_wmi_vdev_set_param(ar, 0x7fff,
ar->wmi.vdev_param->rts_threshold, 0);
+ } else if (!strcmp(buf, "assert")) {
+ ath10k_info(ar, "simulating firmware assert crash\n");
+ ret = ath10k_debug_fw_assert(ar);
} else {
ret = -EINVAL;
goto exit;
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2] ath10k: support firmware crash-by-assert
@ 2014-09-10 15:59 ` Kalle Valo
0 siblings, 0 replies; 8+ messages in thread
From: Kalle Valo @ 2014-09-10 15:59 UTC (permalink / raw)
To: ath10k; +Cc: linux-wireless
From: Ben Greear <greearb@candelatech.com>
10.1 firmware does not have an official way to
cause assert on purpose, but it can be done with
carefully crafted WMI command. This is a different
kind of crash from the 'hard' crash, which is
a bad memory dereference.
Different crashes decode in different manners, so
this will help the crash-report testing as well as
offer better ways to test firmware failure and
recovery.
kvalo: move the wmi command creation to debug.c, modify
the info print
Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/debug.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index f948a4d8ee59..c5d01058c2a3 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -565,6 +565,26 @@ static const struct file_operations fops_fw_stats = {
.llseek = default_llseek,
};
+/* This is a clean assert crash in firmware. */
+static int ath10k_debug_fw_assert(struct ath10k *ar)
+{
+ struct wmi_vdev_install_key_cmd *cmd;
+ struct sk_buff *skb;
+
+ skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd) + 16);
+ if (!skb)
+ return -ENOMEM;
+
+ cmd = (struct wmi_vdev_install_key_cmd *)skb->data;
+ memset(cmd, 0, sizeof(*cmd));
+
+ /* big enough number so that firmware asserts */
+ cmd->vdev_id = __cpu_to_le32(0x7ffe);
+
+ return ath10k_wmi_cmd_send(ar, skb,
+ ar->wmi.cmd->vdev_install_key_cmdid);
+}
+
static ssize_t ath10k_read_simulate_fw_crash(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
@@ -574,7 +594,10 @@ static ssize_t ath10k_read_simulate_fw_crash(struct file *file,
" WMI_FORCE_FW_HANG_ASSERT to firmware if FW"
" supports that command.\n `hard` - this will send"
" to firmware command with illegal parameters"
- " causing firmware crash.\n";
+ " causing firmware crash.\n"
+ "`assert` - this will send special illegal parameter"
+ " to firmware to cause assert failure"
+ " and crash.\n";
return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
}
@@ -623,6 +646,9 @@ static ssize_t ath10k_write_simulate_fw_crash(struct file *file,
*/
ret = ath10k_wmi_vdev_set_param(ar, 0x7fff,
ar->wmi.vdev_param->rts_threshold, 0);
+ } else if (!strcmp(buf, "assert")) {
+ ath10k_info(ar, "simulating firmware assert crash\n");
+ ret = ath10k_debug_fw_assert(ar);
} else {
ret = -EINVAL;
goto exit;
_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2] ath10k: support firmware crash-by-assert
2014-09-10 15:59 ` Kalle Valo
@ 2014-09-10 16:34 ` Ben Greear
-1 siblings, 0 replies; 8+ messages in thread
From: Ben Greear @ 2014-09-10 16:34 UTC (permalink / raw)
To: Kalle Valo, ath10k; +Cc: linux-wireless
On 09/10/2014 08:59 AM, Kalle Valo wrote:
> From: Ben Greear <greearb@candelatech.com>
>
> 10.1 firmware does not have an official way to
> cause assert on purpose, but it can be done with
> carefully crafted WMI command. This is a different
> kind of crash from the 'hard' crash, which is
> a bad memory dereference.
>
> Different crashes decode in different manners, so
> this will help the crash-report testing as well as
> offer better ways to test firmware failure and
> recovery.
>
> kvalo: move the wmi command creation to debug.c, modify
> the info print
This looks fine to me. I have not tested this version.
Thanks,
Ben
>
> Signed-off-by: Ben Greear <greearb@candelatech.com>
> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
> ---
> drivers/net/wireless/ath/ath10k/debug.c | 28 +++++++++++++++++++++++++++-
> 1 file changed, 27 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
> index f948a4d8ee59..c5d01058c2a3 100644
> --- a/drivers/net/wireless/ath/ath10k/debug.c
> +++ b/drivers/net/wireless/ath/ath10k/debug.c
> @@ -565,6 +565,26 @@ static const struct file_operations fops_fw_stats = {
> .llseek = default_llseek,
> };
>
> +/* This is a clean assert crash in firmware. */
> +static int ath10k_debug_fw_assert(struct ath10k *ar)
> +{
> + struct wmi_vdev_install_key_cmd *cmd;
> + struct sk_buff *skb;
> +
> + skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd) + 16);
> + if (!skb)
> + return -ENOMEM;
> +
> + cmd = (struct wmi_vdev_install_key_cmd *)skb->data;
> + memset(cmd, 0, sizeof(*cmd));
> +
> + /* big enough number so that firmware asserts */
> + cmd->vdev_id = __cpu_to_le32(0x7ffe);
> +
> + return ath10k_wmi_cmd_send(ar, skb,
> + ar->wmi.cmd->vdev_install_key_cmdid);
> +}
> +
> static ssize_t ath10k_read_simulate_fw_crash(struct file *file,
> char __user *user_buf,
> size_t count, loff_t *ppos)
> @@ -574,7 +594,10 @@ static ssize_t ath10k_read_simulate_fw_crash(struct file *file,
> " WMI_FORCE_FW_HANG_ASSERT to firmware if FW"
> " supports that command.\n `hard` - this will send"
> " to firmware command with illegal parameters"
> - " causing firmware crash.\n";
> + " causing firmware crash.\n"
> + "`assert` - this will send special illegal parameter"
> + " to firmware to cause assert failure"
> + " and crash.\n";
>
> return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
> }
> @@ -623,6 +646,9 @@ static ssize_t ath10k_write_simulate_fw_crash(struct file *file,
> */
> ret = ath10k_wmi_vdev_set_param(ar, 0x7fff,
> ar->wmi.vdev_param->rts_threshold, 0);
> + } else if (!strcmp(buf, "assert")) {
> + ath10k_info(ar, "simulating firmware assert crash\n");
> + ret = ath10k_debug_fw_assert(ar);
> } else {
> ret = -EINVAL;
> goto exit;
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] ath10k: support firmware crash-by-assert
@ 2014-09-10 16:34 ` Ben Greear
0 siblings, 0 replies; 8+ messages in thread
From: Ben Greear @ 2014-09-10 16:34 UTC (permalink / raw)
To: Kalle Valo, ath10k; +Cc: linux-wireless
On 09/10/2014 08:59 AM, Kalle Valo wrote:
> From: Ben Greear <greearb@candelatech.com>
>
> 10.1 firmware does not have an official way to
> cause assert on purpose, but it can be done with
> carefully crafted WMI command. This is a different
> kind of crash from the 'hard' crash, which is
> a bad memory dereference.
>
> Different crashes decode in different manners, so
> this will help the crash-report testing as well as
> offer better ways to test firmware failure and
> recovery.
>
> kvalo: move the wmi command creation to debug.c, modify
> the info print
This looks fine to me. I have not tested this version.
Thanks,
Ben
>
> Signed-off-by: Ben Greear <greearb@candelatech.com>
> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
> ---
> drivers/net/wireless/ath/ath10k/debug.c | 28 +++++++++++++++++++++++++++-
> 1 file changed, 27 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
> index f948a4d8ee59..c5d01058c2a3 100644
> --- a/drivers/net/wireless/ath/ath10k/debug.c
> +++ b/drivers/net/wireless/ath/ath10k/debug.c
> @@ -565,6 +565,26 @@ static const struct file_operations fops_fw_stats = {
> .llseek = default_llseek,
> };
>
> +/* This is a clean assert crash in firmware. */
> +static int ath10k_debug_fw_assert(struct ath10k *ar)
> +{
> + struct wmi_vdev_install_key_cmd *cmd;
> + struct sk_buff *skb;
> +
> + skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd) + 16);
> + if (!skb)
> + return -ENOMEM;
> +
> + cmd = (struct wmi_vdev_install_key_cmd *)skb->data;
> + memset(cmd, 0, sizeof(*cmd));
> +
> + /* big enough number so that firmware asserts */
> + cmd->vdev_id = __cpu_to_le32(0x7ffe);
> +
> + return ath10k_wmi_cmd_send(ar, skb,
> + ar->wmi.cmd->vdev_install_key_cmdid);
> +}
> +
> static ssize_t ath10k_read_simulate_fw_crash(struct file *file,
> char __user *user_buf,
> size_t count, loff_t *ppos)
> @@ -574,7 +594,10 @@ static ssize_t ath10k_read_simulate_fw_crash(struct file *file,
> " WMI_FORCE_FW_HANG_ASSERT to firmware if FW"
> " supports that command.\n `hard` - this will send"
> " to firmware command with illegal parameters"
> - " causing firmware crash.\n";
> + " causing firmware crash.\n"
> + "`assert` - this will send special illegal parameter"
> + " to firmware to cause assert failure"
> + " and crash.\n";
>
> return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
> }
> @@ -623,6 +646,9 @@ static ssize_t ath10k_write_simulate_fw_crash(struct file *file,
> */
> ret = ath10k_wmi_vdev_set_param(ar, 0x7fff,
> ar->wmi.vdev_param->rts_threshold, 0);
> + } else if (!strcmp(buf, "assert")) {
> + ath10k_info(ar, "simulating firmware assert crash\n");
> + ret = ath10k_debug_fw_assert(ar);
> } else {
> ret = -EINVAL;
> goto exit;
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] ath10k: support firmware crash-by-assert
2014-09-10 16:34 ` Ben Greear
@ 2014-09-11 20:40 ` Kalle Valo
-1 siblings, 0 replies; 8+ messages in thread
From: Kalle Valo @ 2014-09-11 20:40 UTC (permalink / raw)
To: Ben Greear; +Cc: ath10k, linux-wireless
Ben Greear <greearb@candelatech.com> writes:
> On 09/10/2014 08:59 AM, Kalle Valo wrote:
>> From: Ben Greear <greearb@candelatech.com>
>>
>> 10.1 firmware does not have an official way to
>> cause assert on purpose, but it can be done with
>> carefully crafted WMI command. This is a different
>> kind of crash from the 'hard' crash, which is
>> a bad memory dereference.
>>
>> Different crashes decode in different manners, so
>> this will help the crash-report testing as well as
>> offer better ways to test firmware failure and
>> recovery.
>>
>> kvalo: move the wmi command creation to debug.c, modify
>> the info print
>
> This looks fine to me. I have not tested this version.
I did test it and seems to work as it should.
--
Kalle Valo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] ath10k: support firmware crash-by-assert
@ 2014-09-11 20:40 ` Kalle Valo
0 siblings, 0 replies; 8+ messages in thread
From: Kalle Valo @ 2014-09-11 20:40 UTC (permalink / raw)
To: Ben Greear; +Cc: linux-wireless, ath10k
Ben Greear <greearb@candelatech.com> writes:
> On 09/10/2014 08:59 AM, Kalle Valo wrote:
>> From: Ben Greear <greearb@candelatech.com>
>>
>> 10.1 firmware does not have an official way to
>> cause assert on purpose, but it can be done with
>> carefully crafted WMI command. This is a different
>> kind of crash from the 'hard' crash, which is
>> a bad memory dereference.
>>
>> Different crashes decode in different manners, so
>> this will help the crash-report testing as well as
>> offer better ways to test firmware failure and
>> recovery.
>>
>> kvalo: move the wmi command creation to debug.c, modify
>> the info print
>
> This looks fine to me. I have not tested this version.
I did test it and seems to work as it should.
--
Kalle Valo
_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] ath10k: support firmware crash-by-assert
2014-09-10 15:59 ` Kalle Valo
@ 2014-09-11 20:44 ` Kalle Valo
-1 siblings, 0 replies; 8+ messages in thread
From: Kalle Valo @ 2014-09-11 20:44 UTC (permalink / raw)
To: Ben Greear; +Cc: ath10k, linux-wireless
Kalle Valo <kvalo@qca.qualcomm.com> writes:
> From: Ben Greear <greearb@candelatech.com>
>
> 10.1 firmware does not have an official way to
> cause assert on purpose, but it can be done with
> carefully crafted WMI command. This is a different
> kind of crash from the 'hard' crash, which is
> a bad memory dereference.
>
> Different crashes decode in different manners, so
> this will help the crash-report testing as well as
> offer better ways to test firmware failure and
> recovery.
>
> kvalo: move the wmi command creation to debug.c, modify
> the info print
>
> Signed-off-by: Ben Greear <greearb@candelatech.com>
> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Thanks Ben, applied.
--
Kalle Valo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] ath10k: support firmware crash-by-assert
@ 2014-09-11 20:44 ` Kalle Valo
0 siblings, 0 replies; 8+ messages in thread
From: Kalle Valo @ 2014-09-11 20:44 UTC (permalink / raw)
To: Ben Greear; +Cc: linux-wireless, ath10k
Kalle Valo <kvalo@qca.qualcomm.com> writes:
> From: Ben Greear <greearb@candelatech.com>
>
> 10.1 firmware does not have an official way to
> cause assert on purpose, but it can be done with
> carefully crafted WMI command. This is a different
> kind of crash from the 'hard' crash, which is
> a bad memory dereference.
>
> Different crashes decode in different manners, so
> this will help the crash-report testing as well as
> offer better ways to test firmware failure and
> recovery.
>
> kvalo: move the wmi command creation to debug.c, modify
> the info print
>
> Signed-off-by: Ben Greear <greearb@candelatech.com>
> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Thanks Ben, applied.
--
Kalle Valo
_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-09-11 20:44 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-10 15:59 [PATCH v2] ath10k: support firmware crash-by-assert Kalle Valo
2014-09-10 15:59 ` Kalle Valo
2014-09-10 16:34 ` Ben Greear
2014-09-10 16:34 ` Ben Greear
2014-09-11 20:40 ` Kalle Valo
2014-09-11 20:40 ` Kalle Valo
2014-09-11 20:44 ` Kalle Valo
2014-09-11 20:44 ` 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.