From: Maya Erez <merez@codeaurora.org>
To: Kalle Valo <kvalo@codeaurora.org>
Cc: Ahmad Masri <amasri@codeaurora.org>,
linux-wireless@vger.kernel.org, wil6210@qti.qualcomm.com,
Maya Erez <merez@codeaurora.org>
Subject: [PATCH 11/11] wil6210: drop old event after wmi_call timeout
Date: Sun, 16 Jun 2019 10:26:07 +0300 [thread overview]
Message-ID: <1560669967-23706-12-git-send-email-merez@codeaurora.org> (raw)
In-Reply-To: <1560669967-23706-1-git-send-email-merez@codeaurora.org>
From: Ahmad Masri <amasri@codeaurora.org>
This change fixes a rare race condition of handling WMI events after
wmi_call expires.
wmi_recv_cmd immediately handles an event when reply_buf is defined and
a wmi_call is waiting for the event.
However, in case the wmi_call has already timed-out, there will be no
waiting/running wmi_call and the event will be queued in WMI queue and
will be handled later in wmi_event_handle.
Meanwhile, a new similar wmi_call for the same command and event may
be issued. In this case, when handling the queued event we got WARN_ON
printed.
Fixing this case as a valid timeout and drop the unexpected event.
Signed-off-by: Ahmad Masri <amasri@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
---
drivers/net/wireless/ath/wil6210/wmi.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c
index 542ef15..475b1a2 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.c
+++ b/drivers/net/wireless/ath/wil6210/wmi.c
@@ -3303,7 +3303,18 @@ static void wmi_event_handle(struct wil6210_priv *wil,
/* check if someone waits for this event */
if (wil->reply_id && wil->reply_id == id &&
wil->reply_mid == mid) {
- WARN_ON(wil->reply_buf);
+ if (wil->reply_buf) {
+ /* event received while wmi_call is waiting
+ * with a buffer. Such event should be handled
+ * in wmi_recv_cmd function. Handling the event
+ * here means a previous wmi_call was timeout.
+ * Drop the event and do not handle it.
+ */
+ wil_err(wil,
+ "Old event (%d, %s) while wmi_call is waiting. Drop it and Continue waiting\n",
+ id, eventid2name(id));
+ return;
+ }
wmi_evt_call_handler(vif, id, evt_data,
len - sizeof(*wmi));
--
1.9.1
prev parent reply other threads:[~2019-06-16 7:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-16 7:25 [PATCH 00/11] wil6210 patches Maya Erez
2019-06-16 7:25 ` [PATCH 01/11] wil6210: do not reset FW in STA to P2P client interface switch Maya Erez
2019-06-27 17:51 ` Kalle Valo
2019-06-16 7:25 ` [PATCH 02/11] wil6210: enlarge Tx status ring size Maya Erez
2019-06-16 7:25 ` [PATCH 03/11] wil6210: increase the frequency of status ring hw tail update Maya Erez
2019-06-16 7:26 ` [PATCH 04/11] wil6210: Add support for setting RBUFCAP configuration Maya Erez
2019-06-16 7:26 ` [PATCH 05/11] wil6210: fix printout in wil_read_pmccfg Maya Erez
2019-06-16 7:26 ` [PATCH 06/11] wil6210: clear FW and ucode log address Maya Erez
2019-06-16 7:26 ` [PATCH 07/11] wil6210: update cid boundary check of wil_find_cid/_by_idx() Maya Erez
2019-06-16 7:26 ` [PATCH 08/11] wil6210: publish max_msdu_size to FW on BCAST ring Maya Erez
2019-06-16 7:26 ` [PATCH 09/11] wil6210: add support for reading multiple RFs temperature via debugfs Maya Erez
2019-06-16 7:26 ` [PATCH 10/11] wil6210: set WIL_WMI_CALL_GENERAL_TO_MS as wmi_call timeout Maya Erez
2019-06-16 7:26 ` Maya Erez [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1560669967-23706-12-git-send-email-merez@codeaurora.org \
--to=merez@codeaurora.org \
--cc=amasri@codeaurora.org \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=wil6210@qti.qualcomm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).