Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp541576pxb; Thu, 5 Nov 2020 06:50:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJzX1LdrI16z00DK+kX5kli227jFoFutGzyq++6vj66xk1DSR5qf2uaUkgOFIQYoHzvv/gSk X-Received: by 2002:a05:6402:185:: with SMTP id r5mr2942824edv.263.1604587846342; Thu, 05 Nov 2020 06:50:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604587846; cv=none; d=google.com; s=arc-20160816; b=W1LOom9AbyCclZCD4nTiDJGhzg2C7ckERyM3SGeKPeAGm8A8YOX69h0z2CgKXOKx5Q f3BldW3JG0g6ue5AJRASn2X3yB/bOnfeqpQSHVr7b6Io24gmIwFBe2SO518VeJM//4JR Ug6zhtYe8qeFxCrUoY5oM2R1DperR339V9N2B/O4PL37lmSzx9CiOGbuwV4dbJpiPGki X8FOVIG+T3dfUqc89yPbZKS5UPoGZTV9ytllfQzRy0643+DMdPNEhmxfsAOiwjcmOQR8 76L4imcafV5GlMChL2YCcnhlwoNIp2AAmP8QBD5F+VKFNslSFyo2VJNrpBEKMilaAVGb J7Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :dkim-signature; bh=Jza3LFi5C+D+pGeAPg3GqRip70q/t8B/Jlq6FRwC6do=; b=HieSEDNZOz+k4DLy1Vhr1p+9WsUn5RAuvRUxzY2hnnIRz0pSIE3dq5iVz/1DS1g0f5 h6NjhOUZdbhoGxr2nNLS6xXju3uTnmy5GxHPiu6zc6+Cczb3i+0NuHibU67AcY2QGxyL 9bu6kg6M5Ot9CJ9rxnC3gVhGZF+63vtb3MxXAKAOncrpBhBS2ZKcjN9yR/DO78QSepTM meuwKxaOubdR0EXYNfjygM3x34pJmB7G7n3LOs4xDe0Oa8UN7F8j589KPjvs+S4Zsdyf dV9QJFwxNTdeJfVvfK0vMBEhgUzk3t/N3cHfuPc7U3gBT4PEsj5rk2MCZ31UQb228KnS 6yJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SwaEFeS+; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bt13si1329123ejb.259.2020.11.05.06.50.23; Thu, 05 Nov 2020 06:50:46 -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; dkim=pass header.i=@kernel.org header.s=default header.b=SwaEFeS+; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731371AbgKEOsa (ORCPT + 99 others); Thu, 5 Nov 2020 09:48:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:51264 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731220AbgKEOsJ (ORCPT ); Thu, 5 Nov 2020 09:48:09 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 717DC21D81; Thu, 5 Nov 2020 14:48:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604587688; bh=aHz4dg7WvhycQghc/La8ISUG6i/rU5i6Rmao6nbknIc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=SwaEFeS+xnZtw2fBfjfhj3u9SrgDRnAxU2/QyxDE/+rSe2OURcAaVWM+rv5INV0/r lxDTWGoYAk/az/cxpm9OB7zrj+ToJV+AOHYmTshevTuOB5AvPnj+lkFvguzR3EBEnM 82Ie209vhHCEtuJ5C0r1OEuO6KIhvp7BfAz+ExoE= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1kagYY-007rTY-8w; Thu, 05 Nov 2020 14:48:06 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 05 Nov 2020 14:48:06 +0000 From: Marc Zyngier To: Ard Biesheuvel Cc: Mark Rutland , 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 In-Reply-To: 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> User-Agent: Roundcube Webmail/1.4.9 Message-ID: <299b7ec794a5f114757078b3eb1bbb8c@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: ardb@kernel.org, mark.rutland@arm.com, broonie@kernel.org, andre.przywara@arm.com, will@kernel.org, catalin.marinas@arm.com, linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, sudeep.holla@arm.com, lorenzo.pieralisi@arm.com, linus.walleij@linaro.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-11-05 14:34, 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: >> > > On Thu, Nov 05, 2020 at 01:41:42PM +0000, Mark Brown wrote: >> > > > On Thu, Nov 05, 2020 at 12:56:55PM +0000, Andre Przywara 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: >> >> [ 1.083802] ------------[ cut here ]------------ >> [ 1.084802] add_interrupt_randomness called >> [ 1.085685] WARNING: CPU: 1 PID: 0 at drivers/char/random.c:1267 >> add_interrupt_randomness+0x2e8/0x318 >> [ 1.087599] Modules linked in: >> [ 1.088258] CPU: 1 PID: 0 Comm: swapper/1 Not tainted >> 5.10.0-rc2-dirty #13 >> [ 1.089672] Hardware name: linux,dummy-virt (DT) >> [ 1.090659] pstate: 60400085 (nZCv daIf +PAN -UAO -TCO BTYPE=--) >> [ 1.091910] pc : add_interrupt_randomness+0x2e8/0x318 >> [ 1.092965] lr : add_interrupt_randomness+0x2e8/0x318 >> [ 1.094021] sp : ffff80001000be80 >> [ 1.094732] x29: ffff80001000be80 x28: ffff2d0c80209840 >> [ 1.095859] x27: 00000000137c3e3a x26: ffff8000100abdd0 >> [ 1.096978] x25: 0000000000000035 x24: ffff67918bda8000 >> [ 1.098100] x23: ffffc57c31923fe8 x22: 00000000fffedc14 >> [ 1.099224] x21: ffff2d0dbef796a0 x20: ffffc57c331d16a0 >> [ 1.100339] x19: ffffc57c33720a48 x18: 0000000000000010 >> [ 1.101459] x17: 0000000000000000 x16: 0000000000000002 >> [ 1.102578] x15: 00000000000000e7 x14: ffff80001000bb20 >> [ 1.103706] x13: 00000000ffffffea x12: ffffc57c337b56e8 >> [ 1.104821] x11: 0000000000000003 x10: ffffc57c3379d6a8 >> [ 1.105944] x9 : ffffc57c3379d700 x8 : 0000000000017fe8 >> [ 1.107073] x7 : c0000000ffffefff x6 : 0000000000000001 >> [ 1.108186] x5 : 0000000000057fa8 x4 : 0000000000000000 >> [ 1.109305] x3 : 00000000ffffffff x2 : ffffc57c337455d0 >> [ 1.110428] x1 : db8dc9c2a1e0f600 x0 : 0000000000000000 >> [ 1.111552] Call trace: >> [ 1.112083] add_interrupt_randomness+0x2e8/0x318 >> [ 1.113074] handle_irq_event_percpu+0x48/0x90 >> [ 1.114016] handle_irq_event+0x48/0xf8 >> [ 1.114826] handle_fasteoi_irq+0xa4/0x130 >> [ 1.115689] generic_handle_irq+0x30/0x48 >> [ 1.116528] __handle_domain_irq+0x64/0xc0 >> [ 1.117392] gic_handle_irq+0xc0/0x138 >> [ 1.118194] el1_irq+0xbc/0x180 >> [ 1.118870] arch_cpu_idle+0x20/0x30 >> [ 1.119630] default_idle_call+0x8c/0x350 >> [ 1.120479] do_idle+0x224/0x298 >> [ 1.121163] cpu_startup_entry+0x28/0x70 >> [ 1.121994] secondary_start_kernel+0x184/0x198 >> >> ... 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. Yes, I remember checking this. Obviously, I need a new pair of glasses... M. -- Jazz is not dead. It just smells funny...