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 0FBDCC43334 for ; Thu, 30 Jun 2022 14:20:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237096AbiF3OUV (ORCPT ); Thu, 30 Jun 2022 10:20:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237097AbiF3OT6 (ORCPT ); Thu, 30 Jun 2022 10:19:58 -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 0A7C689E69; Thu, 30 Jun 2022 07:03:37 -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 1EF87621A3; Thu, 30 Jun 2022 14:03:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92FE1C3411E; Thu, 30 Jun 2022 14:03:35 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="WqqidDEG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1656597813; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CDAtRv+i47lPZN+MeSRWN9u2g5rs4eBI6saO4iW7/wk=; b=WqqidDEGQmq71lTdqGpK4AVjA71rXhDqIK18x0CMAmFzURDwMiQaU3hdv2oopmgEXFL1A3 M2/xT3DqlYVImGry8d+FqGmkiv3H8+fwfBghIov8bRd412rVoN1pnej2wdLfBOp8N24mv/ hcuvf6Wu8rwjOt/dIQtm9YLIocIenZY= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id e5e0acb7 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Thu, 30 Jun 2022 14:03:33 +0000 (UTC) Date: Thu, 30 Jun 2022 16:03:31 +0200 From: "Jason A. Donenfeld" To: Herbert Xu , linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, gregerwin256@gmail.com Cc: Gregory Erwin , Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= , Kalle Valo , Rui Salvaterra , stable@vger.kernel.org Subject: Re: [PATCH v8] ath9k: let sleep be interrupted when unregistering hwrng Message-ID: References: <20220629114240.946411-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220629114240.946411-1-Jason@zx2c4.com> Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Hey Gregory, On Wed, Jun 29, 2022 at 01:42:40PM +0200, Jason A. Donenfeld wrote: > 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øiland-Jørgensen > Cc: Kalle Valo > Cc: Rui Salvaterra > Cc: Herbert Xu > Cc: stable@vger.kernel.org > 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 Hoping for your `Tested-by:` if this still works for you. Jason