提交 5bffbe21 编写于 作者: W Wei Li 提交者: Xie XiuQi

arm64: Add support for hard lockup by using pmu counter

hulk inclusion
category: feature
bugzilla: 12805
CVE: NA
-------------------------------------------------

This patch is based on "arm64: perf: add nmi support for pmu" patch series.
This feature is alternative to the SDEI NMI watchdog. As we can not get
the cpu frequency, kernel cmdline parameter hardlockup_cpu_freq=xxx (in KHZ)
need to be passed by user currently. If it is not be passed, the perf NMI
watchdog will be disabled defaultly.
Signed-off-by: NWei Li <liwei391@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 37125688
......@@ -138,6 +138,7 @@ config ARM64
select HAVE_NMI
select HAVE_PATA_PLATFORM
select HAVE_PERF_EVENTS
select HAVE_HARDLOCKUP_DETECTOR_PERF if PERF_EVENTS && HAVE_PERF_EVENTS_NMI
select HAVE_PERF_REGS
select HAVE_PERF_USER_STACK_DUMP
select HAVE_REGS_AND_STACK_ACCESS_API
......@@ -1201,6 +1202,7 @@ config ARM64_MODULE_PLTS
config ARM64_PSEUDO_NMI
bool "Support for NMI-like interrupts"
select CONFIG_ARM_GIC_V3
select HAVE_PERF_EVENTS_NMI
help
Adds support for mimicking Non-Maskable Interrupts through the use of
GIC interrupt priority. This support requires version 3 or later of
......
......@@ -1107,3 +1107,19 @@ void arch_trigger_cpumask_backtrace(const cpumask_t *mask, bool exclude_self)
{
nmi_trigger_cpumask_backtrace(mask, exclude_self, raise_nmi);
}
#ifdef CONFIG_HARDLOCKUP_DETECTOR_PERF
u64 hardlockup_cpu_freq;
static int __init hardlockup_cpu_freq_setup(char *str)
{
hardlockup_cpu_freq = simple_strtoull(str, NULL, 0);
return 1;
}
__setup("hardlockup_cpu_freq=", hardlockup_cpu_freq_setup);
u64 hw_nmi_get_sample_period(int watchdog_thresh)
{
return hardlockup_cpu_freq * 1000 * watchdog_thresh;
}
#endif
......@@ -186,6 +186,8 @@ static int hardlockup_detector_event_create(void)
wd_attr = &wd_hw_attr;
wd_attr->sample_period = hw_nmi_get_sample_period(watchdog_thresh);
if (!wd_attr->sample_period)
return -EINVAL;
/* Try to register using hardware perf events */
evt = perf_event_create_kernel_counter(wd_attr, cpu, NULL,
......
......@@ -837,7 +837,7 @@ config HARDLOCKUP_DETECTOR_PERF
config SDEI_WATCHDOG
bool "SDEI NMI Watchdog support"
depends on ARM_SDE_INTERFACE
depends on ARM_SDE_INTERFACE && !HAVE_HARDLOCKUP_DETECTOR_PERF
select HAVE_HARDLOCKUP_DETECTOR_ARCH
select HARDLOCKUP_CHECK_TIMESTAMP
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册