Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp145160iob; Tue, 17 May 2022 21:46:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGynsEjfLuLY3D1k/OrAgMdzLctop5ZLlu6UPjXkA28Mla0wCBvudv+UXPgBPk/Ialr6EH X-Received: by 2002:a17:902:e745:b0:15e:c057:d452 with SMTP id p5-20020a170902e74500b0015ec057d452mr25794096plf.69.1652849206831; Tue, 17 May 2022 21:46:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652849206; cv=none; d=google.com; s=arc-20160816; b=t31hycKiNRsJCpIDaG8lKS+6e9Pu/I2qKdy+j2Uqk9+UQXcgCaLLZEhi/axqNtVerk 92uDnIfjvaaTRQTLxMm3U/6lqF514AOM57VtFQX6Y0hUtMfT8MMGqL3QVq7e52vxSYQg m8fuFRb1z3ZhvD6x4jWtkBQlx/ebo6j9yGIXD6Xy+3b77aBwvuz6tJxscEcsZShsDAC6 7BrKbIITTwB4zN/jHL/ZBYBA47TzW0i2sf6Bay5xv+JeUjBOZBAtrk2CY/7WEImM0A+P sPWSKTJHD6Osss/5rWf5tSNaN/gUTm/DO2DW40kUdI131pNzcNZbEdrK/0/CItJsQ8fb aFcA== 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=INptKX/gZkV5SBE4OoHCp1dVngTu/gUNeDSAAcR8Avo=; b=jB9msBtlwlxwKUI+QtvcyCq7OPlZ7vv9r4BFRBFDXUAGQqNNRDs1TlAuFR4pIHZX1r NcqBaX7rH4nZt6PixXGnXicPll0q/++Zoi3Sq0iYF1GEfBsKVpQf+dk0FqwV176k0ekG LXPRrUezeGTwd+Q1ly9p799mrXfJLTfWTiJpJfaeLt1IosH6El0UYp9Y5JbPmfygeeG3 tTuYtFx408Shjx/yU77BNpVF9QKg8qnngYrQ0kaddFD1ZE1kCwQnH/MmjCA0uWhDj0sz OkcW6xpK3gp/1yeSLKCdz1d3zHDut0/Lb7nMbNPJAbIdHG3ghHK6qp76i3HYf5xf+ASj MlWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KW0YKMPM; 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 188-20020a6303c5000000b003f608884958si589475pgd.712.2022.05.17.21.46.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 21:46:46 -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=KW0YKMPM; 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 4F6701053D6; Tue, 17 May 2022 20:58:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231451AbiEQWta (ORCPT + 99 others); Tue, 17 May 2022 18:49:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231447AbiEQWt1 (ORCPT ); Tue, 17 May 2022 18:49:27 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83CA552E6E for ; Tue, 17 May 2022 15:49:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652827766; x=1684363766; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=eW9eeCQ/ZnkVlQzYhrGw1tL7ydi/5swHvLwwK3+msYw=; b=KW0YKMPMHh9jm84ggUkMVPwKKOogXdXo6lACmg6OLYJajbhpC5oExT8u TCjQUzBLtEQe1LbQ8Imhpxv/vK7HUBRQA8aqj3m+v0sp8cZbv5u0uz5G0 BUDQIKfBaQ81TCPHJVaqlnNIyH9qjsmwEnGOt5Wm4lmWal2Cp/8/2ylS0 cflszpzJ8APD/LE4QUQhXtuJnLJiAIw0BlvxBOQhYCz3OW7CTzM+Zj81c jKgWu0giJU+BhDT9A6xpdHfuMvouxCFQbAobiMB37WPTXctjwJ2i4dyBw 8OUYyLKLozM6eLRrcDYTRLayD58i+krSeEQSQ7NLsZRkRMeEk6l5GmKbB Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10350"; a="331980533" X-IronPort-AV: E=Sophos;i="5.91,233,1647327600"; d="scan'208";a="331980533" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2022 15:49:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,233,1647327600"; d="scan'208";a="626709312" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by fmsmga008.fm.intel.com with ESMTP; 17 May 2022 15:49:25 -0700 Date: Tue, 17 May 2022 15:53:08 -0700 From: Ricardo Neri To: Thomas Gleixner Cc: Nicholas Piggin , 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: <20220517225308.GC6711@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> <87ilqdpq7u.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87ilqdpq7u.ffs@tglx> 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 01:44:05PM +0200, Thomas Gleixner wrote: > On Tue, May 10 2022 at 21:16, Nicholas Piggin wrote: > > Excerpts from Ricardo Neri's message of May 6, 2022 10:00 am: > >> + /* > >> + * 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. What happens in the window? If this code is only used for small > > adjustments maybe it does not really matter 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 [actually that > > looks untrue for soft dog which uses watchdog_thresh in > > is_softlockup(), but that should be fixed]. > > > > 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/. > > > > So you want to disable HPET watchdog if it was enabled, then update > > wherever you're using tsc_khz, then re-enable. > > The real question is whether making this refined tsc_khz value > immediately effective matters at all. IMO, it does not because up to > that point the watchdog was happily using the coarse calibrated value > and the whole use TSC to assess whether the HPET fired mechanism is just > a guestimate anyway. So what's the point of trying to guess 'more > correct'. In some of my test systems I observed that, the TSC value does not fall within the expected error window the first time the HPET channel expires. I inferred that the error computed using the coarser tsc_khz was wrong. Recalculating the error window with refined tsc_khz would correct it. However, restarting the timer has the side-effect of kicking the timer and, therefore pushing the first HPET NMI further in the future. Perhaps kicking HPET channel, not recomputing the error window, corrected (masked?) the problem. I will investigate further and rework or drop this patch as needed. Thanks and BR, Ricardo