From: Kalle Valo <kvalo@codeaurora.org>
To: Wen Gong <wgong@codeaurora.org>
Cc: ath10k@lists.infradead.org, linux-wireless@vger.kernel.org
Subject: Re: [PATCH v4 1/2] ath10k: add refcount for ath10k_core_restart
Date: Fri, 14 Aug 2020 20:19:19 +0300 [thread overview]
Message-ID: <87imdlkuw8.fsf@codeaurora.org> (raw)
In-Reply-To: <20200108031957.22308-2-wgong@codeaurora.org> (Wen Gong's message of "Wed, 8 Jan 2020 11:19:56 +0800")
Wen Gong <wgong@codeaurora.org> writes:
> When it has more than one restart_work queued meanwhile, the 2nd
> restart_work is very esay to break the 1st restart work and lead
> recovery fail.
>
> Add a ref count to allow only one restart work running untill
> device successfully recovered.
>
> Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00029.
>
> Signed-off-by: Wen Gong <wgong@codeaurora.org>
> ---
> drivers/net/wireless/ath/ath10k/core.c | 13 +++++++++++++
> drivers/net/wireless/ath/ath10k/core.h | 2 ++
> drivers/net/wireless/ath/ath10k/mac.c | 1 +
> 3 files changed, 16 insertions(+)
>
> diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
> index 91f131b87efc..0e31846e6c89 100644
> --- a/drivers/net/wireless/ath/ath10k/core.c
> +++ b/drivers/net/wireless/ath/ath10k/core.c
> @@ -2199,6 +2199,14 @@ static void ath10k_core_restart(struct work_struct *work)
> {
> struct ath10k *ar = container_of(work, struct ath10k, restart_work);
> int ret;
> + int restart_count;
> +
> + restart_count = atomic_add_return(1, &ar->restart_count);
> + if (restart_count > 1) {
> + ath10k_warn(ar, "can not restart, count: %d\n", restart_count);
> + atomic_dec(&ar->restart_count);
> + return;
> + }
I have been thinking a different approach for this. I think another
option is to have a function like this:
ath10k_core_firmware_crashed()
{
queue_work(ar->workqueue, &ar->restart_work);
}
In patch 1 we would convert all existing callers to call that
function instead of queue_work() directly.
In patch 2 we would add a new flag to enum ath10k_dev_flags, or maybe
should actually use existing ATH10K_FLAG_CRASH_FLUSH? Don't know yet
which one is better. Now the function would do:
ath10k_core_firmware_crashed()
{
if (test_bit(flag))
return
set_bit(flag)
queue_work(ar->workqueue, &ar->restart_work);
}
That way restart_work queue would be called only one time.
Though I'm not sure how ATH10K_STATE_WEDGED would behave after this
change, it might get broken. Ah, actually I think even this patch breaks
the WEDGED state. This firmware restart is tricky, difficult to say what
is the best approach. Michal, are you reading? :) Any ideas?
And after looking more about this patch I don't see the need for the new
ar->restart_count atomic variable. Checking for ATH10K_FLAG_CRASH_FLUSH
would do the same thing AFAICS.
And related to this, (in a separate patch) I think we should utilise
ATH10K_FLAG_CRASH_FLUSH more. For example in ath10k_wmi_cmd_send() to
not even try to send a WMI command if the flag is set. Basically all
hardware access should be disabled except what is needed to restart the
firmware.
--
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
next prev parent reply other threads:[~2020-08-14 17:19 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-08 3:19 [PATCH v4 0/2] start recovery process when payload length overflow for sdio Wen Gong
2020-01-08 3:19 ` [PATCH v4 1/2] ath10k: add refcount for ath10k_core_restart Wen Gong
2020-01-08 12:02 ` Justin Capella
2020-01-10 10:29 ` Wen Gong
2020-01-17 7:19 ` Wen Gong
2020-01-20 9:38 ` Justin Capella
2020-01-20 13:34 ` Wen Gong
2020-01-20 15:37 ` Justin Capella
2020-08-14 17:19 ` Kalle Valo [this message]
2020-08-18 8:39 ` Wen Gong
2020-09-07 15:52 ` Kalle Valo
2020-08-19 12:01 ` Wen Gong
2020-08-20 9:18 ` Wen Gong
2020-08-24 4:36 ` Wen Gong
2020-09-07 15:55 ` Kalle Valo
[not found] ` <871rjd37kz.fsf@codeaurora.org>
2020-09-08 3:47 ` Wen Gong
2020-01-08 3:19 ` [PATCH v4 2/2] ath10k: start recovery process when payload length exceeds max htc length for sdio Wen Gong
2020-08-14 15:37 ` Kalle Valo
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=87imdlkuw8.fsf@codeaurora.org \
--to=kvalo@codeaurora.org \
--cc=ath10k@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=wgong@codeaurora.org \
/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).