From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03365CCA479 for ; Thu, 7 Jul 2022 16:26:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236053AbiGGQ0t (ORCPT ); Thu, 7 Jul 2022 12:26:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235913AbiGGQ0j (ORCPT ); Thu, 7 Jul 2022 12:26:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A76F84D174; Thu, 7 Jul 2022 09:26:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 42DB7623C3; Thu, 7 Jul 2022 16:26:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FD17C3411E; Thu, 7 Jul 2022 16:26:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657211195; bh=PP+pZtnbEBoGFSDAfTiA1TASPGKOktDeMzuTB5Z2rCE=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=nOCCoy1LGzU9IP2Pah/a04c4P1c/hO3gLEb+bQsaETT48tR32wsNsg/0awhoSZdkE g5lmimcwAhXnCU4eDIZw663mZwBzY2gt1XKd4hU/cinmFdyNvKlpsFtI/1AdO12nKz GtiX1Tmb/uPP0L7I/BEGMKTHJejBkIGuV4dCGigrHwqkBlk/P5ExAtOJC2bgxsHIzt J470O4XO8suFpEf/YC5cRIRUdvsHa7rhVAQBFYzkrcACVQrzp7P8nhiAn2imrQEdBg eamvVxZDt/kqC7V6iUkh0xpNpkcTPMvHLnwgPYJKXsEJNVagNW2uubSpkFNjkc59aJ 1l5HQ5vgoH8SA== From: Kalle Valo To: "Jason A. Donenfeld" Cc: Herbert Xu , linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, Gregory Erwin , Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= , Rui Salvaterra , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Christian Brauner , linux-crypto@vger.kernel.org Subject: Re: [PATCH v8] ath9k: let sleep be interrupted when unregistering hwrng References: <20220629114240.946411-1-Jason@zx2c4.com> Date: Thu, 07 Jul 2022 19:26:27 +0300 In-Reply-To: <20220629114240.946411-1-Jason@zx2c4.com> (Jason A. Donenfeld's message of "Wed, 29 Jun 2022 13:42:40 +0200") Message-ID: <87v8s8ubws.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org "Jason A. Donenfeld" writes: > 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() instead of schedule_timeout_interruptible(= ). > The fix is a simple moving to the correct function. At the same time, > we should cleanup a common and useless dmesg splat in the same area. > > 2) A normal user thread can't be interrupted by hwrng_unregister() while > it's sleeping, because hwrng_unregister() is called from elsewhere. > The solution here is to keep track of which thread is currently > reading, and asleep, and signal that thread when it's time to > unregister. There's a bit of book keeping required to prevent > lifetime issues on current. > > Reported-by: Gregory Erwin > Cc: Toke H=C3=B8iland-J=C3=B8rgensen > Cc: Kalle Valo > Cc: Rui Salvaterra > Cc: Herbert Xu > Cc: stable@vger.kernel.org > Fixes: fcd09c90c3c5 ("ath9k: use hw_random API instead of directly dumpin= g into random.c") > Link: https://lore.kernel.org/all/CAO+Okf6ZJC5-nTE_EJUGQtd8JiCkiEHytGgDsF= GTEjs0c00giw@mail.gmail.com/ > Link: https://lore.kernel.org/lkml/CAO+Okf5k+C+SE6pMVfPf-d8MfVPVq4PO7EY8H= ys_DVXtent3HA@mail.gmail.com/ > Link: https://bugs.archlinux.org/task/75138 > Signed-off-by: Jason A. Donenfeld > --- > Changes v7->v8: > - Add a missing export_symbol. > > drivers/char/hw_random/core.c | 30 ++++++++++++++++++++++++---- > drivers/net/wireless/ath/ath9k/rng.c | 19 +++++++----------- > kernel/sched/core.c | 1 + > 3 files changed, 34 insertions(+), 16 deletions(-) I don't see any acks for the hw_random and the scheduler change, adding more people to CC. Full patch here: https://patchwork.kernel.org/project/linux-wireless/patch/20220629114240.94= 6411-1-Jason@zx2c4.com/ Are everyone ok if I take this patch via wireless-next? --=20 https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatc= hes