* [PATCH][v2] watchdog/hardlockup: reassign last_timestamp when enable nmi event
@ 2019-10-15 6:34 Li RongQing
2019-10-22 10:43 ` 答复: " Li,Rongqing
2019-11-07 10:53 ` Li,Rongqing
0 siblings, 2 replies; 5+ messages in thread
From: Li RongQing @ 2019-10-15 6:34 UTC (permalink / raw)
To: akpm, sergey.senozhatsky.work, linux-kernel, tglx, Kan.liang
last_timestamp is not initialized and is zero after boot, or stop
to forward when nmi watchdog is disabled; and false positives still
is possible when restart NMI timer after stopping 120 seconds
so reassign last_timestamp always when enable nmi event
Fixes: 7edaeb6841df ("kernel/watchdog: Prevent false positives with turbo modes")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
---
v1-->v2: make it be able to be compiled on no CONFIG_HARDLOCKUP_CHECK_TIMESTAMP platform
kernel/watchdog_hld.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/kernel/watchdog_hld.c b/kernel/watchdog_hld.c
index 247bf0b1582c..f14d18280387 100644
--- a/kernel/watchdog_hld.c
+++ b/kernel/watchdog_hld.c
@@ -91,11 +91,24 @@ static bool watchdog_check_timestamp(void)
__this_cpu_write(last_timestamp, now);
return true;
}
+
+static void watchdog_touch_timestamp(int cpu)
+{
+
+ ktime_t now = ktime_get_mono_fast_ns();
+
+ per_cpu(last_timestamp, cpu) = now;
+}
#else
static inline bool watchdog_check_timestamp(void)
{
return true;
}
+
+static void watchdog_touch_timestamp(int cpu)
+{
+
+}
#endif
static struct perf_event_attr wd_hw_attr = {
@@ -196,6 +209,7 @@ void hardlockup_detector_perf_enable(void)
if (!atomic_fetch_inc(&watchdog_cpus))
pr_info("Enabled. Permanently consumes one hw-PMU counter.\n");
+ watchdog_touch_timestamp(smp_processor_id());
perf_event_enable(this_cpu_read(watchdog_ev));
}
@@ -274,8 +288,10 @@ void __init hardlockup_detector_perf_restart(void)
for_each_online_cpu(cpu) {
struct perf_event *event = per_cpu(watchdog_ev, cpu);
- if (event)
+ if (event) {
+ watchdog_touch_timestamp(cpu);
perf_event_enable(event);
+ }
}
}
--
2.16.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* 答复: [PATCH][v2] watchdog/hardlockup: reassign last_timestamp when enable nmi event
2019-10-15 6:34 [PATCH][v2] watchdog/hardlockup: reassign last_timestamp when enable nmi event Li RongQing
@ 2019-10-22 10:43 ` Li,Rongqing
2019-11-07 10:53 ` Li,Rongqing
1 sibling, 0 replies; 5+ messages in thread
From: Li,Rongqing @ 2019-10-22 10:43 UTC (permalink / raw)
To: Li,Rongqing, akpm, sergey.senozhatsky.work, linux-kernel, tglx,
Kan.liang
Ping
Thanks
-Li
> -----邮件原件-----
> 发件人: linux-kernel-owner@vger.kernel.org
> [mailto:linux-kernel-owner@vger.kernel.org] 代表 Li RongQing
> 发送时间: 2019年10月15日 14:34
> 收件人: akpm@linux-foundation.org; sergey.senozhatsky.work@gmail.com;
> linux-kernel@vger.kernel.org; tglx@linutronix.de; Kan.liang@intel.com
> 主题: [PATCH][v2] watchdog/hardlockup: reassign last_timestamp when
> enable nmi event
>
> last_timestamp is not initialized and is zero after boot, or stop to forward when
> nmi watchdog is disabled; and false positives still is possible when restart NMI
> timer after stopping 120 seconds
>
> so reassign last_timestamp always when enable nmi event
>
> Fixes: 7edaeb6841df ("kernel/watchdog: Prevent false positives with turbo
> modes")
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
> ---
>
> v1-->v2: make it be able to be compiled on no
> v1-->CONFIG_HARDLOCKUP_CHECK_TIMESTAMP platform
>
> kernel/watchdog_hld.c | 18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/watchdog_hld.c b/kernel/watchdog_hld.c index
> 247bf0b1582c..f14d18280387 100644
> --- a/kernel/watchdog_hld.c
> +++ b/kernel/watchdog_hld.c
> @@ -91,11 +91,24 @@ static bool watchdog_check_timestamp(void)
> __this_cpu_write(last_timestamp, now);
> return true;
> }
> +
> +static void watchdog_touch_timestamp(int cpu) {
> +
> + ktime_t now = ktime_get_mono_fast_ns();
> +
> + per_cpu(last_timestamp, cpu) = now;
> +}
> #else
> static inline bool watchdog_check_timestamp(void) {
> return true;
> }
> +
> +static void watchdog_touch_timestamp(int cpu) {
> +
> +}
> #endif
>
> static struct perf_event_attr wd_hw_attr = { @@ -196,6 +209,7 @@ void
> hardlockup_detector_perf_enable(void)
> if (!atomic_fetch_inc(&watchdog_cpus))
> pr_info("Enabled. Permanently consumes one hw-PMU counter.\n");
>
> + watchdog_touch_timestamp(smp_processor_id());
> perf_event_enable(this_cpu_read(watchdog_ev));
> }
>
> @@ -274,8 +288,10 @@ void __init hardlockup_detector_perf_restart(void)
> for_each_online_cpu(cpu) {
> struct perf_event *event = per_cpu(watchdog_ev, cpu);
>
> - if (event)
> + if (event) {
> + watchdog_touch_timestamp(cpu);
> perf_event_enable(event);
> + }
> }
> }
>
> --
> 2.16.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* 答复: [PATCH][v2] watchdog/hardlockup: reassign last_timestamp when enable nmi event
2019-10-15 6:34 [PATCH][v2] watchdog/hardlockup: reassign last_timestamp when enable nmi event Li RongQing
2019-10-22 10:43 ` 答复: " Li,Rongqing
@ 2019-11-07 10:53 ` Li,Rongqing
2019-11-22 10:39 ` Li,Rongqing
2019-12-05 10:19 ` Li,Rongqing
1 sibling, 2 replies; 5+ messages in thread
From: Li,Rongqing @ 2019-11-07 10:53 UTC (permalink / raw)
To: Li,Rongqing, akpm, sergey.senozhatsky.work, linux-kernel, tglx,
Kan.liang
Ping
Thanks
-Li
> -----邮件原件-----
> 发件人: linux-kernel-owner@vger.kernel.org
> [mailto:linux-kernel-owner@vger.kernel.org] 代表 Li RongQing
> 发送时间: 2019年10月15日 14:34
> 收件人: akpm@linux-foundation.org; sergey.senozhatsky.work@gmail.com;
> linux-kernel@vger.kernel.org; tglx@linutronix.de; Kan.liang@intel.com
> 主题: [PATCH][v2] watchdog/hardlockup: reassign last_timestamp when
> enable nmi event
>
> last_timestamp is not initialized and is zero after boot, or stop to forward when
> nmi watchdog is disabled; and false positives still is possible when restart NMI
> timer after stopping 120 seconds
>
> so reassign last_timestamp always when enable nmi event
>
> Fixes: 7edaeb6841df ("kernel/watchdog: Prevent false positives with turbo
> modes")
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
> ---
>
> v1-->v2: make it be able to be compiled on no
> v1-->CONFIG_HARDLOCKUP_CHECK_TIMESTAMP platform
>
> kernel/watchdog_hld.c | 18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/watchdog_hld.c b/kernel/watchdog_hld.c index
> 247bf0b1582c..f14d18280387 100644
> --- a/kernel/watchdog_hld.c
> +++ b/kernel/watchdog_hld.c
> @@ -91,11 +91,24 @@ static bool watchdog_check_timestamp(void)
> __this_cpu_write(last_timestamp, now);
> return true;
> }
> +
> +static void watchdog_touch_timestamp(int cpu) {
> +
> + ktime_t now = ktime_get_mono_fast_ns();
> +
> + per_cpu(last_timestamp, cpu) = now;
> +}
> #else
> static inline bool watchdog_check_timestamp(void) {
> return true;
> }
> +
> +static void watchdog_touch_timestamp(int cpu) {
> +
> +}
> #endif
>
> static struct perf_event_attr wd_hw_attr = { @@ -196,6 +209,7 @@ void
> hardlockup_detector_perf_enable(void)
> if (!atomic_fetch_inc(&watchdog_cpus))
> pr_info("Enabled. Permanently consumes one hw-PMU counter.\n");
>
> + watchdog_touch_timestamp(smp_processor_id());
> perf_event_enable(this_cpu_read(watchdog_ev));
> }
>
> @@ -274,8 +288,10 @@ void __init hardlockup_detector_perf_restart(void)
> for_each_online_cpu(cpu) {
> struct perf_event *event = per_cpu(watchdog_ev, cpu);
>
> - if (event)
> + if (event) {
> + watchdog_touch_timestamp(cpu);
> perf_event_enable(event);
> + }
> }
> }
>
> --
> 2.16.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* 答复: [PATCH][v2] watchdog/hardlockup: reassign last_timestamp when enable nmi event
2019-11-07 10:53 ` Li,Rongqing
@ 2019-11-22 10:39 ` Li,Rongqing
2019-12-05 10:19 ` Li,Rongqing
1 sibling, 0 replies; 5+ messages in thread
From: Li,Rongqing @ 2019-11-22 10:39 UTC (permalink / raw)
To: akpm, sergey.senozhatsky.work, linux-kernel, tglx, Kan.liang
Ping
Thanks
-RongQing
> -----邮件原件-----
> 发件人: Li,Rongqing
> 发送时间: 2019年11月7日 18:54
> 收件人: Li,Rongqing <lirongqing@baidu.com>; akpm@linux-foundation.org;
> sergey.senozhatsky.work@gmail.com; linux-kernel@vger.kernel.org;
> tglx@linutronix.de; Kan.liang@intel.com
> 主题: 答复: [PATCH][v2] watchdog/hardlockup: reassign last_timestamp when
> enable nmi event
>
> Ping
>
> Thanks
>
> -Li
>
> > -----邮件原件-----
> > 发件人: linux-kernel-owner@vger.kernel.org
> > [mailto:linux-kernel-owner@vger.kernel.org] 代表 Li RongQing
> > 发送时间: 2019年10月15日 14:34
> > 收件人: akpm@linux-foundation.org; sergey.senozhatsky.work@gmail.com;
> > linux-kernel@vger.kernel.org; tglx@linutronix.de; Kan.liang@intel.com
> > 主题: [PATCH][v2] watchdog/hardlockup: reassign last_timestamp when
> > enable nmi event
> >
> > last_timestamp is not initialized and is zero after boot, or stop to
> > forward when nmi watchdog is disabled; and false positives still is
> > possible when restart NMI timer after stopping 120 seconds
> >
> > so reassign last_timestamp always when enable nmi event
> >
> > Fixes: 7edaeb6841df ("kernel/watchdog: Prevent false positives with
> > turbo
> > modes")
> > Signed-off-by: Li RongQing <lirongqing@baidu.com>
> > Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
> > ---
> >
> > v1-->v2: make it be able to be compiled on no
> > v1-->CONFIG_HARDLOCKUP_CHECK_TIMESTAMP platform
> >
> > kernel/watchdog_hld.c | 18 +++++++++++++++++-
> > 1 file changed, 17 insertions(+), 1 deletion(-)
> >
> > diff --git a/kernel/watchdog_hld.c b/kernel/watchdog_hld.c index
> > 247bf0b1582c..f14d18280387 100644
> > --- a/kernel/watchdog_hld.c
> > +++ b/kernel/watchdog_hld.c
> > @@ -91,11 +91,24 @@ static bool watchdog_check_timestamp(void)
> > __this_cpu_write(last_timestamp, now);
> > return true;
> > }
> > +
> > +static void watchdog_touch_timestamp(int cpu) {
> > +
> > + ktime_t now = ktime_get_mono_fast_ns();
> > +
> > + per_cpu(last_timestamp, cpu) = now;
> > +}
> > #else
> > static inline bool watchdog_check_timestamp(void) {
> > return true;
> > }
> > +
> > +static void watchdog_touch_timestamp(int cpu) {
> > +
> > +}
> > #endif
> >
> > static struct perf_event_attr wd_hw_attr = { @@ -196,6 +209,7 @@ void
> > hardlockup_detector_perf_enable(void)
> > if (!atomic_fetch_inc(&watchdog_cpus))
> > pr_info("Enabled. Permanently consumes one hw-PMU counter.\n");
> >
> > + watchdog_touch_timestamp(smp_processor_id());
> > perf_event_enable(this_cpu_read(watchdog_ev));
> > }
> >
> > @@ -274,8 +288,10 @@ void __init hardlockup_detector_perf_restart(void)
> > for_each_online_cpu(cpu) {
> > struct perf_event *event = per_cpu(watchdog_ev, cpu);
> >
> > - if (event)
> > + if (event) {
> > + watchdog_touch_timestamp(cpu);
> > perf_event_enable(event);
> > + }
> > }
> > }
> >
> > --
> > 2.16.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* 答复: [PATCH][v2] watchdog/hardlockup: reassign last_timestamp when enable nmi event
2019-11-07 10:53 ` Li,Rongqing
2019-11-22 10:39 ` Li,Rongqing
@ 2019-12-05 10:19 ` Li,Rongqing
1 sibling, 0 replies; 5+ messages in thread
From: Li,Rongqing @ 2019-12-05 10:19 UTC (permalink / raw)
To: akpm, sergey.senozhatsky.work, linux-kernel, tglx, Kan.liang
Ping
thanks
-Li
>> [PATCH][v2] watchdog/hardlockup: reassign last_timestamp when
> > enable nmi event
> >
> > last_timestamp is not initialized and is zero after boot, or stop to
> > forward when nmi watchdog is disabled; and false positives still is
> > possible when restart NMI timer after stopping 120 seconds
> >
> > so reassign last_timestamp always when enable nmi event
> >
> > Fixes: 7edaeb6841df ("kernel/watchdog: Prevent false positives with
> > turbo
> > modes")
> > Signed-off-by: Li RongQing <lirongqing@baidu.com>
> > Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
> > ---
> >
> > v1-->v2: make it be able to be compiled on no
> > v1-->CONFIG_HARDLOCKUP_CHECK_TIMESTAMP platform
> >
> > kernel/watchdog_hld.c | 18 +++++++++++++++++-
> > 1 file changed, 17 insertions(+), 1 deletion(-)
> >
> > diff --git a/kernel/watchdog_hld.c b/kernel/watchdog_hld.c index
> > 247bf0b1582c..f14d18280387 100644
> > --- a/kernel/watchdog_hld.c
> > +++ b/kernel/watchdog_hld.c
> > @@ -91,11 +91,24 @@ static bool watchdog_check_timestamp(void)
> > __this_cpu_write(last_timestamp, now);
> > return true;
> > }
> > +
> > +static void watchdog_touch_timestamp(int cpu) {
> > +
> > + ktime_t now = ktime_get_mono_fast_ns();
> > +
> > + per_cpu(last_timestamp, cpu) = now;
> > +}
> > #else
> > static inline bool watchdog_check_timestamp(void) {
> > return true;
> > }
> > +
> > +static void watchdog_touch_timestamp(int cpu) {
> > +
> > +}
> > #endif
> >
> > static struct perf_event_attr wd_hw_attr = { @@ -196,6 +209,7 @@ void
> > hardlockup_detector_perf_enable(void)
> > if (!atomic_fetch_inc(&watchdog_cpus))
> > pr_info("Enabled. Permanently consumes one hw-PMU counter.\n");
> >
> > + watchdog_touch_timestamp(smp_processor_id());
> > perf_event_enable(this_cpu_read(watchdog_ev));
> > }
> >
> > @@ -274,8 +288,10 @@ void __init hardlockup_detector_perf_restart(void)
> > for_each_online_cpu(cpu) {
> > struct perf_event *event = per_cpu(watchdog_ev, cpu);
> >
> > - if (event)
> > + if (event) {
> > + watchdog_touch_timestamp(cpu);
> > perf_event_enable(event);
> > + }
> > }
> > }
> >
> > --
> > 2.16.2
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-12-05 10:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-15 6:34 [PATCH][v2] watchdog/hardlockup: reassign last_timestamp when enable nmi event Li RongQing
2019-10-22 10:43 ` 答复: " Li,Rongqing
2019-11-07 10:53 ` Li,Rongqing
2019-11-22 10:39 ` Li,Rongqing
2019-12-05 10:19 ` Li,Rongqing
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).