mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Li RongQing <lirongqing@baidu.com>
Cc: mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, jolsa@redhat.com,
	namhyung@kernel.org, tglx@linutronix.de, bp@alien8.de,
	hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][RFC] perf/x86: avoid false-positives hard lockup
Date: Thu, 10 Oct 2019 11:46:37 +0200	[thread overview]
Message-ID: <20191010094637.GN2328@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <1570696898-13169-1-git-send-email-lirongqing@baidu.com>

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.

      reply	other threads:[~2019-10-10  9:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10  8:41 Li RongQing
2019-10-10  9:46 ` Peter Zijlstra [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191010094637.GN2328@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lirongqing@baidu.com \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®