提交 a94fed6c 编写于 作者: X Xiongfeng Wang 提交者: Xie XiuQi

sdei_watchdog: refresh 'last_timestamp' when enabling nmi_watchdog

euler inclusion
category: feature
Bugzilla: 5515
CVE: N/A

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

The trigger period of secure time is set by firmware. We need to check
the time_stamp every time the secure time fires to make sure the
hardlockup detection is not executed too soon. We need to refresh
'last_timestamp' to the current time when we enable the nmi_watchdog.
Otherwise, false hardlockup may be detected when the secure timer fires
the first time.
Signed-off-by: NXiongfeng Wang <wangxiongfeng2@huawei.com>
Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 6174ecb5
...@@ -26,6 +26,8 @@ int watchdog_nmi_enable(unsigned int cpu) ...@@ -26,6 +26,8 @@ int watchdog_nmi_enable(unsigned int cpu)
{ {
int ret; int ret;
refresh_hld_last_timestamp();
ret = sdei_api_event_enable(sdei_watchdog_event_num); ret = sdei_api_event_enable(sdei_watchdog_event_num);
if (ret) { if (ret) {
pr_err("Enable NMI Watchdog failed on cpu%d\n", pr_err("Enable NMI Watchdog failed on cpu%d\n",
......
...@@ -204,6 +204,7 @@ u64 hw_nmi_get_sample_period(int watchdog_thresh); ...@@ -204,6 +204,7 @@ u64 hw_nmi_get_sample_period(int watchdog_thresh);
#if defined(CONFIG_HARDLOCKUP_CHECK_TIMESTAMP) && \ #if defined(CONFIG_HARDLOCKUP_CHECK_TIMESTAMP) && \
defined(CONFIG_HARDLOCKUP_DETECTOR) defined(CONFIG_HARDLOCKUP_DETECTOR)
void watchdog_update_hrtimer_threshold(u64 period); void watchdog_update_hrtimer_threshold(u64 period);
void refresh_hld_last_timestamp(void);
#else #else
static inline void watchdog_update_hrtimer_threshold(u64 period) { } static inline void watchdog_update_hrtimer_threshold(u64 period) { }
#endif #endif
......
...@@ -87,6 +87,15 @@ static bool watchdog_check_timestamp(void) ...@@ -87,6 +87,15 @@ static bool watchdog_check_timestamp(void)
__this_cpu_write(last_timestamp, now); __this_cpu_write(last_timestamp, now);
return true; return true;
} }
void refresh_hld_last_timestamp(void)
{
ktime_t now;
now = ktime_get_mono_fast_ns();
__this_cpu_write(last_timestamp, now);
}
#else #else
static inline bool watchdog_check_timestamp(void) static inline bool watchdog_check_timestamp(void)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册