summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2016-07-23 14:42:43 +0530
committerMichael Ellerman <mpe@ellerman.id.au>2016-08-01 11:15:06 +1000
commitc812c7d8f1470ac9c8aa6d7e29b56e5845ee05fc (patch)
tree9df953d954d85946488f41cbd202865535805eb4 /arch/powerpc/include
parentc12e6f24d4137822d5019c1f78ac65bd27a3447d (diff)
downloadlinux-c812c7d8f1470ac9c8aa6d7e29b56e5845ee05fc.tar.bz2
powerpc/mm: Catch usage of cpu/mmu_has_feature() before jump label init
This allows us to catch incorrect usage of cpu_has_feature() and mmu_has_feature() prior to jump labels being initialised. mpe: Use printk() and dump_stack() rather than WARN_ON(), because WARN_ON() may not work this early in boot. Rename the Kconfig. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/include')
-rw-r--r--arch/powerpc/include/asm/cpu_has_feature.h8
-rw-r--r--arch/powerpc/include/asm/mmu.h8
2 files changed, 16 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/cpu_has_feature.h b/arch/powerpc/include/asm/cpu_has_feature.h
index 039c011b4252..2ef55f8968a2 100644
--- a/arch/powerpc/include/asm/cpu_has_feature.h
+++ b/arch/powerpc/include/asm/cpu_has_feature.h
@@ -25,6 +25,14 @@ static __always_inline bool cpu_has_feature(unsigned long feature)
BUILD_BUG_ON(!__builtin_constant_p(feature));
+#ifdef CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG
+ if (!static_key_initialized) {
+ printk("Warning! cpu_has_feature() used prior to jump label init!\n");
+ dump_stack();
+ return early_cpu_has_feature(feature);
+ }
+#endif
+
if (CPU_FTRS_ALWAYS & feature)
return true;
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h
index 1bf919aafd50..e2fb408f8398 100644
--- a/arch/powerpc/include/asm/mmu.h
+++ b/arch/powerpc/include/asm/mmu.h
@@ -156,6 +156,14 @@ static __always_inline bool mmu_has_feature(unsigned long feature)
BUILD_BUG_ON(!__builtin_constant_p(feature));
+#ifdef CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG
+ if (!static_key_initialized) {
+ printk("Warning! mmu_has_feature() used prior to jump label init!\n");
+ dump_stack();
+ return early_mmu_has_feature(feature);
+ }
+#endif
+
if (!(MMU_FTRS_POSSIBLE & feature))
return false;