Thread (19 messages) 19 messages, 8 authors, 2019-09-19

Re: [PATCH v4 1/3] arm64: cpufeature: introduce helper cpu_has_hw_af()

From: Catalin Marinas <catalin.marinas@arm.com>
Date: 2019-09-18 16:49:32
Also in: linux-mm, lkml

On Wed, Sep 18, 2019 at 07:20:17AM -0700, Matthew Wilcox wrote:
On Wed, Sep 18, 2019 at 09:19:12PM +0800, Jia He wrote:
quoted
+/* Decouple AF from AFDBM. */
+bool cpu_has_hw_af(void)
+{
+	return (read_cpuid(ID_AA64MMFR1_EL1) & 0xf);
+}
+
Do you really want to call read_cpuid() every time?  I would have thought
you'd want to use the static branch mechanism to do the right thing at
boot time.  See Documentation/static-keys.txt.
We do have a static branch mechanism for other CPU features but mostly
because on some big.LITTLE systems, the CPUs may differ slightly so we
only advertise the common features.

I guess here the additional instructions for reading and checking the
CPUID here would be lost in the noise compared to the actual page
copying.

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help