From nobody Fri Sep 12 04:47:54 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E766C636D4 for ; Mon, 13 Feb 2023 18:48:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229830AbjBMSsg (ORCPT ); Mon, 13 Feb 2023 13:48:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229479AbjBMSse (ORCPT ); Mon, 13 Feb 2023 13:48:34 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7139C1CAE9; Mon, 13 Feb 2023 10:48:33 -0800 (PST) Date: Mon, 13 Feb 2023 18:48:31 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1676314112; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=10aKowH0O7xPF52QLDURYI+M9aMFRFNzFxX/Nv4RgY8=; b=0ugPr2Mvu5D2SCsN+V+b59CqI5Vtf+oE0KShAnXvOzv4PBNy3L7Bx9JxyQEKanEJROhmnO GTHy3El/JmEauWIHXLmtyF6OZG05V5fWEWJcym3HvGey1k0SHg+pvr0wKgrT+u7crBgLiD fQgSUlMLpyC1AK/4a4YdDy/QZU0zgdzp+uZqPrCNiuEbK17SaK27/NU/mYQ0ni1SYoDBsu 35pgiW7VVNIR2tAFFnJ9u9hRLmqWvz4Bjk/lYpr3msNCAM9CwFjdgSw7lST0xq5Dgk7t0A m1ddnA8t+0+bZBtLfJZlv65RWPlH0yiIJWD6l4Fnwj09vPDcaTF6JDBz7sGAyw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1676314112; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=10aKowH0O7xPF52QLDURYI+M9aMFRFNzFxX/Nv4RgY8=; b=cPcXBWmC2Uq9efntRZOeXbKuyNww9A8Q0OLORtCopYYy1MmpHBlL7oipAAi9zvb0SZLWxX 7hu1WV+/4BDTL6CA== From: "tip-bot2 for Paul E. McKenney" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] clocksource: Enable TSC watchdog checking of HPET and PMTMR only when requested Cc: Thomas Gleixner , Waiman Long , "Paul E. McKenney" , x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <167631411143.4906.5479453461226971405.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the timers/core branch of tip: Commit-ID: 0051293c533017e2a860e0a0a33517bc40240fff Gitweb: https://git.kernel.org/tip/0051293c533017e2a860e0a0a33517bc4= 0240fff Author: Paul E. McKenney AuthorDate: Wed, 01 Feb 2023 13:53:07 -08:00 Committer: Paul E. McKenney CommitterDate: Mon, 06 Feb 2023 16:38:30 -08:00 clocksource: Enable TSC watchdog checking of HPET and PMTMR only when reque= sted Unconditionally enabling TSC watchdog checking of the HPET and PMTMR clocksources can degrade latency and performance. Therefore, provide a new "watchdog" option to the tsc=3D boot parameter that opts into such checking. Note that tsc=3Dwatchdog is overridden by a tsc=3Dnowatchdog regardless of their relative positions in the list of boot parameters. Reported-by: Thomas Gleixner Reported-by: Waiman Long Signed-off-by: Paul E. McKenney Acked-by: Waiman Long --- Documentation/admin-guide/kernel-parameters.txt | 6 +++++- arch/x86/kernel/tsc.c | 18 ++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentatio= n/admin-guide/kernel-parameters.txt index 95f0d10..7b4df6d 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -6373,6 +6373,12 @@ (HPET or PM timer) on systems whose TSC frequency was obtained from HW or FW using either an MSR or CPUID(0x15). Warn if the difference is more than 500 ppm. + [x86] watchdog: Use TSC as the watchdog clocksource with + which to check other HW timers (HPET or PM timer), but + only on systems where TSC has been deemed trustworthy. + This will be suppressed by an earlier tsc=3Dnowatchdog and + can be overridden by a later tsc=3Dnowatchdog. A console + message will flag any such suppression or overriding. =20 tsc_early_khz=3D [X86] Skip early TSC calibration and use the given value instead. Useful when the early TSC frequency discovery diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index a5371c6..306c233 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -294,6 +294,7 @@ __setup("notsc", notsc_setup); =20 static int no_sched_irq_time; static int no_tsc_watchdog; +static int tsc_as_watchdog; =20 static int __init tsc_setup(char *str) { @@ -303,10 +304,22 @@ static int __init tsc_setup(char *str) no_sched_irq_time =3D 1; if (!strcmp(str, "unstable")) mark_tsc_unstable("boot parameter"); - if (!strcmp(str, "nowatchdog")) + if (!strcmp(str, "nowatchdog")) { no_tsc_watchdog =3D 1; + if (tsc_as_watchdog) + pr_alert("%s: Overriding earlier tsc=3Dwatchdog with tsc=3Dnowatchdog\n= ", + __func__); + tsc_as_watchdog =3D 0; + } if (!strcmp(str, "recalibrate")) tsc_force_recalibrate =3D 1; + if (!strcmp(str, "watchdog")) { + if (no_tsc_watchdog) + pr_alert("%s: tsc=3Dwatchdog overridden by earlier tsc=3Dnowatchdog\n", + __func__); + else + tsc_as_watchdog =3D 1; + } return 1; } =20 @@ -1192,7 +1205,8 @@ static void __init tsc_disable_clocksource_watchdog(v= oid) =20 bool tsc_clocksource_watchdog_disabled(void) { - return !(clocksource_tsc.flags & CLOCK_SOURCE_MUST_VERIFY); + return !(clocksource_tsc.flags & CLOCK_SOURCE_MUST_VERIFY) && + tsc_as_watchdog && !no_tsc_watchdog; } =20 static void __init check_system_tsc_reliable(void)