提交 9f3da01c 编写于 作者: D Dong Kai 提交者: Zheng Zengkai

corelockup: Add detector enable support by cmdline

ascend inclusion
category: feature
bugzilla: NA
CVE: NA

--------------------------------

Add cmdline params "enable_corelockup_detector" to support enable
core suspend detector. And enable defaultly within ascend features.
Signed-off-by: NDong Kai <dongkai11@huawei.com>
Reviewed-by: NKuohai Xu <xukuohai@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 5f4fa08a
...@@ -771,6 +771,9 @@ __setup("keepinitrd", keepinitrd_setup); ...@@ -771,6 +771,9 @@ __setup("keepinitrd", keepinitrd_setup);
#ifdef CONFIG_ASCEND_FEATURES #ifdef CONFIG_ASCEND_FEATURES
#include <linux/perf/arm_pmu.h> #include <linux/perf/arm_pmu.h>
#ifdef CONFIG_CORELOCKUP_DETECTOR
#include <linux/nmi.h>
#endif
void ascend_enable_all_features(void) void ascend_enable_all_features(void)
{ {
...@@ -797,6 +800,10 @@ void ascend_enable_all_features(void) ...@@ -797,6 +800,10 @@ void ascend_enable_all_features(void)
#ifdef CONFIG_ARM64_PSEUDO_NMI #ifdef CONFIG_ARM64_PSEUDO_NMI
enable_pseudo_nmi = true; enable_pseudo_nmi = true;
#endif #endif
#ifdef CONFIG_CORELOCKUP_DETECTOR
enable_corelockup_detector = true;
#endif
} }
static int __init ascend_enable_setup(char *__unused) static int __init ascend_enable_setup(char *__unused)
......
...@@ -111,6 +111,7 @@ extern void hardlockup_detector_perf_disable(void); ...@@ -111,6 +111,7 @@ extern void hardlockup_detector_perf_disable(void);
extern void hardlockup_detector_perf_enable(void); extern void hardlockup_detector_perf_enable(void);
extern void hardlockup_detector_perf_cleanup(void); extern void hardlockup_detector_perf_cleanup(void);
extern int hardlockup_detector_perf_init(void); extern int hardlockup_detector_perf_init(void);
extern bool enable_corelockup_detector;
#else #else
static inline void hardlockup_detector_perf_stop(void) { } static inline void hardlockup_detector_perf_stop(void) { }
static inline void hardlockup_detector_perf_restart(void) { } static inline void hardlockup_detector_perf_restart(void) { }
......
...@@ -384,7 +384,8 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer) ...@@ -384,7 +384,8 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
#ifdef CONFIG_CORELOCKUP_DETECTOR #ifdef CONFIG_CORELOCKUP_DETECTOR
/* check hrtimer of detector cpu */ /* check hrtimer of detector cpu */
watchdog_check_hrtimer(); if (enable_corelockup_detector)
watchdog_check_hrtimer();
#endif #endif
/* kick the hardlockup detector */ /* kick the hardlockup detector */
...@@ -575,7 +576,8 @@ int lockup_detector_online_cpu(unsigned int cpu) ...@@ -575,7 +576,8 @@ int lockup_detector_online_cpu(unsigned int cpu)
if (cpumask_test_cpu(cpu, &watchdog_allowed_mask)) { if (cpumask_test_cpu(cpu, &watchdog_allowed_mask)) {
watchdog_enable(cpu); watchdog_enable(cpu);
#ifdef CONFIG_CORELOCKUP_DETECTOR #ifdef CONFIG_CORELOCKUP_DETECTOR
corelockup_detector_online_cpu(cpu); if (enable_corelockup_detector)
corelockup_detector_online_cpu(cpu);
#endif #endif
} }
return 0; return 0;
...@@ -586,7 +588,8 @@ int lockup_detector_offline_cpu(unsigned int cpu) ...@@ -586,7 +588,8 @@ int lockup_detector_offline_cpu(unsigned int cpu)
if (cpumask_test_cpu(cpu, &watchdog_allowed_mask)) { if (cpumask_test_cpu(cpu, &watchdog_allowed_mask)) {
watchdog_disable(cpu); watchdog_disable(cpu);
#ifdef CONFIG_CORELOCKUP_DETECTOR #ifdef CONFIG_CORELOCKUP_DETECTOR
corelockup_detector_offline_cpu(cpu); if (enable_corelockup_detector)
corelockup_detector_offline_cpu(cpu);
#endif #endif
} }
return 0; return 0;
...@@ -819,6 +822,7 @@ void __init lockup_detector_init(void) ...@@ -819,6 +822,7 @@ void __init lockup_detector_init(void)
nmi_watchdog_available = true; nmi_watchdog_available = true;
lockup_detector_setup(); lockup_detector_setup();
#ifdef CONFIG_CORELOCKUP_DETECTOR #ifdef CONFIG_CORELOCKUP_DETECTOR
corelockup_detector_init(); if (enable_corelockup_detector)
corelockup_detector_init();
#endif #endif
} }
...@@ -91,6 +91,14 @@ static DEFINE_PER_CPU(unsigned long, hrint_missed); ...@@ -91,6 +91,14 @@ static DEFINE_PER_CPU(unsigned long, hrint_missed);
struct cpumask corelockup_cpumask __read_mostly; struct cpumask corelockup_cpumask __read_mostly;
unsigned int close_wfi_wfe; unsigned int close_wfi_wfe;
static bool pmu_based_nmi; 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) static void watchdog_nmi_interrupts(void)
{ {
...@@ -324,11 +332,13 @@ static inline bool watchdog_check_timestamp(void) ...@@ -324,11 +332,13 @@ static inline bool watchdog_check_timestamp(void)
void watchdog_hardlockup_check(struct pt_regs *regs) void watchdog_hardlockup_check(struct pt_regs *regs)
{ {
#ifdef CONFIG_CORELOCKUP_DETECTOR #ifdef CONFIG_CORELOCKUP_DETECTOR
/* Kick nmi interrupts */ if (enable_corelockup_detector) {
watchdog_nmi_interrupts(); /* Kick nmi interrupts */
watchdog_nmi_interrupts();
/* corelockup check */ /* corelockup check */
watchdog_corelockup_check(regs); watchdog_corelockup_check(regs);
}
#endif #endif
if (__this_cpu_read(watchdog_nmi_touch) == true) { if (__this_cpu_read(watchdog_nmi_touch) == true) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册