Commit 3cd0ed4c authored by Dong Kai's avatar Dong Kai Committed by Zheng Zengkai
Browse files

corelockup: Add detector enable support by cmdline

ascend inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4F3V1


CVE: NA

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

Add cmdline params "enable_corelockup_detector" to support enable
core suspend detector. And enable defaultly within ascend features.

Signed-off-by: default avatarDong Kai <dongkai11@huawei.com>
Reviewed-by: default avatarKuohai Xu <xukuohai@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: default avatarDing Tianhong <dingtianhong@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: default avatarDing Tianhong <dingtianhong@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent d5a265a1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -131,6 +131,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);
+8 −4
Original line number Diff line number Diff line
@@ -366,6 +366,7 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)

#ifdef CONFIG_CORELOCKUP_DETECTOR
	/* check hrtimer of detector cpu */
	if (enable_corelockup_detector)
		watchdog_check_hrtimer();
#endif

@@ -531,6 +532,7 @@ int lockup_detector_online_cpu(unsigned int cpu)
	if (cpumask_test_cpu(cpu, &watchdog_allowed_mask)) {
		watchdog_enable(cpu);
#ifdef CONFIG_CORELOCKUP_DETECTOR
		if (enable_corelockup_detector)
			corelockup_detector_online_cpu(cpu);
#endif
	}
@@ -542,6 +544,7 @@ int lockup_detector_offline_cpu(unsigned int cpu)
	if (cpumask_test_cpu(cpu, &watchdog_allowed_mask)) {
		watchdog_disable(cpu);
#ifdef CONFIG_CORELOCKUP_DETECTOR
		if (enable_corelockup_detector)
			corelockup_detector_offline_cpu(cpu);
#endif
	}
@@ -775,6 +778,7 @@ void __init lockup_detector_init(void)
		nmi_watchdog_available = true;
	lockup_detector_setup();
#ifdef CONFIG_CORELOCKUP_DETECTOR
	if (enable_corelockup_detector)
		corelockup_detector_init();
#endif
}
+14 −4
Original line number Diff line number Diff line
@@ -93,6 +93,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)
{
@@ -326,11 +334,13 @@ static inline bool watchdog_check_timestamp(void)
void watchdog_hardlockup_check(struct pt_regs *regs)
{
#ifdef CONFIG_CORELOCKUP_DETECTOR
	if (enable_corelockup_detector) {
		/* Kick nmi interrupts */
		watchdog_nmi_interrupts();

		/* corelockup check */
		watchdog_corelockup_check(regs);
	}
#endif

	if (__this_cpu_read(watchdog_nmi_touch) == true) {