Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp3154792pxy; Sun, 25 Apr 2021 15:50:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAxJpREa8mH3L9TrG/1dvQSNOWrnb2G0gtxUCnSAHtCDoB7MeDEE2Rp2pgvyBT2WdlyBfs X-Received: by 2002:aa7:d9d9:: with SMTP id v25mr17479650eds.83.1619391024079; Sun, 25 Apr 2021 15:50:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619391024; cv=none; d=google.com; s=arc-20160816; b=JfjmamS0rbhOYB084+66KOhbZX7xEYESzMSJMzKX/3/MBe8wZXe8Pdfyp3pGif39+3 2nHWNsAedfYdKF3JYbOM9FdbRj9V4g2/GiYSI9a0TKcnqE91gj+ASoxzHPEOqlWwnU0c EJvOVqJ8L8E7aBaUgopX6ZbjuDFWn49IMTFqzpC2hzzfBwq8FFLcLSfVwtLSA7ZFZWJ1 GX5UXf1S6K/aHDHt1Crx24q8IR11moq+mfo+RF0AyQxWKAux0BzFeXSqCIPu81OQULfO SiZ/+GmglLuqp7NuO7aNlLIvZRmpvhjXeJIdMSuFxBq9DYf0FZOmrqx7Vjkejo6JPwJj fBcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Hp4UOR8dL6LDgiZyfNkq5Fr76OaZFfj3DwLXMZQGvJs=; b=JMFPgBE8u0+6NNmsuh0i90sGHRplnEjLZAX922D3PupfRmwmmGcMJoi4nI/kyAU+zW e9FOIiuXppv0gNOre9NDgjZJEggwOX8ak5xwdFy8WjPN9gLfP8SNx8SxJwMFM/67vhFz v9uiENdcLlEYfGLw5uDzhTNfVkdvHnG5GxZ5AJ14HmgaNiqdxwiy7T65JnY+DzGP9tvK rZWD4Wr3n0vLcWfElwHkZWSAt4DwpLZcGbIr9tvxwA7OBOR5IM7EZw1cDQW3bC1KtBys fUCZO1vjsJofPPC3da9WoV5abu/k/cXoBq1Hv6/tsStxHk1R1F4GczC5Ze4JKWaLQkO+ ITVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="LlUoC/3C"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bn4si12342644ejb.702.2021.04.25.15.50.01; Sun, 25 Apr 2021 15:50:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="LlUoC/3C"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231517AbhDYWsE (ORCPT + 99 others); Sun, 25 Apr 2021 18:48:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:50810 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231441AbhDYWrv (ORCPT ); Sun, 25 Apr 2021 18:47:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 60F23613BB; Sun, 25 Apr 2021 22:47:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619390831; bh=YOXvJ9c4FtwxVpG/WsHRuATvBXtO3NDC6pYxQbAN5x0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LlUoC/3CuWoSzxWmtb6iuhCs3ToYXoDONB7lCkjX52/CPDXAp1Y6VwDJOCxiR9w9X GzZVcidyOQ9UPBE/I6QVnm9k2Tm+Y/hLh/oOQ5byGSME72N4rEbWgxNAkaPb1pOZGA RnoI411D1QYy4zg9y3J+skeEjJoyIkhUEm7hkgzgYyFQtmsgjFGgKUr4HZ+JN8s5zb LkRe9jRqu83h4GX/1A/NC3tk2SmYnJOXIsv2FPOnqfCfOVjFcedP69FxqfGlZ3PdzH 9aTyynk46R+HWErFtmkgAp3wI8iyVpf3y7kI0qxk/7XvnYVZmDs2XXJoPU9MO+CclQ eRzxegXNYBSSw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id DD2705C05AA; Sun, 25 Apr 2021 15:47:10 -0700 (PDT) From: "Paul E. McKenney" To: tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, john.stultz@linaro.org, sboyd@kernel.org, corbet@lwn.net, Mark.Rutland@arm.com, maz@kernel.org, kernel-team@fb.com, neeraju@codeaurora.org, ak@linux.intel.com, feng.tang@intel.com, zhengjun.xing@intel.com, "Paul E. McKenney" , Chris Mason Subject: [PATCH v10 clocksource 7/7] clocksource: Reduce WATCHDOG_THRESHOLD Date: Sun, 25 Apr 2021 15:47:09 -0700 Message-Id: <20210425224709.1312655-8-paulmck@kernel.org> X-Mailer: git-send-email 2.31.1.189.g2e36527f23 In-Reply-To: <20210425224540.GA1312438@paulmck-ThinkPad-P17-Gen-1> References: <20210425224540.GA1312438@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, WATCHDOG_THRESHOLD is set to detect a 62.5-millisecond skew in a 500-millisecond WATCHDOG_INTERVAL. This requires that clocks be skewed by more than 12.5% in order to be marked unstable. Except that a clock that is skewed by that much is probably destroying unsuspecting software right and left. And given that there are now checks for false-positive skews due to delays between reading the two clocks, and given that current hardware clocks all increment well in excess of 1MHz, it should be possible to greatly decrease WATCHDOG_THRESHOLD. Therefore, decrease WATCHDOG_THRESHOLD from the current 62.5 milliseconds down to 200 microseconds. Suggested-by: Thomas Gleixner Cc: John Stultz Cc: Stephen Boyd Cc: Jonathan Corbet Cc: Mark Rutland Cc: Marc Zyngier Cc: Andi Kleen [ paulmck: Apply Rik van Riel feedback. ] Reported-by: Chris Mason Signed-off-by: Paul E. McKenney --- kernel/time/clocksource.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index 070b09dab815..a374cf7b6336 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -125,7 +125,7 @@ static void __clocksource_change_rating(struct clocksource *cs, int rating); * Interval: 0.5sec Threshold: 0.0625s */ #define WATCHDOG_INTERVAL (HZ >> 1) -#define WATCHDOG_THRESHOLD (NSEC_PER_SEC >> 4) +#define WATCHDOG_THRESHOLD (200 * NSEC_PER_USEC) #define WATCHDOG_SYNC_FORGIVENESS (HZ * 60UL) /* @@ -133,7 +133,7 @@ static void __clocksource_change_rating(struct clocksource *cs, int rating); * clocksource surrounding a read of the clocksource being validated. * This delay could be due to SMIs, NMIs, or to VCPU preemptions. */ -#define WATCHDOG_MAX_SKEW (100 * NSEC_PER_USEC) +#define WATCHDOG_MAX_SKEW (50 * NSEC_PER_USEC) static void clocksource_watchdog_work(struct work_struct *work) { -- 2.31.1.189.g2e36527f23