Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2390110rwb; Thu, 29 Sep 2022 09:34:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6frKpxRuYm+mCtN03/T+vAOfDxcUBuNA0Mja1ZNWhO52XnvUCHjTg8OivS3PeHzYcABtjS X-Received: by 2002:a17:907:7287:b0:783:ad45:27aa with SMTP id dt7-20020a170907728700b00783ad4527aamr3372460ejc.99.1664469271358; Thu, 29 Sep 2022 09:34:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664469271; cv=none; d=google.com; s=arc-20160816; b=Oei78yfQVonSxZB+9g5s6lTV6lyZ5YlQvgLBxojkb0aAa/TNxLX6P+5YlZ+E4hj3m6 tn+ZvQsYE8IuMGZP8oypgQ8skwcCeV/wHYxVgFA/SCeDp5DHXFz+LhJXR5HszfUZ1KAD 7LBxRNVXFFWyePeJ7P/fFtbBu+scZd7IALbmlOfPNOxSqH6vntvSQ3kv6MDXXkEi78VE 0VpjvD1VMoInauGLJtm/4El9xxfxNj8YDkGtVWyxsk7HS4gE7UZd0XorOdrzE04zOGHM /2Q+AmKOKnDmaf3UPA4kNCwcbAFrS+wqzpy99CKcxZB3IATtrgteWo1us6PXFbHSpUo7 GFPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id; bh=8+laHeUyWTjGawKt7bgxY/JNahgQifq31+sUOqXjx2o=; b=cTKSfiVsrlFusxyqTEU4soKcLV5YYkK4lpSoWtlhKWXe8YPRzJW06rqYlA+k+YU1db bOTzvKimY/kl8VHw5z3mP4ABYcCzl8YA0Wgbo2PjlykoCeUwWwYP/nksKX5RnEqo6zF3 tX2hzBqg98Zb0zRv2n4HSL52QbrFAhGOuje5gt0O0ukKPccqLUewn0dirTK0EuakAEdv +0atltjPrv2w6vR87DAXcNL+GmbHnxX7kWdtKF1Nbi7zuJXHmVj6u0lwajEr6IROQfXy weA/ip5mRuu4yLi5WsoWvLlRK46nmt+Kp4F71GNcDo+S6lxvBPSDYhZicZByEnPMtU+N B4LQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di12-20020a170906730c00b00782b24c1ed8si1971724ejc.368.2022.09.29.09.34.05; Thu, 29 Sep 2022 09:34:31 -0700 (PDT) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235852AbiI2Px6 (ORCPT + 99 others); Thu, 29 Sep 2022 11:53:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235962AbiI2Pxb (ORCPT ); Thu, 29 Sep 2022 11:53:31 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 841D41BEA4E for ; Thu, 29 Sep 2022 08:53:17 -0700 (PDT) Received: from dggpeml500022.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Mdd7D5F2BzHtlg; Thu, 29 Sep 2022 23:48:24 +0800 (CST) Received: from dggpeml500003.china.huawei.com (7.185.36.200) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 29 Sep 2022 23:53:13 +0800 Received: from [10.174.177.173] (10.174.177.173) by dggpeml500003.china.huawei.com (7.185.36.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 29 Sep 2022 23:53:12 +0800 Message-ID: <9d3bf570-3108-0336-9c52-9bee15767d29@huawei.com> Date: Thu, 29 Sep 2022 23:52:28 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 Subject: Re: [PATCH] x86/PCI: Convert force_disable_hpet() to standard quirk To: Zhang Rui , Thomas Gleixner , Feng Tang CC: Bjorn Helgaas , Ingo Molnar , Borislav Petkov , , , Bjorn Helgaas , "Kai-Heng Feng" , , , Xie XiuQi References: <20201119181904.149129-1-helgaas@kernel.org> <87v9dtk3j4.fsf@nanos.tec.linutronix.de> <20201126012421.GA92582@shbuild999.sh.intel.com> <87eekfk8bd.fsf@nanos.tec.linutronix.de> <20201127061131.GB105524@shbuild999.sh.intel.com> <87eekairc0.fsf@nanos.tec.linutronix.de> Content-Language: en-US From: Yu Liao In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.173] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500003.china.huawei.com (7.185.36.200) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00,HK_RANDOM_ENVFROM, HK_RANDOM_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_MED,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 2020/12/2 15:28, Zhang Rui wrote: > On Mon, 2020-11-30 at 20:21 +0100, Thomas Gleixner wrote: >> Feng, >> >> On Fri, Nov 27 2020 at 14:11, Feng Tang wrote: >>> On Fri, Nov 27, 2020 at 12:27:34AM +0100, Thomas Gleixner wrote: >>>> On Thu, Nov 26 2020 at 09:24, Feng Tang wrote: >>>> Yes, that can happen. But OTOH, we should start to think about >>>> the >>>> requirements for using the TSC watchdog. > > My original proposal is to disable jiffies and refined-jiffies as the > clocksource watchdog, because they are not reliable and it's better to > use clocksource that has a hardware counter as watchdog, like the patch > below, which I didn't sent out for upstream. > >>From cf9ce0ecab8851a3745edcad92e072022af3dbd9 Mon Sep 17 00:00:00 2001 > From: Zhang Rui > Date: Fri, 19 Jun 2020 22:03:23 +0800 > Subject: [RFC PATCH] time/clocksource: do not use refined-jiffies as watchdog > > On IA platforms, if HPET is disabled, either via x86 early-quirks, or > via kernel commandline, refined-jiffies will be used as clocksource > watchdog in early boot phase, before acpi_pm timer registered. > > This is not a problem if jiffies are accurate. > But in some cases, for example, when serial console is enabled, it may > take several milliseconds to write to the console, with irq disabled, > frequently. Thus many ticks may become longer than it should be. > > Using refined-jiffies as watchdog in this case breaks the system because > a) duration calculated by refined-jiffies watchdog is always consistent > with the watchdog timeout issued using add_timer(), say, around 500ms. > b) duration calculated by the running clocksource, usually TSC on IA > platforms, reflects the real time cost, which may be much larger. > This results in the running clocksource being disabled erroneously. > > This is reproduced on ICL because HPET is disabled in x86 early-quirks, > and also reproduced on a KBL and a WHL platform when HPET is disabled > via command line. > > BTW, commit fd329f276eca > ("x86/mtrr: Skip cache flushes on CPUs with cache self-snooping") is > another example that refined-jiffies causes the same problem when ticks > become slow for some other reason. Hi, Zhang Rui, we have met the same problem as you mentioned above. I have tested the following modification. It can solve the problem. Do you have plan to push it to upstream ? Thanks, Liao Yu > > IMO, the right solution is to only use hardware clocksource as watchdog. > Then even if ticks are slow, both the running clocksource and the watchdog > returns real time cost, and they still match. > > Signed-off-by: Zhang Rui > --- > kernel/time/clocksource.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c > index 02441ead3c3b..e7e703858fa6 100644 > --- a/kernel/time/clocksource.c > +++ b/kernel/time/clocksource.c > @@ -364,6 +364,10 @@ static void clocksource_select_watchdog(bool fallback) > watchdog = NULL; > > list_for_each_entry(cs, &clocksource_list, list) { > + /* Do not use refined-jiffies as clocksource watchdog */ > + if (cs->rating <= 2) > + continue; > + > /* cs is a clocksource to be watched. */ > if (cs->flags & CLOCK_SOURCE_MUST_VERIFY) > continue;