Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2134257ybp; Thu, 10 Oct 2019 02:47:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqy2Rr4vtDs++SSDW0+gSm/E+tL/qyVh76uZmoZ4Ukx8bSRuE3vE46zaVXa0FWFcqRml3fYn X-Received: by 2002:aa7:cfd4:: with SMTP id r20mr7138557edy.268.1570700853077; Thu, 10 Oct 2019 02:47:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570700853; cv=none; d=google.com; s=arc-20160816; b=y2GrCeSzvW4bX4Q0rCF9Vw1RU6IMUo3sBSGWB4UqoLudhTYoGepYH8vp8ihSgNhsvy Cg/GFKH6/IoP3loT9OvKgDOoC/VnAgezGFss/9Cg9KiZZ8pSh6xVkDwzsc/tTp3kX5iY M6QG6iAEQDwxqSOQ99Ei2AvmBHrTjeWznFliDyzfbRhOxed3sUEmuCw+ai7aGUfc60t7 ISIgQqMkRZrNvYqm/+4s7hHM4H6WSbKefqqQeu0YDOtZ4eL/9mpFMGIQvKESO+bMUlTY PYUBWvJEbkxWkVySj2B48CIdsBRm2ClI/ZpQnjCrBl8fq3Voi3aTXdEWgyEeOjbC2bR5 +drA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=sTRhFKvn0glVeC9mpJ0ol8xV4CtebwGWcwgq8iAIB/k=; b=HGxJYaClU7I+0wGU5yfYV695uJ+fZWbCvG5XjZ2oVWmZtJ4sdJwPdm1XncqgSxZBTD LJju8F1ty9Qcs67s2RwxjfaK6y1MAzOlpJ/cVI3nwTf+WjTormG47vgfN56DgAxyiah4 5RFlg3yUvCjeLekG+ikNMADyiJ+6Jg6a0I2YCyrv6ybokG/GGKR8BG0/Bt3X0BKyKV1U Y6FgvWbK3v/p1ShfnJ39nxEXACq80GkIP6yzhEA/cFg478s5JghLO+e7LSccGxes/Zm2 CWbFKgYgKQXyyFu39e3BvVZdX9qXImNApbzlDG1VMQFHu+VEjiUf9sbw+02A7KmWRSuf 81rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=ZPkFQitf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d6si2946793edx.85.2019.10.10.02.47.09; Thu, 10 Oct 2019 02:47:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=ZPkFQitf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387505AbfJJJqx (ORCPT + 99 others); Thu, 10 Oct 2019 05:46:53 -0400 Received: from merlin.infradead.org ([205.233.59.134]:58424 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725901AbfJJJqx (ORCPT ); Thu, 10 Oct 2019 05:46:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=sTRhFKvn0glVeC9mpJ0ol8xV4CtebwGWcwgq8iAIB/k=; b=ZPkFQitfoTicBpUlrGCAHIgyB NgqXJzWuoebSOlXlPHneEHlEK8iP38ulBLQ7xpUryw3FSrtoTLXd6xQxpNJTFU5KpTrxvwI/LD/Es ry4N8Od7qHRhJkkiRZ1TdybR3MVwIv0UppEr7Sly5aXACIIrctsU30/de/G/wRR36WvYi8GWj+PIS IgN7/ZzB4CQvbCXokCHILiF4jfm/bd1lfXhhnh8ech6UiCcpSTE8yImz+xXsBQgS0uQNn6kQIk1hz X9bvAg3UJxnUpcYpbTezcjr1liSlRTYto0eraFROPxY9q2iz7+C7ELcJ8FFZTPKWTSjm1B6EMS0tm d1UxbHCKA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.2 #3 (Red Hat Linux)) id 1iIV1q-0001e8-Si; Thu, 10 Oct 2019 09:46:39 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 5F9093013A4; Thu, 10 Oct 2019 11:45:45 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 8B8E2202F4F54; Thu, 10 Oct 2019 11:46:37 +0200 (CEST) Date: Thu, 10 Oct 2019 11:46:37 +0200 From: Peter Zijlstra To: Li RongQing 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 Message-ID: <20191010094637.GN2328@hirez.programming.kicks-ass.net> References: <1570696898-13169-1-git-send-email-lirongqing@baidu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1570696898-13169-1-git-send-email-lirongqing@baidu.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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.