maillist inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I8PLUM?from=project-issue CVE: NA Reference: https://lore.kernel.org/all/1604317487-14543-2-git-send-email-sumit.garg@lin...
-------------------------------------------------
This patch adds CONFIG_IPI_AS_NMI to control the availability of pseudo NMIs, which follows upstream commit 41ddf73f9f7e (arm64: Add framework to turn IPI as NMI).
Signed-off-by: Sumit Garg sumit.garg@linaro.org Signed-off-by: Liao Chen liaochen4@huawei.com
Signed-off-by: Liao Chen liaochen4@huawei.com --- arch/arm64/Kconfig | 12 +++++++++++- arch/arm64/kernel/kgdb.c | 2 ++ arch/arm64/kernel/smp.c | 6 ++++++ include/linux/nmi.h | 2 +- 4 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 9568049f36e3..6275da6438ac 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -2242,9 +2242,19 @@ config ARM64_DEBUG_PRIORITY_MASKING If unsure, say N endif # ARM64_PSEUDO_NMI
+config IPI_AS_NMI + bool "Support ipi triggerred as pseudo nmi" + depends on ARM64_PSEUDO_NMI + default n + help + This adds support to trigger ipi as pseudo nmi, which allows to have an IPI + leveraged to invoke NMI functions on other CPUs. Current prospective users + are NMI backtrace and KGDB CPUs round-up whose support is added via future + patches. + config NON_NMI_IPI_BACKTRACE bool "Support non nmi ipi backtrace" - depends on ARM64_PSEUDO_NMI + depends on IPI_AS_NMI default n help This adds support for non nmi ipi backtrace, which allows hungtask_monitor diff --git a/arch/arm64/kernel/kgdb.c b/arch/arm64/kernel/kgdb.c index 98d8c1027f06..5d8b6efaab0e 100644 --- a/arch/arm64/kernel/kgdb.c +++ b/arch/arm64/kernel/kgdb.c @@ -358,6 +358,7 @@ int kgdb_arch_remove_breakpoint(struct kgdb_bkpt *bpt) *(u32 *)bpt->saved_instr); }
+#ifdef CONFIG_IPI_AS_NMI void kgdb_roundup_cpus(void) { struct cpumask mask; @@ -374,3 +375,4 @@ void kgdb_roundup_cpus(void)
arm64_send_nmi(&mask); } +#endif diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 8288549ca5f7..82c7f1524d15 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -937,7 +937,9 @@ static void ipi_setup(int cpu) for (i = 0; i < nr_ipi; i++) enable_percpu_irq(ipi_irq_base + i, 0);
+#ifdef CONFIG_IPI_AS_NMI dynamic_ipi_setup(cpu); +#endif }
#ifdef CONFIG_HOTPLUG_CPU @@ -951,7 +953,9 @@ static void ipi_teardown(int cpu) for (i = 0; i < nr_ipi; i++) disable_percpu_irq(ipi_irq_base + i);
+#ifdef CONFIG_IPI_AS_NMI dynamic_ipi_teardown(cpu); +#endif } #endif
@@ -973,8 +977,10 @@ void __init set_smp_ipi_range(int ipi_base, int n) irq_set_status_flags(ipi_base + i, IRQ_HIDDEN); }
+#ifdef CONFIG_IPI_AS_NMI if (n > nr_ipi) set_smp_dynamic_ipi(ipi_base + nr_ipi); +#endif
ipi_irq_base = ipi_base;
diff --git a/include/linux/nmi.h b/include/linux/nmi.h index 692f2759be55..787b3ca80bb0 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h @@ -154,7 +154,7 @@ static inline void touch_nmi_watchdog(void) * base function. Return whether such support was available, * to allow calling code to fall back to some other mechanism: */ -#ifdef arch_trigger_cpumask_backtrace +#if defined(arch_trigger_cpumask_backtrace) static inline bool trigger_all_cpu_backtrace(void) { return arch_trigger_cpumask_backtrace(cpu_online_mask, -1);