diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 55fc6a020679622e044ea885a8b5adf27b02efb8..8cdf92626c2c6c6986192b52978fe89a52a26692 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -938,6 +938,9 @@ __setup("keepinitrd", keepinitrd_setup); #ifdef CONFIG_ASCEND_FEATURES #include <linux/perf/arm_pmu.h> +#ifdef CONFIG_CORELOCKUP_DETECTOR +#include <linux/nmi.h> +#endif void ascend_enable_all_features(void) { @@ -970,6 +973,10 @@ void ascend_enable_all_features(void) #ifdef CONFIG_ARM64_PSEUDO_NMI enable_pseudo_nmi = true; #endif + +#ifdef CONFIG_CORELOCKUP_DETECTOR + enable_corelockup_detector = true; +#endif } static int __init ascend_enable_setup(char *__unused) diff --git a/include/linux/nmi.h b/include/linux/nmi.h index 6cfb36e889fa4fcf1039e115bf8c20e03f58a5ab..2acb9195947a90e9d5cbe2df1298fba4cb0b444d 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h @@ -130,6 +130,7 @@ extern void corelockup_detector_online_cpu(unsigned int cpu); extern void corelockup_detector_offline_cpu(unsigned int cpu); extern void watchdog_check_hrtimer(void); extern unsigned long watchdog_hrtimer_interrupts(unsigned int cpu); +extern bool enable_corelockup_detector; #endif void watchdog_nmi_stop(void); diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 9cea1ef8b41bc1090b255468175ceaee011ab617..463c4c11cecbad60f43c8d492bc4bf93de924ad6 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -375,7 +375,8 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer) #ifdef CONFIG_CORELOCKUP_DETECTOR /* check hrtimer of detector cpu */ - watchdog_check_hrtimer(); + if (enable_corelockup_detector) + watchdog_check_hrtimer(); #endif /* kick the hardlockup detector */ @@ -566,7 +567,8 @@ int lockup_detector_online_cpu(unsigned int cpu) if (cpumask_test_cpu(cpu, &watchdog_allowed_mask)) { watchdog_enable(cpu); #ifdef CONFIG_CORELOCKUP_DETECTOR - corelockup_detector_online_cpu(cpu); + if (enable_corelockup_detector) + corelockup_detector_online_cpu(cpu); #endif } return 0; @@ -577,7 +579,8 @@ int lockup_detector_offline_cpu(unsigned int cpu) if (cpumask_test_cpu(cpu, &watchdog_allowed_mask)) { watchdog_disable(cpu); #ifdef CONFIG_CORELOCKUP_DETECTOR - corelockup_detector_offline_cpu(cpu); + if (enable_corelockup_detector) + corelockup_detector_offline_cpu(cpu); #endif } return 0; @@ -804,6 +807,7 @@ void __init lockup_detector_init(void) nmi_watchdog_available = true; lockup_detector_setup(); #ifdef CONFIG_CORELOCKUP_DETECTOR - corelockup_detector_init(); + if (enable_corelockup_detector) + corelockup_detector_init(); #endif } diff --git a/kernel/watchdog_hld.c b/kernel/watchdog_hld.c index 58d7acec4269d3e699f71971c086ee68915f61e3..51ffc8f90520d3ed0efa9867437bfe3349254541 100644 --- a/kernel/watchdog_hld.c +++ b/kernel/watchdog_hld.c @@ -91,6 +91,14 @@ static DEFINE_PER_CPU(unsigned long, hrint_missed); struct cpumask corelockup_cpumask __read_mostly; unsigned int close_wfi_wfe; static bool pmu_based_nmi; +bool enable_corelockup_detector; + +static int __init enable_corelockup_detector_setup(char *str) +{ + enable_corelockup_detector = true; + return 1; +} +__setup("enable_corelockup_detector", enable_corelockup_detector_setup); static void watchdog_nmi_interrupts(void) { @@ -324,11 +332,13 @@ static inline bool watchdog_check_timestamp(void) void watchdog_hardlockup_check(struct pt_regs *regs) { #ifdef CONFIG_CORELOCKUP_DETECTOR - /* Kick nmi interrupts */ - watchdog_nmi_interrupts(); + if (enable_corelockup_detector) { + /* Kick nmi interrupts */ + watchdog_nmi_interrupts(); - /* corelockup check */ - watchdog_corelockup_check(regs); + /* corelockup check */ + watchdog_corelockup_check(regs); + } #endif if (__this_cpu_read(watchdog_nmi_touch) == true) {