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 237D9C433FE for ; Tue, 1 Nov 2022 14:06:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229936AbiKAOGB (ORCPT ); Tue, 1 Nov 2022 10:06:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229950AbiKAOF7 (ORCPT ); Tue, 1 Nov 2022 10:05:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8EBA1A835 for ; Tue, 1 Nov 2022 07:05:58 -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 ams.source.kernel.org (Postfix) with ESMTPS id 85A14B81D9F for ; Tue, 1 Nov 2022 14:05:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC2B0C433D6; Tue, 1 Nov 2022 14:05:54 +0000 (UTC) Date: Tue, 1 Nov 2022 14:05:51 +0000 From: Catalin Marinas To: "Jason A. Donenfeld" Cc: 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: <20221101122527.323843-1-Jason@zx2c4.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > Instead we can test whether we're in the early phase in > arch_get_random*() itself, and in doing so avoid all ambiguity about > where we are. Fortunately, the only architecture that currently > implements arch_get_random*_early() also has an alternatives-based cpu > feature system, one flag of which determines whether the other flags > have been initialized. This makes it possible to do the early check with > zero cost once the system is initialized. > > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Ard Biesheuvel > Cc: Jean-Philippe Brucker > Signed-off-by: Jason A. Donenfeld Reviewed-by: Catalin Marinas