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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E2D7C433FE for ; Tue, 1 Nov 2022 13:08:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gMHIeowIK5WjVXprmRqsXvPInJZH7Dtut9yePTG3M/8=; b=s03xajcuvqLm8b PmGvU8LKWC1VBl4lu9rcu+aJFpzYSCjPNzuGer+pQAdwXTEyk0ouPZyviuSP3NqLPOc4MlyjCnw/W rDVnC8LqIcyU1vIMNd79jO2CF8cSHnVC3hKahgyu3h8cjaNNrwVU5Ko6y71O553Wr3zniOsMaNJJE HwjVlOZ4nmtBJdu0RO8exRbGP9jMOtJSMUmfDwB9LQcDMVXe8++BjyErRjeshSZ/2lQ0ypycTpCZx V0dxG2h+LHByeWNTXDpMwD0pUUbFAVH3spBlLeJTp0IkaxTuLczg5mZpZAqB/vhHUSilaKk7JmzqX 2PtTpQxxPQXO58sMVWZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1opqzc-005Dqw-Ok; Tue, 01 Nov 2022 13:07:48 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1opqza-005Dq4-4B for linux-arm-kernel@lists.infradead.org; Tue, 01 Nov 2022 13:07:47 +0000 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-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221101_060746_233144_2BE4B874 X-CRM114-Status: GOOD ( 27.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel