Commit dd8409a9 authored by Xu Qiang's avatar Xu Qiang Committed by Zheng Zengkai
Browse files

watchdog/corelockup: Add interface to control the detection sensitivity.

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


CVE: NA

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

A user-mode interface is added to control the core lockup
detection sensitivity.

Signed-off-by: default avatarXu Qiang <xuqiang36@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 ec6b79f6
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -132,6 +132,7 @@ 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;
extern int corelockup_miss_thresh;
#endif

void watchdog_nmi_stop(void);
+13 −0
Original line number Diff line number Diff line
@@ -113,7 +113,9 @@ static int sixty = 60;

static int __maybe_unused neg_one = -1;
static int __maybe_unused two = 2;
static int __maybe_unused three = 3;
static int __maybe_unused four = 4;
static int __maybe_unused five = 5;
static unsigned long zero_ul;
static unsigned long one_ul = 1;
static unsigned long long_max = LONG_MAX;
@@ -2405,6 +2407,17 @@ static struct ctl_table kern_table[] = {
	},
#endif /* CONFIG_SMP */
#endif
#ifdef CONFIG_CORELOCKUP_DETECTOR
	{
		.procname	= "corelockup_thresh",
		.data		= &corelockup_miss_thresh,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec_minmax,
		.extra1		= &three,
		.extra2		= &five,
	},
#endif
#endif

#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
+3 −1
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ static DEFINE_PER_CPU(unsigned long, hrint_saved);
static DEFINE_PER_CPU(unsigned long, hrint_missed);
static unsigned long corelockup_allcpu_dumped;
bool enable_corelockup_detector;
int __read_mostly corelockup_miss_thresh = 5;

static int __init enable_corelockup_detector_setup(char *str)
{
@@ -169,7 +170,8 @@ void watchdog_check_hrtimer(void)
	}
	__this_cpu_inc(nmi_cnt_missed);

	if ((__this_cpu_read(hrint_missed) > 5) && (__this_cpu_read(nmi_cnt_missed) > 5)) {
	if ((__this_cpu_read(hrint_missed) > corelockup_miss_thresh)
		 && (__this_cpu_read(nmi_cnt_missed) > corelockup_miss_thresh)) {
		pr_emerg("Watchdog detected core LOCKUP on cpu %d\n", cpu);

		if (!test_and_set_bit(0, &corelockup_allcpu_dumped)) {