Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8001508rwb; Wed, 23 Nov 2022 14:00:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf6gCWmISeZGHV3UtXF8ceI/uOzHytjAOSV4n8iNS13DJt92oFVfMKAER4vwN6LBtmli7FQd X-Received: by 2002:a63:1626:0:b0:46e:96b9:ed63 with SMTP id w38-20020a631626000000b0046e96b9ed63mr10043987pgl.258.1669240831266; Wed, 23 Nov 2022 14:00:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669240831; cv=none; d=google.com; s=arc-20160816; b=f6i9PpoBMYwE/p3k5+R4JFeZIqRrbWamRtue5/V4dCWl7i0RtyXXk2iQR+PsCPulmf ZnMUX09HVszWbMVTHD6lH2qoHrLaa6QR71HUd67GQrC32bOMKPXYqZbCTGz9et+CZywp vJmMcmq6rgVFddokzzhHbq3C3IatVmyavy+s9DXePIZL8Bz2vNaGl+sTLwYuGkjs58vk j2kQOgstDLWOJ/YUTAER3RYJOgoqLBGepyNN43dpHNCMWGczwrMlPOjsrTeYuJ30iFFI 3+NPUiJCcymcdaNzXLBUtmeKigwBelxfQd5PLKovU41Mo7qLg4JovvNvW2PE8N2AYURa 6PyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=6lGOTxMxknqIlC8HioXQheco3Zgienot/OEX5+y/sXQ=; b=J37zOUWyA68aBTc9zpo0WXLJsW3wGsVQVrg8TJBcwzuYw9pHmGZQPZmZ4ykWgeGRH8 vxaW+tKKnf7wSy/VRtuQNOtMWu+OVDJjA9mJyrtslK2FmBpL1++J4dP5PSEOq1xMyNoB gR3C3Ru4rOD3MjVNXm5x7QxKQd0yXoSTLBsh749/dzEZYNyHq4hODgi8Y2CMCKTSvC2/ Q4oxrtgQrBbs7A5NIUe3RnwaFP6UNJmOdaD+o6DkDT3nawHOq9+gODto+INK7OQ9MMsb HIZW9wPrVJZjEu8oDAGFfLGuEgUQ3MeM5giRXYf3TVfPKHOVFx+Tj2R8YddM2ZevGq52 4pjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HqV2reqZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ca20-20020a17090af31400b00213ff43fdf1si2506828pjb.185.2022.11.23.14.00.19; Wed, 23 Nov 2022 14:00:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HqV2reqZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S238149AbiKWVXy (ORCPT + 88 others); Wed, 23 Nov 2022 16:23:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235701AbiKWVXv (ORCPT ); Wed, 23 Nov 2022 16:23:51 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA1E470A12 for ; Wed, 23 Nov 2022 13:23:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5B57561F2B for ; Wed, 23 Nov 2022 21:23:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2931C433C1; Wed, 23 Nov 2022 21:23:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669238628; bh=cATiR1QG6cTY/mqQnaWiwo/Sa8WflOSrl15CfQvSEVM=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=HqV2reqZWvvaU0usYoj+DiRq9qcSL8WIDjmq26rH/DjkS/afyL+WCs8tC/1vZriV8 WOdmpnHsd2kgVsx2kY8D1JLZFxhBjpDkhKl0ZSEG6m5jN+cc7MnqC3PWWltkIW3x+q puOWOToSThuXbwgbH/aQ5yn1p5dqCXmIAcBeh1u4RG3MjYv6DwUoG79+zL2lum3lzN nyhxCWnC9CcEtPs3EylGoBMrXtxqclGBBFrksJYGcmnSgm+qJAjZUS+vWx6lj6Ochp Qq5xkFRMsy/A14sg1u5Izfg8BXHJT+2rmX+rnT6J570yeTrXfnwfRTCmf2kTjgb1hW IzjqLSBdhUtqQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 5184B5C1286; Wed, 23 Nov 2022 13:23:48 -0800 (PST) Date: Wed, 23 Nov 2022 13:23:48 -0800 From: "Paul E. McKenney" To: Feng Tang Cc: Thomas Gleixner , linux-kernel@vger.kernel.org, john.stultz@linaro.org, sboyd@kernel.org, corbet@lwn.net, Mark.Rutland@arm.com, maz@kernel.org, kernel-team@meta.com, neeraju@codeaurora.org, ak@linux.intel.com, zhengjun.xing@intel.com, Chris Mason , John Stultz , Waiman Long Subject: Re: [PATCH clocksource 1/3] clocksource: Reject bogus watchdog clocksource measurements Message-ID: <20221123212348.GI4001@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20221114232807.GA834337@paulmck-ThinkPad-P17-Gen-1> <20221114232827.835599-1-paulmck@kernel.org> <87mt8pkzw1.ffs@tglx> <20221117230910.GI4001@paulmck-ThinkPad-P17-Gen-1> <20221121181449.GA3774542@paulmck-ThinkPad-P17-Gen-1> <20221122220712.GP4001@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 23, 2022 at 10:36:04AM +0800, Feng Tang wrote: > On Tue, Nov 22, 2022 at 02:07:12PM -0800, Paul E. McKenney wrote: > [...] > > > > If PM_TIMER was involved, I would expect 'acpi_pm' instead of > > > > refined-jiffies. Or am I misinterpreting the output and/or code? > > > > > > It's about timing. On a typical server platform, the clocksources > > > init order could be: > > > refined-jiffies --> hpet --> tsc-early --> acpi_pm --> tsc > > > > > > >From your log, TSC('tsc-early') is disabled before 'acpi_pm' get > > > initialized, so 'acpi_pm' timer (if exist) had no chance to watchdog > > > the tsc. > > > > > > > Either way, would it make sense to add CLOCK_SOURCE_MUST_VERIFY to > > > > clocksource_hpet.flags? > > > > > > Maybe try below patch, which will skip watchdog for 'tsc-early', > > > while giving 'acpi_pm' timer a chance to watchdog 'tsc'. > > > > > > diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c > > > index cafacb2e58cc..9840f0131764 100644 > > > --- a/arch/x86/kernel/tsc.c > > > +++ b/arch/x86/kernel/tsc.c > > > @@ -1131,8 +1131,7 @@ static struct clocksource clocksource_tsc_early = { > > > .uncertainty_margin = 32 * NSEC_PER_MSEC, > > > .read = read_tsc, > > > .mask = CLOCKSOURCE_MASK(64), > > > - .flags = CLOCK_SOURCE_IS_CONTINUOUS | > > > - CLOCK_SOURCE_MUST_VERIFY, > > > + .flags = CLOCK_SOURCE_IS_CONTINUOUS, > > > .vdso_clock_mode = VDSO_CLOCKMODE_TSC, > > > .enable = tsc_cs_enable, > > > .resume = tsc_resume, > > > > Your mainline patch b50db7095fe0 ("x86/tsc: Disable clocksource watchdog > > for TSC on qualified platorms") mitigates the issue so we are good for > > the immediate future, at least assuming reliable TSC. > > > > But it also disables checking against HPET, hence my question about > > marking clocksource_hpet.flags with CLOCK_SOURCE_MUST_VERIFY at boot time > > on systems whose CPUs have constant_tsc, nonstop_tsc, and tsc_adjust. > > IIUC, this will make TSC to watchdog HPET every 500 ms. We have got > report that the 500ms watchdog timer had big impact on some parallel > workload on big servers, that was another factor for us to seek > stopping the timer. Another approach would be to slow it down. Given the tighter bounds on skew, it could be done every (say) 10 seconds while allowing 2 milliseconds skew instead of the current 100 microseconds. > Is this about the concern of possible TSC frequency calibration > issue, as the 40 ms per second drift between HPET and TSC? With > b50db7095fe0 backported, we also have another patch to force TSC > calibration for those platforms which get the TSC freq directly > from CPUID or MSR and don't have such info in dmesg: > "tsc: Refined TSC clocksource calibration: 2693.509 MHz" > > https://lore.kernel.org/lkml/20220509144110.9242-1-feng.tang@intel.com/ > > We did met tsc calibration issue due to some firmware issue, and > this can help to catch it. You can try it if you think it's relevant. I am giving this a go, thank you! Thanx, Paul > Thanks, > Feng > > > Would that make sense? > > > > Thanx, Paul > > > > > > I am sending the full console output off-list. Hey, you asked for it! ;-) > > > > > > Thanks for sharing! > > > > > > Thanks, > > > Feng > > > > > > > > > > > Thanx, Paul