Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp646352iog; Thu, 30 Jun 2022 07:36:29 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sOHwG33qICLHgYz3//Xzv5/ikoj7oi0akhfl52cfuTHmYTFvLhdP2KW+5PsWMf7cqZTAn/ X-Received: by 2002:a17:907:3e24:b0:726:36d6:5a9a with SMTP id hp36-20020a1709073e2400b0072636d65a9amr9200073ejc.612.1656599789286; Thu, 30 Jun 2022 07:36:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656599789; cv=none; d=google.com; s=arc-20160816; b=KVNiWOk7oM/B37cAQCevOijEhJjKa30S1LqxhrliA3vHXWOrfnZ5ZQdtofYAM9Kn+7 Hf0l3No+fFIvx0vCLlBUTI6ZSbDv6wMu0axf64t4ev7j2gxPG7hWtB3VAhMGqWKmiEr/ uiO7isE6YsuXPQ+867Gnb1jNtBssAkX5pp5iSPGKeSGp5mUHmcL4U2UXB8IUrIc3tB2/ RUf8YBspFZ0xvTrHpRlIZMChZ9BhpeDlv7nYwCsf0U8wHpQrl+cUkJdtk4m9MGZARkI+ 7Iml97V+KgXqSnUToTXgBU8DijzlxbRxJR5wwTMsHUGB14AorQvcBbFOooiuq902/6vN xYWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=CDAtRv+i47lPZN+MeSRWN9u2g5rs4eBI6saO4iW7/wk=; b=CPFT/ECxNGWedXHFEXrQdhgwW0jWOIJbu71J9PHl3NKQh5u15Ao3hSyqQK7WuRFDM1 nL6XqLyFXLurxO+5Q56tthU8/dgELne8OXRyXffsQC2W/zpoDYsdW5VYT+AIwKaDmSzF LncjakHPZ2dRUzNPXNkpAE6nXycGb+Z8BArw6FBPIoaBB2MT5f/TClN0Y+8vbggTm27v fHz8WzzUN2rODEZBE9gm5Y8kH80i6lEH+FklhtijNsCRZB0IIg5IglZr+qhJjRLw0ad9 b1Xs3Y22Q7Xbt1W77Y8hgLj9mLTJo2wMV0wCeaZX36YfgdZh7st1EiA5awJbthvs4Bsq gXZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=WqqidDEG; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y10-20020a056402440a00b00437b04e3a9esi1314102eda.105.2022.06.30.07.35.59; Thu, 30 Jun 2022 07:36:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=WqqidDEG; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237096AbiF3OUV (ORCPT + 64 others); 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> X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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