Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2174262iof; Tue, 7 Jun 2022 22:11:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxLDreYb35lFukQO6G6Dv0brcOKXJolqxpN4lob+yX+uF+BKeLcgWhznmJHV0SrmFVc8l+ X-Received: by 2002:a17:902:b10e:b0:165:7c1b:67fc with SMTP id q14-20020a170902b10e00b001657c1b67fcmr32382931plr.77.1654665063466; Tue, 07 Jun 2022 22:11:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654665063; cv=none; d=google.com; s=arc-20160816; b=fYfrXDcrTls5iMIllpEffH5XGsmroZFovQmWw7hEVjovu11wpNDhiXa0sc5EEm6p80 5OBAVUqltjsTzls+kl8sk730DJyBE5fIekmnmFQQpgzQQQyJ3DOwKVqin4wM3E/t2hsR uaqrifAShw9J4JIV/QgEai46XXH/doL8JoEWa8T7tduhugPB91p5fg15D5/hfkhCeKAc Z/VBDPvUISDaZhKTtAPUyiT8ifeNDc9hAVyJB+Wc0wxLDUC37Azlz56CmtOVBKlVW63N I7SSa8LUOmHBGmkPMrPdqvasdTyQ24HL5HcCQKY+YWBloXmZEzY5a5HECrLJi8UDtenV b4PQ== 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:dkim-signature; bh=5crPd/ksoB52wnt1QWnc0dRKkI8RoZ5ZCdKpuIJg3ns=; b=scnXiT9fX1KxyNpv0BE0hX7HvYOcNQAKuBCINAZugIkvGxA4WHd+3DyoeGFTIBYqah IDsz5lUYlN+XZxHJ13yfG9KMu4dPUkvs7IT4slj5N7N6Q9NGX8WuTHY7U/x1ezRCGPW2 p181ntX55CKqpWKhlOWhOqXvf8OeoljRY1sP2J/6bkyOXWa7RTtpulfqp9ufMXWtpGxF Fo7BaYs3AAW/3vYVpzDxkectMEuIJCs2OTnKoz3wKqT/H+V96exrfX73rCy7+rIMQZpC 8d+CUzvzM32YbjyVu/oR+ewo/h35kJ7blx3Eu6SoFtLaHbNbcM3QdUO4VtK+wQRiizIB wZzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=LBBel72C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l63-20020a638842000000b003fe30cc898bsi1433064pgd.664.2022.06.07.22.11.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:11:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=LBBel72C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 71E6B793BB; Tue, 7 Jun 2022 21:41:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243694AbiFGMXN (ORCPT + 99 others); Tue, 7 Jun 2022 08:23:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243651AbiFGMWg (ORCPT ); Tue, 7 Jun 2022 08:22:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A974F68B2 for ; Tue, 7 Jun 2022 05:22:04 -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 9CFD7B81F85 for ; Tue, 7 Jun 2022 12:22:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B523C385A5; Tue, 7 Jun 2022 12:22:00 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="LBBel72C" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1654604519; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5crPd/ksoB52wnt1QWnc0dRKkI8RoZ5ZCdKpuIJg3ns=; b=LBBel72CvuhkFnWKdIouYW94bXyc4OQ34mJt3NIdCV7Ggss6zMaiAvpXMo5HU/Fawg2HBB eQRaFqY7GWFU17DDQPRKenLte7GvvA0+N28RnIfRWINj8ASy9p/ADZtWj04TfW7KHPnQ5K NEOU4vJoMEuF9Jm5759dY9IlZk0O38E= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 453d7396 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Tue, 7 Jun 2022 12:21:58 +0000 (UTC) Date: Tue, 7 Jun 2022 14:21:55 +0200 From: "Jason A. Donenfeld" To: Ard Biesheuvel Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Stephen Boyd , Catalin Marinas , Russell King , Arnd Bergmann , Phil Elwell Subject: Re: [PATCH] random: defer use of bootloader randomness to random_init() Message-ID: References: <20220607111514.755009-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Hi Ard, On Tue, Jun 07, 2022 at 02:15:27PM +0200, Ard Biesheuvel wrote: > Note that jump labels use asm() blocks, which are opaque to the > compiler, and so it is not guaranteed that codegen will be better than I actually spent a lot of time looking at the codegen on a few platforms. > > > - Why do we need to enable this static key so early? > > > > We don't need to enable it especially early. I've now sent three > > different approaches for deferring it until later and you suggested one. > > The first of mine is kind of ugly (checking static_key_initialized and > > such at different points). Your suggested one after that did the same > > but deferred into crng_reseed(), which I'm not a fan of. My second one > > is this patch, which is flawed for the reason you pointed out. But > > perhaps my third one is the right amount of simple and okay? That's the > > one I linked up top, [1]. Let me know what you think of that. > > > > My motivation for not wanting to defer it is that if the arch solution > > winds up being easy and straight forward (as it was for arm64), then it > > would be nice to not need to clutter up random.c as a result. > > If clutter is a concern, how about getting rid of the > execute_in_process_context() dance, and just use a late_initcall() > instead? As I already explained in [1], this does not work. If the order is (A)(B), then all this will happen *after* the late init call. [1] https://lore.kernel.org/lkml/Yp8oOH+9V336LrLk@zx2c4.com/ Jason