Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp2300859rwi; Tue, 1 Nov 2022 06:18:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6/Lvyifv5nz1h0wS/megMmqLB2zSx8pQsQSZn1RxjIvIFce5cgraaVtu+p+kIeN5FA8H4K X-Received: by 2002:a17:906:8a63:b0:7ad:95cf:726a with SMTP id hy3-20020a1709068a6300b007ad95cf726amr18398965ejc.82.1667308720877; Tue, 01 Nov 2022 06:18:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667308720; cv=none; d=google.com; s=arc-20160816; b=RkKL/w4R0eKqMALPt346nE87+RMjLkQrHkxaVG866WObX45SiPkgp374vAU/Fu9RaC yi+chIkJULSMPWPphpMu79rfMEmD6usqAplLc3s0eJ1E/GChwBECScYuQliYzszFErlm JCS3ZHyHToXQmhs0O7gBaEviuRXP1AAHl1OKNMCYLoftmV7mBJxg+qwj8bvf3jKodpXX 5WreX2zV158HuLW93moqnAuWFOi+4Fus+CEi6UKK4XpQBKeKUasnBOiA8UUp2txVoi2O iH5G8zGEo2uNQ+LKC1TdaJlqVPrhSpO66vxFG9dGRYZUt1YhtsiSSUBcR7Nb3lGZwLTo MYuw== 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=sc6fHEE1eRJrNRnPjvn5bXDe0JBZi0Wz9xJSHta3xdg=; b=K5KNiVO9+AoqvyvYtMD2CPFLhgMOYnvQhe5Y7OdkJ64igazFkMliUETcJTTYbiC7fV k19NyAg7zqNbh4lCf0fzSgBtwCrtx8JnU9XuRWz4+hT0oL0AF/cGn/l1QuXhBekA6pQ1 ETdNhIl22bdqBNzvPUmB20CGY30AvuocCt5UZI6oFVtr1qfch+fUBKd5ZQhV3Url5jAs RdScszg/vqXSjP+QWPD/eUU0NGNeuf7eB8fQwY2B4uMQh4LqM8HSk+jAiqn7Mfwvhmdd s2fawb1tBuvtKHcU8G3AHtv9s/iVEty0wYx3p/VQ3qiXYuvAAj1C2l9QxVBNJgIVLxeW KlXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k8-20020a17090627c800b0073d91a38b35si9017906ejc.789.2022.11.01.06.18.16; Tue, 01 Nov 2022 06:18:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229940AbiKANHq (ORCPT + 98 others); Tue, 1 Nov 2022 09:07:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229531AbiKANHo (ORCPT ); Tue, 1 Nov 2022 09:07:44 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 06CF31A82D for ; Tue, 1 Nov 2022 06:07:44 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1828F1FB; Tue, 1 Nov 2022 06:07:50 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.3.81]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 847323F703; Tue, 1 Nov 2022 06:07:42 -0700 (PDT) Date: Tue, 1 Nov 2022 13:07:39 +0000 From: Mark Rutland To: "Jason A. Donenfeld" Cc: Catalin Marinas , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Will Deacon , Ard Biesheuvel , Jean-Philippe Brucker Subject: Re: [PATCH v5] random: remove early archrandom abstraction Message-ID: References: <20221101115616.232884-1-Jason@zx2c4.com> <20221101122527.323843-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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-kernel@vger.kernel.org On Tue, Nov 01, 2022 at 02:02:58PM +0100, Jason A. Donenfeld wrote: > Hi Mark, > > On Tue, Nov 01, 2022 at 12:36:07PM +0000, Mark Rutland wrote: > > Hi Jason, > > > > Sorry for joining this late... > > > > On Tue, Nov 01, 2022 at 01:25:28PM +0100, Jason A. Donenfeld wrote: > > > The arch_get_random*_early() abstraction is not completely useful and > > > adds complexity, because it's not a given that there will be no calls to > > > arch_get_random*() between random_init_early(), which uses > > > arch_get_random*_early(), and init_cpu_features(). During that gap, > > > crng_reseed() might be called, which uses arch_get_random*(), since it's > > > mostly not init code. > > > > The original rationale for arch_get_random*_early() was just to seed the RNG > > more robustly rather than to feed every possible arch_get_random() call made > > early in the boot flow, and the rationale for having a separate functions was > > that it was trivial to see by inspection that it was (only) called in the > > expected places. > > > > I'm not wedded to arch_get_random*_early() specifically, but I do think that > > having arch_get_random() behave differently depending on which phase of boot > > we're in has more scope for error than having a separate call of some sort. > > > > Other than removing the lines below, what chages is this going to permit? > > Firstly, the issue with the API is having to remember to use it! There's > already been a bug from forgetting to use the _early() call during some > refactoring, and I doubt it'll be the last. > > But also, functions such as crng_reseed()->extract_entropy() wind up > being called in both early contexts and normal contexts. It's not > feasible to have different paths there, so by having two functions, > we miss out on having access during early boot. > > So I don't want a separate call, both for the API complexity reasons, > and because it doesn't really work as intended in the end. If it's too painful to use separate paths, then fair enough. Thanks for the summary! Mark.