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 A1ADFC38A02 for ; Sun, 30 Oct 2022 21:09:23 +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=Te1sb1f/EglJkvqDMVCPt9tkj2xkB31TesjgvsVU7cs=; b=DnTVegXwvAd9bf 8zgt6ho6Bm5g95KR3o9tg7yxJZjV7M2cV8sTa1xdjiLsnFWjlyTH6y45z3O5CX+DA+x/Cb8y2JOI5 gWfzP+VKkXocTo8f3nJy26JKHR1yYqKCoaTw4wh8PBuXx7e3ZS/hbYPzOV6FUaVBbsHNe52A+tP9h BOGQ7THnkXaSIUve/xrIZbck4JveFGnsWvog5iT0GOTJGmmoQ5E41ZeicWFRALVn5RPp9hlxZnUzp 1jbB1Oo7sjDbEmml02hDdyKMtLN24IhChjksarYOT4A+G0XLoypA7KABuyDzAhqdbmt6XJUYbIpoi 06tx5iMhUokxCvIRHm6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1opFXO-003BZK-8e; Sun, 30 Oct 2022 21:08:10 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1opFXL-003BVv-Kx for linux-arm-kernel@lists.infradead.org; Sun, 30 Oct 2022 21:08:09 +0000 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 55025B80DA8; Sun, 30 Oct 2022 21:08:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26180C433C1; Sun, 30 Oct 2022 21:08:00 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="o/xt56en" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1667164078; 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=vs1yilsLd6bxIKb8IAJ+0QKQjEQERTtWE9r/YjNtvY4=; b=o/xt56en10FpHW4xzXNR2Jk404BJFH0QdurRCA3ax/byJ98dbvkzL4a1spmGS8ii+HZxXh zlco6HSD2Wpqn4WwBzm9ln/vl35zUmeHidbldXGHUYep0+7DFbaW8xZcBuA1kqz+StkCAR gmVFBnQEl6pR67Hz/O9QWt4kaPes84c= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 7321aa22 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 30 Oct 2022 21:07:57 +0000 (UTC) Date: Sun, 30 Oct 2022 22:07:53 +0100 From: "Jason A. Donenfeld" To: Catalin Marinas Cc: will@kernel.org, jean-philippe@linaro.org, ardb@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] random: remove early archrandom abstraction Message-ID: References: <20221028234025.82222-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-20221030_140808_099687_9A8198BC X-CRM114-Status: GOOD ( 20.27 ) 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 Hi Catalin, > > +static __always_inline bool __cpu_has_rng(void) > > +{ > > + if (!system_capabilities_finalized()) { > > + /* Open code as we run prior to the first call to cpufeature. */ > > + unsigned long ftr = read_sysreg_s(SYS_ID_AA64ISAR0_EL1); > > + return (ftr >> ID_AA64ISAR0_EL1_RNDR_SHIFT) & 0xf; > > + } > > + return cpus_have_const_cap(ARM64_HAS_RNG); > > +} > > We need to be careful with this check as it is only valid on the CPU it > was called on. Is the result used only on this CPU and with the > preemption disabled? We have big.LITTLE systems where CPUs may differ > and the ARM64_HAS_RNG feature may not be enabled once all the CPUs have > been initialised (capabilities finalised). > > We could make this capability an ARM64_CPUCAP_BOOT_CPU_FEATURE, though > I'd have to check whether any systems in the wild have such mixed CPUs. This occurred to me too and I wasn't quite sure how the interaction worked out. It sounds like system_capabilities_finalized() might still be false when SMP brings up other cores? In that case, I guess we just have to make sure the system is still booting / in single CPU mode, before interrupts have been enabled. This should be straight forward to do; I'll send a v2. Jason _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel