Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp3154350pxy; Sun, 25 Apr 2021 15:49:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7XuyrEaJLXFs6JVsbnWQRBdaoYaY6g2H+06rdXNVK+a7q6IG+PGeUplocCFuMPgyr4QvU X-Received: by 2002:a17:907:217b:: with SMTP id rl27mr15518919ejb.359.1619390970313; Sun, 25 Apr 2021 15:49:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619390970; cv=none; d=google.com; s=arc-20160816; b=daGFdm30ZrFbPBOTz3Bc42/7P/iQlhr3Vy4pwd2o2krGQmc0HMn9k2ASBbWMh5WMFg HI0+GMW2nF/Z+W2a2vmNiG6xROOAmF2DQNAgFQnKWAR4tHG6ZB4nl5kwVUpgXzt5AXn7 HvLQF8ndF4ZlVOmqfY+NGvazIvNnegwSROPM/9XqL5ZvlAPT7piSdXmaw8CXMUzVrVWr UNfLT1Ce9BbtC9fYHSpiDANUxy4o61F/bZJVSRGiHq88IwHhVexQr8dOQ0ZjEIyX2kBf XInh8MSfjp+l25PFylMEQlVuH6f3s9yXuL4zOfu1rC4fAmX4nDzjudu58SGFx7fM+6qr 0rqw== 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=qLG4J+FDGrluyL3GkL4h3Nd2gZ1oFtt+/QHqggtuki8=; b=SG4Q5P8TnGt7v5F1eAvzkUbtbCR2YpiB4g+vEiRn9eKzuhphlYZpvo9nmjlap4ptr9 jFRCV0pVAk1mfXualn4U7OaDsRFkYzl2UwlCjoVW2YBNmltUWIyV+Www1FLsl9vZ+hMr QOyfhxK7Eta+TprpBScOutpL61isB9ZC/h+7/dAqZKae1cWPpWOP9QTCSqUhr3+9si7v QXavuUkcgIRSwd2zEhtUlEs3jAKHvt3LjtNnH1PAsH40Tu4BuhLA4j6XoamTbqxCrjbf 7MkPilnv0hl0Cpl8L31QDB/iRdX4M4Xn5lpbcSF1Tl4iWiD3hHAI2Pn/amqYASJ/L3j4 kQ6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="h2Pz/mbU"; 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 da8si11973818edb.320.2021.04.25.15.49.07; Sun, 25 Apr 2021 15:49:30 -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="h2Pz/mbU"; 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 S231530AbhDYWsA (ORCPT + 99 others); Sun, 25 Apr 2021 18:48:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:50806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231435AbhDYWrv (ORCPT ); Sun, 25 Apr 2021 18:47:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5BF89613B3; 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=61SePc1GcT9sPgJaob+M5p4af6p5YFJt5b4qYSd6fRg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h2Pz/mbUwH+bhbWTJ9Khlv4fPnUggLcKs0cglGBDITD+eUP7codcqVrsBSZ7RFi+m 7KP0pAh58Nc1Iuh6zE6kl++SKjWoXek1nGDTbpqmgayZIyaFYYiiRBy78sfrFKE3Qc 4CNEiPhSs3cjzKDo4aTSERvINkRpfFKzmHn0AEy5dW4eAuGRBbNrOaZ/9mSYpEFyx+ mkPZFXB+Yz4DSTJdMhT4UkUbexS0aQ44ygJwyYbgliXCy3tpcGA7Qfe8wD+nhgTVQ7 ge2/uTdd1km4P9mVDjq7jbJKu4v09G3PBRTcMQgLFjk5mPgO8mqiPBddSNAUv0JvOf CbHpIsXVWKaBA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id DB58D5C027B; 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 v9 clocksource 6/6] clocksource: Reduce WATCHDOG_THRESHOLD Date: Sun, 25 Apr 2021 15:47:08 -0700 Message-Id: <20210425224709.1312655-7-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 2981e293a468..d82ad0492777 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -125,14 +125,14 @@ 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) /* * Maximum permissible delay between two readouts of the watchdog * 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