* Suspend/Resume Broken on AM43/AM33 Platforms
@ 2019-08-19 4:24 Keerthy
2019-08-19 6:27 ` Stephen Boyd
0 siblings, 1 reply; 4+ messages in thread
From: Keerthy @ 2019-08-19 4:24 UTC (permalink / raw)
To: swboyd, Tony Lindgren, herbert
Cc: Linux-OMAP, Linux Kernel Mailing List, Kristo, Tero, Dave Gerlach
Hi Stephen,
commit 03a3bb7ae63150230c5de645dc95e673ebf17e1a
Author: Stephen Boyd <swboyd@chromium.org>
Date: Mon Aug 5 16:32:41 2019 -0700
hwrng: core - Freeze khwrng thread during suspend
Commit seems to be breaking suspend/resume on TI AM43/AM33 platforms.
rtcwake: wakeup from "mem" using /dev/rtc0 at Sun Nov 18 02:12:12 2018
[ 54.033833] PM: suspend entry (deep)
[ 54.037741] Filesystems sync: 0.000 seconds
[ 54.062730] Freezing user space processes ... (elapsed 0.001 seconds)
done.
[ 54.071313] OOM killer disabled.
[ 54.074572] Freezing remaining freezable tasks ...
[ 74.083121] Freezing of tasks failed after 20.003 seconds (1 tasks
refusing to freeze, wq_busy=0):
[ 74.092257] hwrng R running task 0 289 2
0x00000020
[ 74.099511] [<c08c64c4>] (__schedule) from [<c08c6a10>]
(schedule+0x3c/0xc0)
[ 74.106720] [<c08c6a10>] (schedule) from [<c05dbd8c>]
(add_hwgenerator_randomness+0xb0/0x100)
[ 74.115358] [<c05dbd8c>] (add_hwgenerator_randomness) from
[<bf1803c8>] (hwrng_fillfn+0xc0/0x14c [rng_core])
[ 74.125356] [<bf1803c8>] (hwrng_fillfn [rng_core]) from [<c015abec>]
(kthread+0x134/0x148)
[ 74.133764] [<c015abec>] (kthread) from [<c01010e8>]
(ret_from_fork+0x14/0x2c)
[ 74.141093] Exception stack(0xec611fb0 to 0xec611ff8)
[ 74.146239] 1fa0: 00000000
00000000 00000000 00000000
[ 74.154478] 1fc0: 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000
[ 74.162764] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[ 74.169499] Restarting kernel threads ... done.
[ 74.175628] OOM killer enabled.
[ 74.178796] Restarting tasks ... done.
[ 74.226769] PM: suspend exit
rtcwake: write error
1
One task refusing to freeze is the final error i am seeing.
- Keerthy
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Suspend/Resume Broken on AM43/AM33 Platforms
2019-08-19 4:24 Suspend/Resume Broken on AM43/AM33 Platforms Keerthy
@ 2019-08-19 6:27 ` Stephen Boyd
2019-08-19 7:27 ` Keerthy
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Boyd @ 2019-08-19 6:27 UTC (permalink / raw)
To: Keerthy, Tony Lindgren, herbert
Cc: Linux-OMAP, Linux Kernel Mailing List, Kristo, Tero, Dave Gerlach
Quoting Keerthy (2019-08-18 21:24:58)
> Hi Stephen,
>
> commit 03a3bb7ae63150230c5de645dc95e673ebf17e1a
> Author: Stephen Boyd <swboyd@chromium.org>
> Date: Mon Aug 5 16:32:41 2019 -0700
>
> hwrng: core - Freeze khwrng thread during suspend
>
> Commit seems to be breaking suspend/resume on TI AM43/AM33 platforms.
>
>
> rtcwake: wakeup from "mem" using /dev/rtc0 at Sun Nov 18 02:12:12 2018
> [ 54.033833] PM: suspend entry (deep)
> [ 54.037741] Filesystems sync: 0.000 seconds
> [ 54.062730] Freezing user space processes ... (elapsed 0.001 seconds)
> done.
> [ 54.071313] OOM killer disabled.
> [ 54.074572] Freezing remaining freezable tasks ...
> [ 74.083121] Freezing of tasks failed after 20.003 seconds (1 tasks
> refusing to freeze, wq_busy=0):
> [ 74.092257] hwrng R running task 0 289 2
> 0x00000020
> [ 74.099511] [<c08c64c4>] (__schedule) from [<c08c6a10>]
> (schedule+0x3c/0xc0)
> [ 74.106720] [<c08c6a10>] (schedule) from [<c05dbd8c>]
> (add_hwgenerator_randomness+0xb0/0x100)
> [ 74.115358] [<c05dbd8c>] (add_hwgenerator_randomness) from
> [<bf1803c8>] (hwrng_fillfn+0xc0/0x14c [rng_core])
Thanks for the report. I suspect we need to check for freezer in
add_hwgenerator_randomness(). I find it odd that there's another caller
of add_hwgenerator_randomness(), but maybe the ath9k driver can be
converted to some sort of hwrng driver instead of calling into the
kthread directly.
Anyway, can you try this patch?
---8<---
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 5d5ea4ce1442..e2e85ca16410 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -2429,6 +2429,7 @@ void add_hwgenerator_randomness(const char *buffer, size_t count,
size_t entropy)
{
struct entropy_store *poolp = &input_pool;
+ bool frozen = false;
if (unlikely(crng_init == 0)) {
crng_fast_load(buffer, count);
@@ -2439,9 +2440,12 @@ void add_hwgenerator_randomness(const char *buffer, size_t count,
* We'll be woken up again once below random_write_wakeup_thresh,
* or when the calling thread is about to terminate.
*/
- wait_event_interruptible(random_write_wait, kthread_should_stop() ||
+ wait_event_interruptible(random_write_wait,
+ kthread_freezable_should_stop(&frozen) ||
ENTROPY_BITS(&input_pool) <= random_write_wakeup_bits);
- mix_pool_bytes(poolp, buffer, count);
- credit_entropy_bits(poolp, entropy);
+ if (!frozen) {
+ mix_pool_bytes(poolp, buffer, count);
+ credit_entropy_bits(poolp, entropy);
+ }
}
EXPORT_SYMBOL_GPL(add_hwgenerator_randomness);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: Suspend/Resume Broken on AM43/AM33 Platforms
2019-08-19 6:27 ` Stephen Boyd
@ 2019-08-19 7:27 ` Keerthy
2019-08-19 15:00 ` Stephen Boyd
0 siblings, 1 reply; 4+ messages in thread
From: Keerthy @ 2019-08-19 7:27 UTC (permalink / raw)
To: Stephen Boyd, Tony Lindgren, herbert
Cc: Linux-OMAP, Linux Kernel Mailing List, Kristo, Tero, Dave Gerlach
On 19/08/19 11:57 AM, Stephen Boyd wrote:
> Quoting Keerthy (2019-08-18 21:24:58)
>> Hi Stephen,
>>
>> commit 03a3bb7ae63150230c5de645dc95e673ebf17e1a
>> Author: Stephen Boyd <swboyd@chromium.org>
>> Date: Mon Aug 5 16:32:41 2019 -0700
>>
>> hwrng: core - Freeze khwrng thread during suspend
>>
>> Commit seems to be breaking suspend/resume on TI AM43/AM33 platforms.
>>
>>
>> rtcwake: wakeup from "mem" using /dev/rtc0 at Sun Nov 18 02:12:12 2018
>> [ 54.033833] PM: suspend entry (deep)
>> [ 54.037741] Filesystems sync: 0.000 seconds
>> [ 54.062730] Freezing user space processes ... (elapsed 0.001 seconds)
>> done.
>> [ 54.071313] OOM killer disabled.
>> [ 54.074572] Freezing remaining freezable tasks ...
>> [ 74.083121] Freezing of tasks failed after 20.003 seconds (1 tasks
>> refusing to freeze, wq_busy=0):
>> [ 74.092257] hwrng R running task 0 289 2
>> 0x00000020
>> [ 74.099511] [<c08c64c4>] (__schedule) from [<c08c6a10>]
>> (schedule+0x3c/0xc0)
>> [ 74.106720] [<c08c6a10>] (schedule) from [<c05dbd8c>]
>> (add_hwgenerator_randomness+0xb0/0x100)
>> [ 74.115358] [<c05dbd8c>] (add_hwgenerator_randomness) from
>> [<bf1803c8>] (hwrng_fillfn+0xc0/0x14c [rng_core])
>
> Thanks for the report. I suspect we need to check for freezer in
> add_hwgenerator_randomness(). I find it odd that there's another caller
> of add_hwgenerator_randomness(), but maybe the ath9k driver can be
> converted to some sort of hwrng driver instead of calling into the
> kthread directly.
>
> Anyway, can you try this patch?
I applied the below patch on top of latest next branch.
Fixes the issue.
Thanks,
Keerthy
>
> ---8<---
> diff --git a/drivers/char/random.c b/drivers/char/random.c
> index 5d5ea4ce1442..e2e85ca16410 100644
> --- a/drivers/char/random.c
> +++ b/drivers/char/random.c
> @@ -2429,6 +2429,7 @@ void add_hwgenerator_randomness(const char *buffer, size_t count,
> size_t entropy)
> {
> struct entropy_store *poolp = &input_pool;
> + bool frozen = false;
>
> if (unlikely(crng_init == 0)) {
> crng_fast_load(buffer, count);
> @@ -2439,9 +2440,12 @@ void add_hwgenerator_randomness(const char *buffer, size_t count,
> * We'll be woken up again once below random_write_wakeup_thresh,
> * or when the calling thread is about to terminate.
> */
> - wait_event_interruptible(random_write_wait, kthread_should_stop() ||
> + wait_event_interruptible(random_write_wait,
> + kthread_freezable_should_stop(&frozen) ||
> ENTROPY_BITS(&input_pool) <= random_write_wakeup_bits);
> - mix_pool_bytes(poolp, buffer, count);
> - credit_entropy_bits(poolp, entropy);
> + if (!frozen) {
> + mix_pool_bytes(poolp, buffer, count);
> + credit_entropy_bits(poolp, entropy);
> + }
> }
> EXPORT_SYMBOL_GPL(add_hwgenerator_randomness);
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Suspend/Resume Broken on AM43/AM33 Platforms
2019-08-19 7:27 ` Keerthy
@ 2019-08-19 15:00 ` Stephen Boyd
0 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2019-08-19 15:00 UTC (permalink / raw)
To: Keerthy, Tony Lindgren, herbert
Cc: Linux-OMAP, Linux Kernel Mailing List, Kristo, Tero, Dave Gerlach
Quoting Keerthy (2019-08-19 00:27:13)
>
>
> On 19/08/19 11:57 AM, Stephen Boyd wrote:
> > Quoting Keerthy (2019-08-18 21:24:58)
> >> Hi Stephen,
> >>
> >> commit 03a3bb7ae63150230c5de645dc95e673ebf17e1a
> >> Author: Stephen Boyd <swboyd@chromium.org>
> >> Date: Mon Aug 5 16:32:41 2019 -0700
> >>
> >> hwrng: core - Freeze khwrng thread during suspend
> >>
> >> Commit seems to be breaking suspend/resume on TI AM43/AM33 platforms.
> >>
> >>
> >> rtcwake: wakeup from "mem" using /dev/rtc0 at Sun Nov 18 02:12:12 2018
> >> [ 54.033833] PM: suspend entry (deep)
> >> [ 54.037741] Filesystems sync: 0.000 seconds
> >> [ 54.062730] Freezing user space processes ... (elapsed 0.001 seconds)
> >> done.
> >> [ 54.071313] OOM killer disabled.
> >> [ 54.074572] Freezing remaining freezable tasks ...
> >> [ 74.083121] Freezing of tasks failed after 20.003 seconds (1 tasks
> >> refusing to freeze, wq_busy=0):
> >> [ 74.092257] hwrng R running task 0 289 2
> >> 0x00000020
> >> [ 74.099511] [<c08c64c4>] (__schedule) from [<c08c6a10>]
> >> (schedule+0x3c/0xc0)
> >> [ 74.106720] [<c08c6a10>] (schedule) from [<c05dbd8c>]
> >> (add_hwgenerator_randomness+0xb0/0x100)
> >> [ 74.115358] [<c05dbd8c>] (add_hwgenerator_randomness) from
> >> [<bf1803c8>] (hwrng_fillfn+0xc0/0x14c [rng_core])
> >
> > Thanks for the report. I suspect we need to check for freezer in
> > add_hwgenerator_randomness(). I find it odd that there's another caller
> > of add_hwgenerator_randomness(), but maybe the ath9k driver can be
> > converted to some sort of hwrng driver instead of calling into the
> > kthread directly.
> >
> > Anyway, can you try this patch?
>
> I applied the below patch on top of latest next branch.
>
> Fixes the issue.
>
Cool thanks. I'll send an official patch now.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-08-19 15:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-19 4:24 Suspend/Resume Broken on AM43/AM33 Platforms Keerthy
2019-08-19 6:27 ` Stephen Boyd
2019-08-19 7:27 ` Keerthy
2019-08-19 15:00 ` Stephen Boyd
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).