Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp541215pxb; Thu, 5 Nov 2020 06:50:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJy7xNBN1Dsc37sg90GSmRMm7hi1rUPZDUhHDTws0Zvx4Z6z3RJN7g3UpNzdWeii//uhAGc9 X-Received: by 2002:a05:6402:1d3b:: with SMTP id dh27mr2781088edb.183.1604587816179; Thu, 05 Nov 2020 06:50:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604587816; cv=none; d=google.com; s=arc-20160816; b=pkYeAgjfMC9nbD+VcEhQ9RHKyd2vt+d80STFZEEzAehAVrh66ewecStHX9U9wxc0wR BjiwYiVos5aDDWBQc8ys19UaHhSDe2CZleVWBS+21oLRu34Zm1ybpkbnwlSyNfPSB+O6 2UfttdOwSvjwhWskk0NnAjOG+J0vEM+jhPfWpQm4aez8VbZG6JSy3iSGSZ70g7EFAyV7 1OHG8XMGazSyf9Wve1wfsxCc/x3S1kxULCCzGpM2UwWWLzxdxpfaLEQgoBya+TW1poXc qoKMYQX/8yNQYQ2Sz+qCaXe38uFShM7oojGLrHYfH/nr7Scj093iwBBmPIgj+e5Egazd dReg== 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=+rpQ+CQwF2YcP3Ew8mtdJEK3+5tkqIGB/nKLHozGeZ8=; b=RIG6BnYCPqs8xbm5fpxBs007XG5B2UMONRLdVjSiY4H16JClrlLYICxar2YEInbKSm X/vaCtbIj/mAr1X6FcqoOS6YykGcTq/CKXMesbvepi9iJDbEe/hp1puv2HVmNV2HonpU 9Q3hJtgDm7mMq1aXF32nge7zziNw6/a1SP2q0l9xcZwO1XPQ68RngzFWwPortPUdvAMU v37tLWyBBKQkLMl+f2JojBF6//2BTucU9UINKIybp45H9a+4jRI+FmZT8eaGTiw9mvVH qHBhU9EZjXgJYJ7VC2im3mKHUJeraJP4/AzV6ZzEO9EUhuCJwZmmq/Zi5+RbTav3zYkT 6YTA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t17si1267358edq.418.2020.11.05.06.49.53; Thu, 05 Nov 2020 06:50:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1731175AbgKEOph (ORCPT + 99 others); Thu, 5 Nov 2020 09:45:37 -0500 Received: from foss.arm.com ([217.140.110.172]:34554 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731089AbgKEOph (ORCPT ); Thu, 5 Nov 2020 09:45:37 -0500 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 7557D14BF; Thu, 5 Nov 2020 06:45:36 -0800 (PST) Received: from C02TD0UTHF1T.local (unknown [10.57.58.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A86743F718; Thu, 5 Nov 2020 06:45:33 -0800 (PST) Date: Thu, 5 Nov 2020 14:45:30 +0000 From: Mark Rutland To: Ard Biesheuvel Cc: Marc Zyngier , Mark Brown , Andre Przywara , Will Deacon , Catalin Marinas , Russell King , Linux ARM , kvmarm , Linux Kernel Mailing List , Sudeep Holla , Lorenzo Pieralisi , Linus Walleij Subject: Re: [PATCH v2 4/5] arm64: Add support for SMCCC TRNG entropy source Message-ID: <20201105144530.GK82102@C02TD0UTHF1T.local> References: <20201105125656.25259-1-andre.przywara@arm.com> <20201105125656.25259-5-andre.przywara@arm.com> <20201105134142.GA4856@sirena.org.uk> <20201105140322.GH82102@C02TD0UTHF1T.local> <20201105143023.GI82102@C02TD0UTHF1T.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 05, 2020 at 03:34:01PM +0100, Ard Biesheuvel wrote: > On Thu, 5 Nov 2020 at 15:30, Mark Rutland wrote: > > On Thu, Nov 05, 2020 at 03:04:57PM +0100, Ard Biesheuvel wrote: > > > On Thu, 5 Nov 2020 at 15:03, Mark Rutland wrote: > > > > > > That said, I'm not sure it's great to plumb this under the > > > > arch_get_random*() interfaces, e.g. given this measn that > > > > add_interrupt_randomness() will end up trapping to the host all the time > > > > when it calls arch_get_random_seed_long(). > > > > > > As it turns out, add_interrupt_randomness() isn't actually used on ARM. > > > > It's certainly called on arm64, per a warning I just hacked in: [...] > > ... and I couldn't immediately spot why 32-bit arm would be different. > > Hmm, I actually meant both arm64 and ARM. > > Marc looked into this at my request a while ago, and I had a look > myself as well at the time, and IIRC, we both concluded that we don't > hit that code path. Darn. > > In any case, the way add_interrupt_randomness() calls > arch_get_random_seed_long() is absolutely insane, so we should try to > fix that in any case. I have no strong opinion there, and I'm happy with that getting cleaned up. Regardless, I do think it's reasonable for the common code to expect that arch_get_random_*() to be roughly as expensive as "most other instructions" (since even RNDR* is expensive the CPU might be able to do useful speculative work in the mean time), whereas a trap to the host is always liable to be expensive as no useful work can be done while the host is handling it, so I think it makes sense to distinguish the two. Thanks, Mark.