Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp2385715rwi; Tue, 1 Nov 2022 07:11:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM533qkBWnHZCo3P00GEtkr7PCZI3YXmNFSa+6C5xNK4HnXqUsIDENNMoxAlSQhXO9O3t612 X-Received: by 2002:a05:6a02:192:b0:43c:a0cb:44d3 with SMTP id bj18-20020a056a02019200b0043ca0cb44d3mr17885291pgb.139.1667311899502; Tue, 01 Nov 2022 07:11:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667311899; cv=none; d=google.com; s=arc-20160816; b=L6yzqCj5xjZ7bdhMY2zxbzl8HjstNc/KX7knX63EY8QlA0rexIJJs0tvemFLI5s1qF fYXVBwAGggBpHVrplgG466qc3FqnMCJTRN5I2O+3OQd9sGs3zGWPC6eW8Jn08kqXpsbV FqX7XAkyV9l/4oQDDtOplkDFNP8PYr4vBe3YUz/PK1VCIGfiGL6xMw3Hy9prs6Ze38az vqTh9C0YE/SSwUROgsSYXgDUNYYcOSD54YaYrJzQjG7gWIiTr2LkyGpajFTUnUra6V6I fDg588l15hw+BtNzuaw9pPJXmTNDa/dFQbbK4dlQu0cxN951towJiYDTCcgMBBRC3hMt WyXA== 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=KKxfnxMl4m+MwrdoJErS5B0YplPC2plIQoIqY3ibfNE=; b=VgWm1AH6q+rmmjqWN4SbaWipFVZTQFjhRXcHO8Wv4STDzJfxGJyZasr7Cm0ln1vq+b mcxL2fC16mQzVUUMUlpTqD4ECH0Ia8a7VFnB6Mqk6HL1/tjSgtZoTQ/cSddtmZ8cbUJ5 bjKU7JKVglLf3JY/9XqR5lAQA7orKp+SDmfIh4lvFgFrEaOKM6r8Xb/mlu+ikSHCHGGh jy+oveoklSmARQwZkXpQiKIWoRn+oa0D0HV2Q5iYuwqDJiq0/eKf2jLlC5BF4MJ8cWt/ LV5iOy1mutUMUWrt+kY78wVBJwD9ucAKUdaj8d2gkgyGsWFjvxXPnbBoBQVdemO2cnpl LpjQ== 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 h14-20020a170902ac8e00b0017889771a05si10976499plr.566.2022.11.01.07.11.17; Tue, 01 Nov 2022 07:11:39 -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 S230169AbiKAOGB (ORCPT + 96 others); 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> X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS 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 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