Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp129856iob; Tue, 17 May 2022 21:13:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSgmj+j/8nBAVTf8CpBfUMDI4riiyTql5Crx0kbBX9/KRR/K6uIqxqqX5bLZQ5siID3b9T X-Received: by 2002:aa7:9d0d:0:b0:50d:4fcc:7cb1 with SMTP id k13-20020aa79d0d000000b0050d4fcc7cb1mr25763725pfp.41.1652847237150; Tue, 17 May 2022 21:13:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652847237; cv=none; d=google.com; s=arc-20160816; b=yyL+bFofCyF8lhzyYUtMNcyY6QLHinFvs2dBkWpwdQcc/EwBal77nfBSnssj16IgTz /iU1nOyBLN4S+ehLTnnkz34dt7dampCNOon04Jh/n2m+wL2jt2miFuDrp8F2tGHJhDWd 4Kjy8w+UvXsU/2HLOB6CTkWU6kVCD+PDiNHziehZHGUEuWH+tUBd+k++BHBi1ljN3aIP ZhD2htWCyEoHnYV7FjXd5nqtf6AFNaBbrCdSzhxY5T8ahKrds8mTdAfQwjrH6of15FV6 l5b648sFK1rRKjgpWxF9kjxuUSgUR2Cn5GWJHIgb9pcewdnd2jCXsThcvdCVvWgJBYsO PQ4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=3yDQ0N2LhheLvOsRbjjMfGH7WTBvmW8zkPISFH02jz0=; b=LqUzLdOckdMNIDv1wirHRyYBzxy2/nrMvYxc4gU/oiNoXiQ8KjbvSozaNH7/dJ1Qga 57Evs/nKNvZZYPrrqQ8uay764a2Ga8zYFpMOgrVVommtqHTTc5KCebDNl1jJde1a4FZ0 kn11VIfDBRm1optebM4/DhL+Akjg5E/tXj4YhF2CeAODNarYz3n5tVi24Bin5dZBKakT php4115Itdm6M5cQqpUuZ+JwAcfcFvraOpVxWjqAdpyKQ5Naq0ZYJHblJwBbZDokETvR MDxI50jp5yH3v6QtGNeXsYUiKJcHygmsh5NMOonNCeO/sKIZ1YOixC/Mxxa3mS3YkIYf EL9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BjbfxZHZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 139-20020a630391000000b003c6dde2ad19si1084084pgd.26.2022.05.17.21.13.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 21:13:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BjbfxZHZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8AE035BE7A; Tue, 17 May 2022 20:43:45 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230025AbiEQWEd (ORCPT + 99 others); Tue, 17 May 2022 18:04:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229951AbiEQWE3 (ORCPT ); Tue, 17 May 2022 18:04:29 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4B474B851 for ; Tue, 17 May 2022 15:04:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652825068; x=1684361068; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=DYnEdSppO39yh6uNPMT5k/kcPnrUIqJqd4/BSKdNERc=; b=BjbfxZHZEwBynJi1lPzs0SlSzNyrQU2V4xj0J7nIMcWyNqawa51U7IU8 verdxVoczLZ8EqdJwFMJO32uIVeagW4loCzeBW9OrRatJi/8WLnXNycH6 Vu3b4EUXAZmRBnbzmaZOLrRlrlrlSvvNNxtcR0+1Bocp2dF4zofMGsfzb c0Fzs+/aymVFmN3k33xJt5E9nr6ZTysRxBmVll7sLySeBtQ1+x6wkU4Ka G60ugC0gsvCZ9xtECH7RNu5LO6Wa7qiXaSPUC9/0vDxUEgdUh73CphNIL pK+5xz2NIxc7qcdlHqYiBV9J+XfEt3VvOEUbFElaJfMmFXJb4wWGSShFX A==; X-IronPort-AV: E=McAfee;i="6400,9594,10350"; a="253399768" X-IronPort-AV: E=Sophos;i="5.91,233,1647327600"; d="scan'208";a="253399768" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2022 15:04:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,233,1647327600"; d="scan'208";a="673075036" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by fmsmga002.fm.intel.com with ESMTP; 17 May 2022 15:04:27 -0700 Date: Tue, 17 May 2022 15:08:10 -0700 From: Ricardo Neri To: Nicholas Piggin Cc: Thomas Gleixner , x86@kernel.org, Andi Kleen , Andrew Morton , Lu Baolu , David Woodhouse , Stephane Eranian , iommu@lists.linux-foundation.org, Joerg Roedel , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, "Ravi V. Shankar" , Ricardo Neri , Suravee Suthikulpanit , Tony Luck Subject: Re: [PATCH v6 28/29] x86/tsc: Restart NMI watchdog after refining tsc_khz Message-ID: <20220517220810.GB6711@ranerica-svr.sc.intel.com> References: <20220506000008.30892-1-ricardo.neri-calderon@linux.intel.com> <20220506000008.30892-29-ricardo.neri-calderon@linux.intel.com> <1652180070.1r874kr0tg.astroid@bobo.none> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1652180070.1r874kr0tg.astroid@bobo.none> User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Tue, May 10, 2022 at 09:16:21PM +1000, Nicholas Piggin wrote: > Excerpts from Ricardo Neri's message of May 6, 2022 10:00 am: > > The HPET hardlockup detector relies on tsc_khz to estimate the value of > > that the TSC will have when its HPET channel fires. A refined tsc_khz > > helps to estimate better the expected TSC value. > > > > Using the early value of tsc_khz may lead to a large error in the expected > > TSC value. Restarting the NMI watchdog detector has the effect of kicking > > its HPET channel and make use of the refined tsc_khz. > > > > When the HPET hardlockup is not in use, restarting the NMI watchdog is > > a noop. > > > > Cc: Andi Kleen > > Cc: Stephane Eranian > > Cc: "Ravi V. Shankar" > > Cc: iommu@lists.linux-foundation.org > > Cc: linuxppc-dev@lists.ozlabs.org > > Cc: x86@kernel.org > > Signed-off-by: Ricardo Neri > > --- > > Changes since v5: > > * Introduced this patch > > > > Changes since v4 > > * N/A > > > > Changes since v3 > > * N/A > > > > Changes since v2: > > * N/A > > > > Changes since v1: > > * N/A > > --- > > arch/x86/kernel/tsc.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c > > index cafacb2e58cc..cc1843044d88 100644 > > --- a/arch/x86/kernel/tsc.c > > +++ b/arch/x86/kernel/tsc.c > > @@ -1386,6 +1386,12 @@ static void tsc_refine_calibration_work(struct work_struct *work) > > /* Inform the TSC deadline clockevent devices about the recalibration */ > > lapic_update_tsc_freq(); > > > > + /* > > + * If in use, the HPET hardlockup detector relies on tsc_khz. > > + * Reconfigure it to make use of the refined tsc_khz. > > + */ > > + lockup_detector_reconfigure(); > > I don't know if the API is conceptually good. > > You change something that the lockup detector is currently using, > *while* the detector is running asynchronously, and then reconfigure > it. Yes, this is what happens. > What happens in the window? If this code is only used for small > adjustments maybe it does not really matter Please see my comment > but in principle it's a bad API to export. > > lockup_detector_reconfigure as an internal API is okay because it > reconfigures things while the watchdog is stopped I see. > [actually that looks untrue for soft dog which uses watchdog_thresh in > is_softlockup(), but that should be fixed]. Perhaps there should be a watchdog_thresh_user. When the user updates it, the detector is stopped, watchdog_thresh is updated, and then the detector is resumed. > > You're the arch so you're allowed to stop the watchdog and configure > it, e.g., hardlockup_detector_perf_stop() is called in arch/. I had it like this but it did not look right to me. You are right, however, I can stop/restart the watchdog when needed. Thanks and BR, Ricardo