Unverified Commit f066d369 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!4427 【OLK-6.6】watchdog: Support watchdog_sdei coexist with existing watchdogs

Merge Pull Request from: @liujie-248683921 
 
Currently we cannot use watchdog_{perf, buddy} if CONFIG_SDEI_WATCHDOG=y.
Not all the platforms has watchdog_sdei so this patch tries to make
watchdog_sdei coexist with other watchdogs.

Only one watchdog will finally works. By default watchdog_sdei
will be used. If boot with "disable_sdei_nmi_watchdog", other
watchdogs will be used if probed. 
 
Link:https://gitee.com/openeuler/kernel/pulls/4427

 

Reviewed-by: default avatarZhang Jianhua <chris.zjh@huawei.com>
Reviewed-by: default avatarXu Kuohai <xukuohai@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parents f7dad4da f61b1153
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ bool disable_sdei_nmi_watchdog;
static bool sdei_watchdog_registered;
static DEFINE_PER_CPU(ktime_t, last_check_time);

void watchdog_hardlockup_enable(unsigned int cpu)
void sdei_watchdog_hardlockup_enable(unsigned int cpu)
{
	int ret;

@@ -45,7 +45,7 @@ void watchdog_hardlockup_enable(unsigned int cpu)
	}
}

void watchdog_hardlockup_disable(unsigned int cpu)
void sdei_watchdog_hardlockup_disable(unsigned int cpu)
{
	int ret;

@@ -106,7 +106,7 @@ void sdei_watchdog_clear_eoi(void)
		sdei_api_clear_eoi(SDEI_NMI_WATCHDOG_HWIRQ);
}

int __init watchdog_hardlockup_probe(void)
int __init sdei_watchdog_hardlockup_probe(void)
{
	int ret;

+6 −0
Original line number Diff line number Diff line
@@ -232,10 +232,16 @@ static inline void nmi_backtrace_stall_check(const struct cpumask *btp) {}
#endif

#ifdef CONFIG_SDEI_WATCHDOG
void sdei_watchdog_hardlockup_enable(unsigned int cpu);
void sdei_watchdog_hardlockup_disable(unsigned int cpu);
void sdei_watchdog_clear_eoi(void);
int sdei_watchdog_hardlockup_probe(void);
extern bool disable_sdei_nmi_watchdog;
#else
static inline void sdei_watchdog_hardlockup_enable(unsigned int cpu) { }
static inline void sdei_watchdog_hardlockup_disable(unsigned int cpu) { }
static inline void sdei_watchdog_clear_eoi(void) { }
static inline int sdei_watchdog_hardlockup_probe(void) { return -ENODEV; }
#define disable_sdei_nmi_watchdog 1
#endif

+12 −4
Original line number Diff line number Diff line
@@ -562,8 +562,12 @@ static void watchdog_enable(unsigned int cpu)
	/* Initialize timestamp */
	update_touch_ts();
	/* Enable the hardlockup detector */
	if (watchdog_enabled & WATCHDOG_HARDLOCKUP_ENABLED)
	if (watchdog_enabled & WATCHDOG_HARDLOCKUP_ENABLED) {
		if (disable_sdei_nmi_watchdog)
			watchdog_hardlockup_enable(cpu);
		else
			sdei_watchdog_hardlockup_enable(cpu);
	}
}

static void watchdog_disable(unsigned int cpu)
@@ -577,7 +581,10 @@ static void watchdog_disable(unsigned int cpu)
	 * delay between disabling the timer and disabling the hardlockup
	 * detector causes a false positive.
	 */
	if (disable_sdei_nmi_watchdog)
		watchdog_hardlockup_disable(cpu);
	else
		sdei_watchdog_hardlockup_disable(cpu);
	hrtimer_cancel(hrtimer);
	wait_for_completion(this_cpu_ptr(&softlockup_completion));
}
@@ -1022,7 +1029,8 @@ void __init lockup_detector_init(void)
	cpumask_copy(&watchdog_cpumask,
		     housekeeping_cpumask(HK_TYPE_TIMER));

	if (!watchdog_hardlockup_probe())
	if ((!disable_sdei_nmi_watchdog && !sdei_watchdog_hardlockup_probe()) ||
	    !watchdog_hardlockup_probe())
		watchdog_hardlockup_available = true;
	else
		allow_lockup_detector_init_retry = true;
+0 −2
Original line number Diff line number Diff line
@@ -1117,7 +1117,6 @@ config HARDLOCKUP_DETECTOR_PERF
	depends on HARDLOCKUP_DETECTOR
	depends on HAVE_HARDLOCKUP_DETECTOR_PERF && !HARDLOCKUP_DETECTOR_PREFER_BUDDY
	depends on !HAVE_HARDLOCKUP_DETECTOR_ARCH
	depends on !SDEI_WATCHDOG
	select HARDLOCKUP_DETECTOR_COUNTS_HRTIMER

config HARDLOCKUP_DETECTOR_BUDDY
@@ -1126,7 +1125,6 @@ config HARDLOCKUP_DETECTOR_BUDDY
	depends on HAVE_HARDLOCKUP_DETECTOR_BUDDY
	depends on !HAVE_HARDLOCKUP_DETECTOR_PERF || HARDLOCKUP_DETECTOR_PREFER_BUDDY
	depends on !HAVE_HARDLOCKUP_DETECTOR_ARCH
	depends on !SDEI_WATCHDOG
	select HARDLOCKUP_DETECTOR_COUNTS_HRTIMER

config HARDLOCKUP_DETECTOR_ARCH