Received: by 2002:a05:6358:16cd:b0:dc:6189:e246 with SMTP id r13csp3466529rwl; Sun, 6 Nov 2022 00:10:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7gcTbWOMnWKjjtHZ7CRk8POdpCGW/Lxndqp9fX60h4dxQYb8BO7eJTmsQg+mDZqKxtG4wx X-Received: by 2002:a17:90b:4acd:b0:212:fe7a:a05a with SMTP id mh13-20020a17090b4acd00b00212fe7aa05amr46372296pjb.204.1667718610627; Sun, 06 Nov 2022 00:10:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667718610; cv=none; d=google.com; s=arc-20160816; b=DgoC0yAt4omu2hnS+rPREIpzQeq9eO0M106i55+T5nili5EdrqQACWALAev1Q2i9Uh hxAKcFLQlaf4KBZkfJK32ITHm3VVZQxPx5N4UhBQkVERjzuSOaHuyGxmVkIdbw08sDjH KH8NLto9weoW2jbq7dxFiYb+96x34Lp7mhZH2fBFamP49Cn8b9iH3Bp/L0QiyaD/JKx6 Hx+7QQ/qrMvF/bnOeuxzabrVF6glLNdS2TxxTgNFX5wk1Lsiyqt8INBILyLw7jDqxjbB CmRw2a3MvFfSq3juelKbAlclDY52JAZ6ul09XjZb715TojvEM+aPcJlDcIvpd8epMKJN fRRw== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=MikBvStvxLkr/aPV4mpDQyp6YeJtn0zCf3ZPnRe3fmw=; b=0Bw4+QVSiLgcPQs0nLxhLUEBC27NuROEuIeOj8ItyuivBdkXB0HRQSDxdk5Y0DsCLm kX2h9rjo3Nsf+5MAuBTUqN4V9S4RFVJinJ7u2OlbGA0Ozk/iejJpFQyWqZm4kSMvbX7D WV+TC1IUx0vx283D/+bW/+UruCniJEIPEXMEg/0oBr4gjn9qIEFjuzMPqORiLVxEwVs0 kmR1CjW6OAe3hceEUB/R76zapmU5XhINuPfzlN0KoXBxf4U30bPB1MjXMTuZ33Ej/CcK t8CoOJglFpF/ihOYRxNdhDKE3sVv+9SrrJCOTirOH+OtjE8NltssSDCHSNqMrvQ1rHgz AoJA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k14-20020a63ab4e000000b0045f0795c39esi5859130pgp.578.2022.11.06.00.09.57; Sun, 06 Nov 2022 00:10:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229564AbiKFHIm (ORCPT + 99 others); Sun, 6 Nov 2022 02:08:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbiKFHIl (ORCPT ); Sun, 6 Nov 2022 02:08:41 -0500 Received: from isilmar-4.linta.de (isilmar-4.linta.de [136.243.71.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE4ACB1FE for ; Sun, 6 Nov 2022 00:08:40 -0700 (PDT) X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES Received: from owl.dominikbrodowski.net (owl.brodo.linta [10.2.0.111]) by isilmar-4.linta.de (Postfix) with ESMTPSA id 4F2A02000AF; Sun, 6 Nov 2022 07:03:03 +0000 (UTC) Received: by owl.dominikbrodowski.net (Postfix, from userid 1000) id BE8B88082C; Sun, 6 Nov 2022 08:02:56 +0100 (CET) Date: Sun, 6 Nov 2022 08:02:56 +0100 From: Dominik Brodowski To: "Jason A. Donenfeld" Cc: herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org Subject: Re: [PATCH v2] hw_random: use add_hwgenerator_randomness() for early entropy Message-ID: References: <20221106015042.98538-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221106015042.98538-1-Jason@zx2c4.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE 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-crypto@vger.kernel.org Am Sun, Nov 06, 2022 at 02:50:42AM +0100 schrieb Jason A. Donenfeld: > Rather than calling add_device_randomness(), the add_early_randomness() > function should use add_hwgenerator_randomness(), so that the early > entropy can be potentially credited, which allows for the RNG to > initialize earlier without having to wait for the kthread to come up. We're already at device_initcall() level here, so that shouldn't be much of an additional delay. > Since we don't want to sleep from add_early_randomness(), we also > refactor the API a bit so that hw_random/core.c can do the sleep, this > time using the correct function, hwrng_msleep, rather than having > random.c awkwardly do it. Isn't this something you were quite hesistant about just recently[*]? | I was thinking the other day that under certain circumstances, it | would be nice if random.c could ask hwrng for more bytes NOW, rather | than waiting. With the code as it is currently, this could be | accomplished by having a completion event or something similar to | that. With your proposed change, now it's left up to the hwrng | interface to handle. | | That's not the end of the world, but it does mean we'd have to come up | with a patch down the line that exports a hwrng function saying, "stop | the delays and schedule the worker NOW". Now impossible, just more | complex, as now the state flow is split across two places. Wondering | if you have any thoughts about this. Thanks, Dominik [*] https://lore.kernel.org/lkml/CAHmME9rhunb05DEnc=UfGr8k9_LBi1NW2Hi0OsRbGwcCN2NzjQ@mail.gmail.com/