mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][RFC] perf/x86: avoid false-positives hard lockup
@ 2019-10-10  8:41 Li RongQing
  2019-10-10  9:46 ` Peter Zijlstra
  0 siblings, 1 reply; 2+ messages in thread
From: Li RongQing @ 2019-10-10  8:41 UTC (permalink / raw)
  To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
	namhyung, tglx, bp, hpa, x86, linux-kernel

if perf counter is used as nmi watchdog, and twice nmi in soft
watchdog sample period will trigger hard lockup

make sure left time is not less than soft watchdog period by
compared with 3/5 period to skip forward, since soft watchdog
sample period is 2/5 of watchdog_thresh, nmi watchdog sample
period, computed by set_sample_period

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 arch/x86/events/core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index 7b21455d7504..1f5309456d4c 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -1196,7 +1196,11 @@ int x86_perf_event_set_period(struct perf_event *event)
 	/*
 	 * If we are way outside a reasonable range then just skip forward:
 	 */
+#ifdef CONFIG_HARDLOCKUP_DETECTOR_PERF
+	if (unlikely(left <= -(period * 3 / 5))) {
+#else
 	if (unlikely(left <= -period)) {
+#endif
 		left = period;
 		local64_set(&hwc->period_left, left);
 		hwc->last_period = period;
-- 
2.16.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH][RFC] perf/x86: avoid false-positives hard lockup
  2019-10-10  8:41 [PATCH][RFC] perf/x86: avoid false-positives hard lockup Li RongQing
@ 2019-10-10  9:46 ` Peter Zijlstra
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Zijlstra @ 2019-10-10  9:46 UTC (permalink / raw)
  To: Li RongQing
  Cc: mingo, acme, mark.rutland, alexander.shishkin, jolsa, namhyung,
	tglx, bp, hpa, x86, linux-kernel

On Thu, Oct 10, 2019 at 04:41:38PM +0800, Li RongQing wrote:
> if perf counter is used as nmi watchdog, and twice nmi in soft
> watchdog sample period will trigger hard lockup
> 
> make sure left time is not less than soft watchdog period by
> compared with 3/5 period to skip forward, since soft watchdog
> sample period is 2/5 of watchdog_thresh, nmi watchdog sample
> period, computed by set_sample_period
> 
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
>  arch/x86/events/core.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
> index 7b21455d7504..1f5309456d4c 100644
> --- a/arch/x86/events/core.c
> +++ b/arch/x86/events/core.c
> @@ -1196,7 +1196,11 @@ int x86_perf_event_set_period(struct perf_event *event)
>  	/*
>  	 * If we are way outside a reasonable range then just skip forward:
>  	 */
> +#ifdef CONFIG_HARDLOCKUP_DETECTOR_PERF
> +	if (unlikely(left <= -(period * 3 / 5))) {
> +#else
>  	if (unlikely(left <= -period)) {
> +#endif

NAK. This is 100% the wrong place to do anything like that.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-10  9:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-10  8:41 [PATCH][RFC] perf/x86: avoid false-positives hard lockup Li RongQing
2019-10-10  9:46 ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®