From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Gregory Erwin <gregerwin256@gmail.com>
Cc: Miaoqing Pan <miaoqing@codeaurora.org>,
Rui Salvaterra <rsalvaterra@gmail.com>,
ath9k-devel <ath9k-devel@qca.qualcomm.com>,
linux-crypto@vger.kernel.org, linux-wireless@vger.kernel.org
Subject: Re: ath9k: hwrng blocks for several minutes when phy is un-associated
Date: Thu, 23 Jun 2022 14:14:36 +0200 [thread overview]
Message-ID: <YrRZLPQHK0QbLTjr@zx2c4.com> (raw)
In-Reply-To: <CAO+Okf6ZJC5-nTE_EJUGQtd8JiCkiEHytGgDsFGTEjs0c00giw@mail.gmail.com>
Hi Gregory,
On Wed, Jun 22, 2022 at 10:08:15PM -0700, Gregory Erwin wrote:
> Hello,
>
> I bisected down to commit [fcd09c90c3c5] "ath9k: use hw_random API instead of
> directly dumping into random.c'' while investigating a long delay when entering
> suspend on kernels v5.18 onward. There are other reports of hangs or
> unresponsiveness at https://bugs.archlinux.org/task/75138 with some more info.
>
> AFAIKT, the issue is triggered by the ath9k hwrng when the interface is up,
> but not associated with any AP. In this state, 'dd if=/dev/hwrng' will block
> for up to 231 seconds before finally returning an input/output error. Similarly,
> I get a kernel log message "hwrng: no data available" every 231 seconds.
>
> The hwrng will unblock when attempting to connect to an SSID that doesn't exist,
> but not when performing a scan, so I'm guessing AR_PHY_TST_ADC only produces new
> data when the phy is transmitting.
>
> Admittedly, I don't actually know if this blocking behavior is
> expected or not, but it certainly seems undesirable.
Thanks for the report. I wish somebody from one of those bug reports
would have emailed earlier.
I don't have hardware to test this, but could you let me know if the
below patch does something? I'm sort of guessing, but maybe this is
right?
Jason
diff --git a/drivers/net/wireless/ath/ath9k/rng.c b/drivers/net/wireless/ath/ath9k/rng.c
index cb5414265a9b..a6291f5f0d47 100644
--- a/drivers/net/wireless/ath/ath9k/rng.c
+++ b/drivers/net/wireless/ath/ath9k/rng.c
@@ -80,7 +80,7 @@ static int ath9k_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait)
bytes_read += max & 3UL;
memzero_explicit(&word, sizeof(word));
}
- if (!wait || !max || likely(bytes_read) || fail_stats > 110)
+ if (!wait || !max || likely(bytes_read) || fail_stats > 110 || kthread_should_stop())
break;
msleep_interruptible(ath9k_rng_delay_get(++fail_stats));
next prev parent reply other threads:[~2022-06-23 12:14 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-23 5:08 ath9k: hwrng blocks for several minutes when phy is un-associated Gregory Erwin
2022-06-23 12:14 ` Jason A. Donenfeld [this message]
2022-06-23 12:16 ` Jason A. Donenfeld
2022-06-23 23:36 ` Gregory Erwin
2022-06-23 23:47 ` Jason A. Donenfeld
2022-06-24 0:01 ` Jason A. Donenfeld
2022-06-24 0:50 ` Jason A. Donenfeld
2022-06-24 1:14 ` [PATCH] ath9k: rng: escape sleep loop when unregistering Jason A. Donenfeld
2022-06-24 5:25 ` Gregory Erwin
2022-06-24 19:12 ` Jason A. Donenfeld
2022-06-24 20:44 ` [PATCH v2] ath9k: sleep for less time when unregistering hwrng Jason A. Donenfeld
2022-06-25 0:13 ` Gregory Erwin
2022-06-25 0:40 ` Jason A. Donenfeld
2022-06-27 6:45 ` Herbert Xu
2022-06-27 9:29 ` [PATCH v3] " Jason A. Donenfeld
2022-06-27 10:49 ` [PATCH v4] " Jason A. Donenfeld
2022-06-27 11:37 ` [PATCH v5] " Jason A. Donenfeld
2022-06-27 12:07 ` [PATCH v6] " Jason A. Donenfeld
2022-06-27 12:18 ` Toke Høiland-Jørgensen
2022-06-28 1:39 ` Gregory Erwin
2022-06-28 10:46 ` Jason A. Donenfeld
2022-06-28 10:48 ` Jason A. Donenfeld
2022-06-28 10:51 ` Herbert Xu
2022-06-28 10:55 ` Jason A. Donenfeld
2022-06-28 12:05 ` Jason A. Donenfeld
2022-06-28 15:14 ` Jason A. Donenfeld
2022-06-28 1:53 ` Herbert Xu
2022-06-28 10:45 ` Toke Høiland-Jørgensen
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=YrRZLPQHK0QbLTjr@zx2c4.com \
--to=jason@zx2c4.com \
--cc=ath9k-devel@qca.qualcomm.com \
--cc=gregerwin256@gmail.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=miaoqing@codeaurora.org \
--cc=rsalvaterra@gmail.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).