2022-07-28 12:56:31

by Toke Høiland-Jørgensen

[permalink] [raw]
Subject: Re: [v12 PATCH] hwrng: core - let sleep be interrupted when unregistering hwrng



On 28 July 2022 12:22:20 CEST, Herbert Xu <[email protected]> wrote:
>From: Jason A. Donenfeld <[email protected]>
>
>There are two deadlock scenarios that need addressing, which cause
>problems when the computer goes to sleep, the interface is set down, and
>hwrng_unregister() is called. When the deadlock is hit, sleep is delayed
>for tens of seconds, causing it to fail. These scenarios are:
>
>1) The hwrng kthread can't be stopped while it's sleeping, because it
> uses msleep_interruptible() which does not react to kthread_stop.
>
>2) A normal user thread can't be interrupted by hwrng_unregister() while
> it's sleeping, because hwrng_unregister() is called from elsewhere.
>
>We solve both issues by add a completion object called dying that
>fulfils waiters once we have started the process in hwrng_unregister.
>
>At the same time, we should cleanup a common and useless dmesg splat
>in the same area.
>
>Cc: <[email protected]>
>Reported-by: Gregory Erwin <[email protected]>
>Fixes: fcd09c90c3c5 ("ath9k: use hw_random API instead of directly dumping into random.c")
>Link: https://lore.kernel.org/all/CAO+Okf6ZJC5-nTE_EJUGQtd8JiCkiEHytGgDsFGTEjs0c00giw@mail.gmail.com/
>Link: https://lore.kernel.org/lkml/CAO+Okf5k+C+SE6pMVfPf-d8MfVPVq4PO7EY8Hys_DVXtent3HA@mail.gmail.com/
>Link: https://bugs.archlinux.org/task/75138
>Signed-off-by: Jason A. Donenfeld <[email protected]>
>Signed-off-by: Herbert Xu <[email protected]>

Acked-by: Toke Høiland-Jørgensen <[email protected]>


2022-07-28 13:02:35

by Kalle Valo

[permalink] [raw]
Subject: Re: [v12 PATCH] hwrng: core - let sleep be interrupted when unregistering hwrng

Toke Høiland-Jørgensen <[email protected]> writes:

> On 28 July 2022 12:22:20 CEST, Herbert Xu <[email protected]> wrote:
>>From: Jason A. Donenfeld <[email protected]>
>>
>>There are two deadlock scenarios that need addressing, which cause
>>problems when the computer goes to sleep, the interface is set down, and
>>hwrng_unregister() is called. When the deadlock is hit, sleep is delayed
>>for tens of seconds, causing it to fail. These scenarios are:
>>
>>1) The hwrng kthread can't be stopped while it's sleeping, because it
>> uses msleep_interruptible() which does not react to kthread_stop.
>>
>>2) A normal user thread can't be interrupted by hwrng_unregister() while
>> it's sleeping, because hwrng_unregister() is called from elsewhere.
>>
>>We solve both issues by add a completion object called dying that
>>fulfils waiters once we have started the process in hwrng_unregister.
>>
>>At the same time, we should cleanup a common and useless dmesg splat
>>in the same area.
>>
>>Cc: <[email protected]>
>>Reported-by: Gregory Erwin <[email protected]>
>>Fixes: fcd09c90c3c5 ("ath9k: use hw_random API instead of directly
>> dumping into random.c")
>>Link:
>> https://lore.kernel.org/all/CAO+Okf6ZJC5-nTE_EJUGQtd8JiCkiEHytGgDsFGTEjs0c00giw@mail.gmail.com/
>>Link:
>> https://lore.kernel.org/lkml/CAO+Okf5k+C+SE6pMVfPf-d8MfVPVq4PO7EY8Hys_DVXtent3HA@mail.gmail.com/
>>Link: https://bugs.archlinux.org/task/75138
>>Signed-off-by: Jason A. Donenfeld <[email protected]>
>>Signed-off-by: Herbert Xu <[email protected]>
>
> Acked-by: Toke Høiland-Jørgensen <[email protected]>

Acked-by: Kalle Valo <[email protected]>

Herbert, feel free to take this via your tree. Thanks!

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

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