linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Stephen Boyd <swboyd@chromium.org>
Cc: linux-kernel@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>,
	linux-crypto@vger.kernel.org, Matt Mackall <mpm@selenic.com>,
	Keerthy <j-keerthy@ti.com>
Subject: Re: [PATCH] random: Support freezable kthreads in add_hwgenerator_randomness()
Date: Thu, 22 Aug 2019 15:55:19 +1000	[thread overview]
Message-ID: <20190822055519.GB3860@gondor.apana.org.au> (raw)
In-Reply-To: <20190819150245.176587-1-swboyd@chromium.org>

On Mon, Aug 19, 2019 at 08:02:45AM -0700, Stephen Boyd wrote:
> The kthread calling this function is freezable after commit 03a3bb7ae631
> ("hwrng: core - Freeze khwrng thread during suspend") is applied.
> Unfortunately, this function uses wait_event_interruptible() but doesn't
> check for the kthread being woken up by the fake freezer signal. When a
> user suspends the system, this kthread will wake up and if it fails the
> entropy size check it will immediately go back to sleep and not go into
> the freezer. Eventually, suspend will fail because the task never froze
> and a warning message like this may appear:
> 
>  PM: suspend entry (deep)
>  Filesystems sync: 0.000 seconds
>  Freezing user space processes ... (elapsed 0.001 seconds) done.
>  OOM killer disabled.
>  Freezing remaining freezable tasks ...
>  Freezing of tasks failed after 20.003 seconds (1 tasks refusing to freeze, wq_busy=0):
>  hwrng           R  running task        0   289      2 0x00000020
>  [<c08c64c4>] (__schedule) from [<c08c6a10>] (schedule+0x3c/0xc0)
>  [<c08c6a10>] (schedule) from [<c05dbd8c>] (add_hwgenerator_randomness+0xb0/0x100)
>  [<c05dbd8c>] (add_hwgenerator_randomness) from [<bf1803c8>] (hwrng_fillfn+0xc0/0x14c [rng_core])
>  [<bf1803c8>] (hwrng_fillfn [rng_core]) from [<c015abec>] (kthread+0x134/0x148)
>  [<c015abec>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
> 
> Check for a freezer signal here and skip adding any randomness if the
> task wakes up because it was frozen. This should make the kthread freeze
> properly and suspend work again.
> 
> Fixes: 03a3bb7ae631 ("hwrng: core - Freeze khwrng thread during suspend")
> Reported-by: Keerthy <j-keerthy@ti.com>
> Tested-by: Keerthy <j-keerthy@ti.com>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---
> 
> Probably needs to go via Herbert who routed the patch this is fixing.
> 
>  drivers/char/random.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  reply	other threads:[~2019-08-22  5:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-19 15:02 [PATCH] random: Support freezable kthreads in add_hwgenerator_randomness() Stephen Boyd
2019-08-22  5:55 ` Herbert Xu [this message]
2019-09-04 11:00   ` Sebastian Andrzej Siewior
2019-09-04 18:49     ` Stephen Boyd
2019-09-05  7:41       ` Sebastian Andrzej Siewior
2019-09-05 16:31         ` Stephen Boyd

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=20190822055519.GB3860@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=j-keerthy@ti.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    --cc=swboyd@chromium.org \
    --cc=tytso@mit.edu \
    /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).