linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ath10k: skip the wait for completion to recovery in shutdown path
@ 2020-11-26 17:15 Youghandhar Chintala
  2020-12-01 19:35 ` Brian Norris
  2020-12-08  8:25 ` Sai Prakash Ranjan
  0 siblings, 2 replies; 4+ messages in thread
From: Youghandhar Chintala @ 2020-11-26 17:15 UTC (permalink / raw)
  To: ath10k
  Cc: linux-wireless, linux-kernel, pillair, dianders, kuabhs,
	briannorris, Youghandhar Chintala

Currently in the shutdown callback we wait for recovery to complete
before freeing up the resources. This can lead to unwanted delay
during the shutdown and thereby increase the shutdown time.

As an attempt to take less time during shutdown, remove the wait for
recovery completion in the shutdown callback.

Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1

Signed-off-by: Youghandhar Chintala <youghand@codeaurora.org>
---
Changes from v1:
-Removed stray change-id text
---
 drivers/net/wireless/ath/ath10k/snoc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c
index 84666f72bdfa..15580a91fe98 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -1790,9 +1790,6 @@ static int ath10k_snoc_remove(struct platform_device *pdev)
 
 	reinit_completion(&ar->driver_recovery);
 
-	if (test_bit(ATH10K_SNOC_FLAG_RECOVERY, &ar_snoc->flags))
-		wait_for_completion_timeout(&ar->driver_recovery, 3 * HZ);
-
 	set_bit(ATH10K_SNOC_FLAG_UNREGISTERING, &ar_snoc->flags);
 
 	ath10k_core_unregister(ar);
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] ath10k: skip the wait for completion to recovery in shutdown path
  2020-11-26 17:15 [PATCH v2] ath10k: skip the wait for completion to recovery in shutdown path Youghandhar Chintala
@ 2020-12-01 19:35 ` Brian Norris
  2020-12-07 16:12   ` Kalle Valo
  2020-12-08  8:25 ` Sai Prakash Ranjan
  1 sibling, 1 reply; 4+ messages in thread
From: Brian Norris @ 2020-12-01 19:35 UTC (permalink / raw)
  To: Youghandhar Chintala
  Cc: ath10k, linux-wireless, Linux Kernel, Rakesh Pillai,
	Doug Anderson, kuabhs

On Thu, Nov 26, 2020 at 9:16 AM Youghandhar Chintala
<youghand@codeaurora.org> wrote:
> --- a/drivers/net/wireless/ath/ath10k/snoc.c
> +++ b/drivers/net/wireless/ath/ath10k/snoc.c
> @@ -1790,9 +1790,6 @@ static int ath10k_snoc_remove(struct platform_device *pdev)
>
>         reinit_completion(&ar->driver_recovery);
>
> -       if (test_bit(ATH10K_SNOC_FLAG_RECOVERY, &ar_snoc->flags))
> -               wait_for_completion_timeout(&ar->driver_recovery, 3 * HZ);

Hmm, this is the only instance of waiting for this completion, which
means that after this patch, 'ar->driver_recovery' is doing exactly
nothing. Should you instead just remove it completely?

Also, if your patch is correct, it seems like the completion was never
needed in the first place. You should probably address such a claim in
the commit message; is there truly no need to wait here? Or was there
some purpose here, but that purpose was accomplished some other way?
Or was there a purpose, and that purpose was misguided? It feels to me
like it is indeed correct to remove this (shutdown should be performed
promptly; we don't need to delay it just to try to "finish
recovering"), but it's your job to convince the reader.

Brian

> -
>         set_bit(ATH10K_SNOC_FLAG_UNREGISTERING, &ar_snoc->flags);
>
>         ath10k_core_unregister(ar);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] ath10k: skip the wait for completion to recovery in shutdown path
  2020-12-01 19:35 ` Brian Norris
@ 2020-12-07 16:12   ` Kalle Valo
  0 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2020-12-07 16:12 UTC (permalink / raw)
  To: Brian Norris
  Cc: Youghandhar Chintala, kuabhs, linux-wireless, Linux Kernel,
	ath10k, Doug Anderson, Rakesh Pillai

Brian Norris <briannorris@chromium.org> writes:

> On Thu, Nov 26, 2020 at 9:16 AM Youghandhar Chintala
> <youghand@codeaurora.org> wrote:
>> --- a/drivers/net/wireless/ath/ath10k/snoc.c
>> +++ b/drivers/net/wireless/ath/ath10k/snoc.c
>> @@ -1790,9 +1790,6 @@ static int ath10k_snoc_remove(struct platform_device *pdev)
>>
>>         reinit_completion(&ar->driver_recovery);
>>
>> -       if (test_bit(ATH10K_SNOC_FLAG_RECOVERY, &ar_snoc->flags))
>> -               wait_for_completion_timeout(&ar->driver_recovery, 3 * HZ);
>
> Hmm, this is the only instance of waiting for this completion, which
> means that after this patch, 'ar->driver_recovery' is doing exactly
> nothing. Should you instead just remove it completely?
>
> Also, if your patch is correct, it seems like the completion was never
> needed in the first place. You should probably address such a claim in
> the commit message; is there truly no need to wait here? Or was there
> some purpose here, but that purpose was accomplished some other way?
> Or was there a purpose, and that purpose was misguided? It feels to me
> like it is indeed correct to remove this (shutdown should be performed
> promptly; we don't need to delay it just to try to "finish
> recovering"), but it's your job to convince the reader.

Exactly what I was thinking as well. To me this patch was just looks
racy and all the commit log says that it's "unwanted delay".

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] ath10k: skip the wait for completion to recovery in shutdown path
  2020-11-26 17:15 [PATCH v2] ath10k: skip the wait for completion to recovery in shutdown path Youghandhar Chintala
  2020-12-01 19:35 ` Brian Norris
@ 2020-12-08  8:25 ` Sai Prakash Ranjan
  1 sibling, 0 replies; 4+ messages in thread
From: Sai Prakash Ranjan @ 2020-12-08  8:25 UTC (permalink / raw)
  To: youghand
  Cc: ath10k, briannorris, dianders, kuabhs, linux-kernel,
	linux-wireless, pillair, Sai Prakash Ranjan

On Thu, Nov 26, 2020 at 9:16 AM Youghandhar Chintala
<youghand@codeaurora.org> wrote:
> --- a/drivers/net/wireless/ath/ath10k/snoc.c
> +++ b/drivers/net/wireless/ath/ath10k/snoc.c
> @@ -1790,9 +1790,6 @@ static int ath10k_snoc_remove(struct platform_device *pdev)
>
>         reinit_completion(&ar->driver_recovery);
>
> -       if (test_bit(ATH10K_SNOC_FLAG_RECOVERY, &ar_snoc->flags))
> -               wait_for_completion_timeout(&ar->driver_recovery, 3 * HZ);

You are skipping recovery in ath10k_snoc_remove() which is a remove callback
and also called in shutdown callback. So that means it is also called when
you unload the ath10k module and not just when the system reboots/shutdown.
While it makes sense to not skip recovery in shutdown/reboot sequence because
the system is going down, it might very well be needed in case of unloading
the module because we expect the system to be up and stable after unloading
the ath10k module and we should be able to reload the ath10k module smoothly.

If you remove that now and try to reload the ath10k module, won't that leave
the system in possibly an inconsistent state because we skipped recovery in
module remove and then we are trying to load the ath10k module when the
recovery is not yet complete? In other words, you need to test ath10k module
load/unload as well in addition to reboot tests to make sure this works as
expected or else you will need a separate shutdown callback which skips the
recovery part.

Thanks,
Sai
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-08  8:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26 17:15 [PATCH v2] ath10k: skip the wait for completion to recovery in shutdown path Youghandhar Chintala
2020-12-01 19:35 ` Brian Norris
2020-12-07 16:12   ` Kalle Valo
2020-12-08  8:25 ` Sai Prakash Ranjan

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).