Re: [PATCH 3/6] arm64: HWCAP: encapsulate elf_hwcap
From: Andrew Murray <hidden>
Date: 2019-02-18 15:47:08
On Thu, Feb 07, 2019 at 11:47:59AM +0000, Dave Martin wrote:
On Wed, Feb 06, 2019 at 01:31:05PM +0000, Andrew Murray wrote:quoted
The introduction of elf_hwcap2 introduced accessors which ensure that features are set/tested in the appropriate elf_hwcapX variable. Let's now mandate access to elf_hwcapX via these accessors by making elf_hwcapX static within cpufeature.c. Signed-off-by: Andrew Murray <redacted> --- arch/arm64/include/asm/cpufeature.h | 19 ++++--------------- arch/arm64/include/asm/hwcap.h | 6 +++--- arch/arm64/kernel/cpufeature.c | 33 ++++++++++++++++++++++++++++----- 3 files changed, 35 insertions(+), 23 deletions(-)[...]quoted
diff --git a/arch/arm64/include/asm/hwcap.h b/arch/arm64/include/asm/hwcap.h index 05ee9b9..ced87ad 100644 --- a/arch/arm64/include/asm/hwcap.h +++ b/arch/arm64/include/asm/hwcap.h[...]quoted
@@ -97,6 +98,5 @@ enum { #endif }; -extern unsigned long elf_hwcap, elf_hwcap2; #endif #endifdiff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index d10a455..5b9620d 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c@@ -35,11 +35,8 @@ #include <asm/traps.h> #include <asm/virt.h> -unsigned long elf_hwcap __read_mostly; -EXPORT_SYMBOL_GPL(elf_hwcap); -Will this affect out-of-tree modules? I also note an out-of-arch/ use in drivers/clocksource/arm_arch_timer.c, which this series doesn't appear to address (or I missed it).
It was in "arm64: HWCAP: add support for ELF_HWCAP2" - though due to it being used by arm32 code I had to use #ifdef CONFIG_ARM64 as cpu_set_feature doesn't exist there.
We are allowed to break EXPORT_SYMBOL_GPL()s in general so long as it's not done without any meaningful reason, so maybe this is not a huge concern so long as we catch all the in-tree users.
The benefit of removing the EXPORT_SYMBOL_GPL is that we can encapsulate
the elf_hwcap variables with getters/setters that ensure they are modified
correctly. This is only relevant now as we split bits between elf_hwcap and
elf_hwcap2.
My suggestion is to remove the EXPORT_SYMBOL_GPL and then also stick with
using just one elf_hwcap variable. As you previously suggested we can then
update the ELF_HWCAP{,2} marcos to produce the relevant bit fields. This
also has the added benefit of simplifying cpu_{have,set}_feature functions
as the number of hwcaps grow.
Thanks,
Andrew Murray
[...] Cheers ---Dave
_______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel