From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Catalin Marinas <catalin.marinas@arm.com>
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
Date: Sun, 30 Oct 2022 22:07:53 +0100 [thread overview]
Message-ID: <Y17nqd27jHOkzeOp@zx2c4.com> (raw)
In-Reply-To: <Y160oanRPF3ZLINw@arm.com>
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
next prev parent reply other threads:[~2022-10-30 21:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-28 23:40 [PATCH] random: remove early archrandom abstraction Jason A. Donenfeld
2022-10-30 17:30 ` Catalin Marinas
2022-10-30 21:07 ` Jason A. Donenfeld [this message]
2022-10-30 21:21 ` [PATCH v2] " Jason A. Donenfeld
2022-10-31 10:28 ` [PATCH v3] " Jason A. Donenfeld
2022-11-01 11:39 ` Catalin Marinas
2022-11-01 11:54 ` Jason A. Donenfeld
2022-11-01 11:56 ` [PATCH v4] " Jason A. Donenfeld
2022-11-01 12:25 ` [PATCH v5] " Jason A. Donenfeld
2022-11-01 12:36 ` Mark Rutland
2022-11-01 13:02 ` Jason A. Donenfeld
2022-11-01 13:07 ` Mark Rutland
2022-11-01 14:05 ` Catalin Marinas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y17nqd27jHOkzeOp@zx2c4.com \
--to=jason@zx2c4.com \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=jean-philippe@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).