提交 13ddc127 编写于 作者: X Xiongfeng Wang 提交者: Zheng Zengkai

sdei_watchdog: set secure timer period base on 'watchdog_thresh'

hulk inclusion
category: feature
bugzilla: 48046
CVE: NA

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

The period of the secure timer is set to 3s by BIOS. That means the
secure timer interrupt will trigger every 3 seconds. To further decrease
the NMI watchdog's effect on performance, this patch set the period of
the secure timer base on 'watchdog_thresh'. This variable is initiallized
to 10s. We can also set the period at runtime by modifying
'/proc/sys/kernel/watchdog_thresh'
Signed-off-by: NXiongfeng Wang <wangxiongfeng2@huawei.com>
Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NXiongfeng Wang <wangxiongfeng2@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 75ac7be9
......@@ -30,7 +30,11 @@ int watchdog_nmi_enable(unsigned int cpu)
if (!sdei_watchdog_registered)
return -EINVAL;
#ifdef CONFIG_HARDLOCKUP_CHECK_TIMESTAMP
refresh_hld_last_timestamp();
#endif
sdei_api_set_secure_timer_period(watchdog_thresh);
ret = sdei_api_event_enable(sdei_watchdog_event_num);
if (ret) {
......@@ -104,6 +108,17 @@ int __init watchdog_nmi_probe(void)
return sdei_watchdog_event_num;
}
/*
* After we introduced 'sdei_api_set_secure_timer_period', we disselect
* 'CONFIG_HARDLOCKUP_CHECK_TIMESTAMP'. So we need to make sure that
* firmware can set the period of the secure timer and the timer
* interrupt doesn't trigger too soon.
*/
if (sdei_api_set_secure_timer_period(watchdog_thresh)) {
pr_err("Firmware doesn't support setting the secure timer period, please update your BIOS !\n");
return -EINVAL;
}
on_each_cpu(sdei_nmi_watchdog_bind, NULL, true);
ret = sdei_event_register(sdei_watchdog_event_num,
......
......@@ -203,6 +203,12 @@ int sdei_api_clear_eoi(int hwirq)
NULL);
}
int sdei_api_set_secure_timer_period(int sec)
{
return invoke_sdei_fn(SDEI_1_0_FN_SET_SECURE_TIMER_PERIOD, sec, 0, 0, 0,
0, NULL);
}
static int sdei_api_event_get_info(u32 event, u32 info, u64 *result)
{
return invoke_sdei_fn(SDEI_1_0_FN_SDEI_EVENT_GET_INFO, event, info, 0,
......
......@@ -40,6 +40,7 @@ int sdei_api_event_interrupt_bind(int hwirq);
int sdei_api_event_disable(u32 event_num);
int sdei_api_event_enable(u32 event_num);
int sdei_api_clear_eoi(int hwirq);
int sdei_api_set_secure_timer_period(int sec);
/* GHES register/unregister helpers */
int sdei_register_ghes(struct ghes *ghes, sdei_event_callback *normal_cb,
......
......@@ -25,6 +25,7 @@
#define SDEI_1_0_FN_SDEI_PRIVATE_RESET SDEI_1_0_FN(0x11)
#define SDEI_1_0_FN_SDEI_SHARED_RESET SDEI_1_0_FN(0x12)
#define SDEI_1_0_FN_SDEI_CLEAR_EOI SDEI_1_0_FN(0x18)
#define SDEI_1_0_FN_SET_SECURE_TIMER_PERIOD SDEI_1_0_FN(0x19)
#define SDEI_VERSION_MAJOR_SHIFT 48
#define SDEI_VERSION_MAJOR_MASK 0x7fff
......
......@@ -968,7 +968,6 @@ config SDEI_WATCHDOG
bool "SDEI NMI Watchdog support"
depends on ARM_SDE_INTERFACE
select HAVE_HARDLOCKUP_DETECTOR_ARCH
select HARDLOCKUP_CHECK_TIMESTAMP
select HARDLOCKUP_DETECTOR
#
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册