From patchwork Fri Apr 12 08:52:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Gong X-Patchwork-Id: 10897591 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EFEC81669 for ; Fri, 12 Apr 2019 08:55:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C45D928B4F for ; Fri, 12 Apr 2019 08:55:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B823428E49; Fri, 12 Apr 2019 08:55:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5866028B4F for ; Fri, 12 Apr 2019 08:55:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=l+8Y3hm+BlZ4GZpE9ldHoVfnkJk+vQU/J0AoolcruCg=; b=t+D W1WHkIagZj4YRTI8J4ARuSg/pjOXwx7S4ntiFzTg97BasKvfLxUi1N97VDybuu/r2FYQitOKLK4Fp yzragVq7ESXJLsYubxpA20laQubHcJflVWwjDEhOsc9Q430KIUMBJZaQ4ufgwPn2aisIVxMPUsMXa GFI2dX+m55T35KZ0fd/tIAUFQZT6iZadTvfCVwVUickp7Q4049xkJwG6OFl5D7yNiYWRv7bZQr0FU 9qHNB8yg3ZAdofkpJYfxf1xOj8mJWmYTVOdl9xrGpc/B1NYuYR1Ogy+SAXwegN3HPTA13wXkh/tdg 0MtOi4Nwy5J50InqAdfQlQ83MZBV8ig==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hErxc-00019E-DM; Fri, 12 Apr 2019 08:55:00 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hErxZ-00018q-NW for ath10k@lists.infradead.org; Fri, 12 Apr 2019 08:54:59 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 17CE5606CF; Fri, 12 Apr 2019 08:54:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1555059296; bh=6Ro2xEFCSDj2sVwTyNpdpRBRWnSLXD6xkI5YgymDcz4=; h=From:To:Cc:Subject:Date:From; b=Wz6NJJqgl9o8wHyAfQWUTc3dNBq3+5RD02/Y9dsnknhB9kepdDaI56YqU2rbfMmFS C20R6BKI03NRm08G5BduNSM0tPAK0U8degBZUo+sgGMsJufxu4ftee9v+5s8hxDprB LtjuIJUbQw5y74iZPGvFZ6YeC+Fh0B+iSBJCdSJs= Received: from localhost.localdomain (unknown [180.166.53.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: wgong@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id AA5166122D; Fri, 12 Apr 2019 08:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1555059293; bh=6Ro2xEFCSDj2sVwTyNpdpRBRWnSLXD6xkI5YgymDcz4=; h=From:To:Cc:Subject:Date:From; b=aimf4MNAb19vOUQi0j0vYYlj9cPtQdkD78XamLG5lMjbUWnj5D2N/NwEaZX7NoZE2 UnUEVGubVGlBTT4ezZKl9/9bHsiGiYWRbQI+jrQsTEWuHFITCOC6oBUCF0jfhL3kjG xAqMalB75HI4/Typyjcyz36EDkG/nC01dVYnekx4= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org AA5166122D Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=wgong@codeaurora.org From: Wen Gong To: ath10k@lists.infradead.org Subject: [PATCH v2] ath10k: Remove ATH10K_STATE_RESTARTED in simulate fw crash Date: Fri, 12 Apr 2019 16:52:50 +0800 Message-Id: <1555059170-11988-1-git-send-email-wgong@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190412_015457_800874_B5D3ADB9 X-CRM114-Status: GOOD ( 12.17 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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. add flag wait-ready for this command: echo soft wait-ready > /sys/kernel/debug/ieee80211/phyxx/ath10k/simulate_fw_crash 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. Signed-off-by: Wen Gong --- v2: add wait-ready flag drivers/net/wireless/ath/ath10k/debug.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index 15964b3..04a20b8 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -534,7 +534,8 @@ static ssize_t ath10k_read_simulate_fw_crash(struct file *file, "`soft` - this will send 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" "`assert` - this will send special illegal parameter to firmware to cause assert failure and crash.\n" - "`hw-restart` - this will simply queue hw restart without fw/hw actually crashing.\n"; + "`hw-restart` - this will simply queue hw restart without fw/hw actually crashing.\n" + "`soft wait-ready` `hard wait-ready` `assert wait-ready` `hw-restart wait-ready` - cmd only execuate when state is ATH10K_STATE_ON.\n"; return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf)); } @@ -554,6 +555,9 @@ static ssize_t ath10k_write_simulate_fw_crash(struct file *file, char buf[32] = {0}; ssize_t rc; int ret; + char buf_cmd[32] = {0}; + char buf_flag[32] = {0}; + bool wait_ready; /* filter partial writes and invalid commands */ if (*ppos != 0 || count >= sizeof(buf) || count == 0) @@ -567,18 +571,25 @@ static ssize_t ath10k_write_simulate_fw_crash(struct file *file, if (buf[*ppos - 1] == '\n') buf[*ppos - 1] = '\0'; + sscanf(buf, "%s %s", buf_cmd, buf_flag); + ath10k_info(ar, "buf_cmd:%s, buf_flag:%s\n", buf_cmd, buf_flag); + + wait_ready = !strcmp(buf_cmd, "wait-ready"); mutex_lock(&ar->conf_mutex); - if (ar->state != ATH10K_STATE_ON && - ar->state != ATH10K_STATE_RESTARTED) { + if ((!wait_ready && + ar->state != ATH10K_STATE_ON && + ar->state != ATH10K_STATE_RESTARTED) || + (wait_ready && + ar->state != ATH10K_STATE_ON)) { ret = -ENETDOWN; goto exit; } - if (!strcmp(buf, "soft")) { + if (!strcmp(buf_cmd, "soft")) { ath10k_info(ar, "simulating soft firmware crash\n"); ret = ath10k_wmi_force_fw_hang(ar, WMI_FORCE_FW_HANG_ASSERT, 0); - } else if (!strcmp(buf, "hard")) { + } else if (!strcmp(buf_cmd, "hard")) { ath10k_info(ar, "simulating hard firmware crash\n"); /* 0x7fff is vdev id, and it is always out of range for all * firmware variants in order to force a firmware crash. @@ -586,10 +597,10 @@ 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")) { + } else if (!strcmp(buf_cmd, "assert")) { ath10k_info(ar, "simulating firmware assert crash\n"); ret = ath10k_debug_fw_assert(ar); - } else if (!strcmp(buf, "hw-restart")) { + } else if (!strcmp(buf_cmd, "hw-restart")) { ath10k_info(ar, "user requested hw restart\n"); queue_work(ar->workqueue, &ar->restart_work); ret = 0;