Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp472334pxh; Wed, 10 Nov 2021 04:50:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZKSfKbpzyzO/l6bNxgn7Gal9Sin5VHglKeolqyhAd0dbtxDmjoaOh51iK0YgK5swGI+gM X-Received: by 2002:a17:906:dbef:: with SMTP id yd15mr20198610ejb.354.1636548628394; Wed, 10 Nov 2021 04:50:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636548628; cv=none; d=google.com; s=arc-20160816; b=UudgnaANRzgIq61cO7DLWC6vhxBpFySnn/vMuHkdf3xugC9IsGlLCvYqlqCzhjTp/m jEF6xcsMamlahZYlxPCfisIPYKmcBQmE4e3lUE/rzsKlrhLjDN+vv+NdUmpf/eIcM/8v 03LraSlOy/lAl7IetquMMxA3MPbcgZuByUq2m8tliNaehG1gpl0WNLs8n9smrJuHUbWI VNGjq9xYhbMQTKcA2N/XtbqGt9PfhTvh7Jyz7SQ/73McaGvKlm4z2ZQcCWUA9QFBtu8d LiNGsufxNOVur4n3eR5s7eAf+P+XINuSsCOeICQXxq6Z8TI/Ur3rAYhKaQ7N69w+YLxl jH2w== 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=hN8gRack7jr4grRfy9qd5KbJqskjUm7vjjv4JU/N94s=; b=povxoow2JwFHdBcJUXAWzk+cEX80phvSngOfVhUFeFyxtHpLr79nh4ZrEI8/erRf2g s4Yv9HuewjD9pcngglu6gI7JgJ5ZI5OHnCr5r04YfwSACCNXEqBvODEKh09FhNBETHP2 d7Ltp1gXt6WAGwcrwvnZC22+lDGLRtz5siwdtAE11UIER3BLWBY0l9b39/S+cNGxSoqI +9tHVygReBFy98kjuP9dkdW/CtnD+nau4uMVXXPeFwcdFi+Mng1jQ80+Uj+GyDm/OJql O9EvUhU9xgvU/JpVEebVblKpecB/f528vQPN53+VYI789Ie/xETZSQlWVlEikHgGAs2F gBxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OmED0I1V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nb27si43365429ejc.336.2021.11.10.04.50.03; Wed, 10 Nov 2021 04:50:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OmED0I1V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S231761AbhKJMvJ (ORCPT + 99 others); Wed, 10 Nov 2021 07:51:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:35830 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231210AbhKJMvI (ORCPT ); Wed, 10 Nov 2021 07:51:08 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4D27C61038; Wed, 10 Nov 2021 12:48:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636548501; bh=pm0d6lfxt8O+eIsLRFeukWvOkeMhX6O8nYjnhXPCqxA=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=OmED0I1V5Xw8pLiH22MczeykgxtLWQ4Sx2oWdb8abdmCPElKeuOi75U3EsBXE9Fqy 56T6P1fEfG2U6TLxoNUnGsmywim6cu3nbEzg7qc58dKkCraEXJhV0NUV515tMeRbr0 /gb23SOdg+UsX9SIHPZdpvXdeszoQBnJ9WgrdqH4H/I9U12Uaph16IktbfI71RDQHJ tXWQ6+BrS0q6g8pr2TnZnzPwGtsAf3I+lYQA+jzM9oIJR35/qeqHxtCwGjxlrEPVyT Naaku+WefuZ3rewQNF6I5SeiM1Bt+OVPmPuxO3/1mDCpQIrnpGyWK22/33lFBzcKlK ZXZFV63hnxeKA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 159ED5C0527; Wed, 10 Nov 2021 04:48:21 -0800 (PST) Date: Wed, 10 Nov 2021 04:48:21 -0800 From: "Paul E. McKenney" To: Heiner Kallweit Cc: John Stultz , Thomas Gleixner , Stephen Boyd , Feng Tang , Linux Kernel Mailing List Subject: Re: [PATCH] clocksource: Improve cs_watchdog_read() Message-ID: <20211110124821.GZ641268@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <8f13ba8d-03b5-76de-4d59-4ca8786afb83@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8f13ba8d-03b5-76de-4d59-4ca8786afb83@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 09, 2021 at 09:55:08PM +0100, Heiner Kallweit wrote: > If max_cswd_read_retries is set to 0 or 1 then the current warning > behavior doesn't seem to make too much sense to me. > If set to 0, then we'd warn with each watchdog run. > If set to 1, then we'd warn at the first retry, even though the commit > description of db3a34e17433 states that one retry is expected behavior. > If printing a message at all in this case, then it should be debug > level. The behavior for max_cswd_read_retries==1 is exactly what you want when you are checking to see whether or not your system would retry at all for the duration of a given run. The behavior for max_cswd_read_retries==0 is exactly what you want when you are testing the ability to print that message on a system that will not do a retry in a reasonable period of time. Or am I missing something here? > Whilst being at it, move declaration of wd_end and wd_delta into the > loop and remove not needed braces. I am OK with moving those two variables into the "for" loop. I am personally OK removing the braces, but if I remember correctly, my upstream maintainer asked that I add them due to the statement being split across two lines. Thanx, Paul > Signed-off-by: Heiner Kallweit > --- > kernel/time/clocksource.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c > index f29d1a524..8c0be9c02 100644 > --- a/kernel/time/clocksource.c > +++ b/kernel/time/clocksource.c > @@ -208,10 +208,11 @@ module_param(verify_n_cpus, int, 0644); > static bool cs_watchdog_read(struct clocksource *cs, u64 *csnow, u64 *wdnow) > { > unsigned int nretries; > - u64 wd_end, wd_delta; > int64_t wd_delay; > > for (nretries = 0; nretries <= max_cswd_read_retries; nretries++) { > + u64 wd_end, wd_delta; > + > local_irq_disable(); > *wdnow = watchdog->read(watchdog); > *csnow = cs->read(cs); > @@ -222,10 +223,9 @@ static bool cs_watchdog_read(struct clocksource *cs, u64 *csnow, u64 *wdnow) > wd_delay = clocksource_cyc2ns(wd_delta, watchdog->mult, > watchdog->shift); > if (wd_delay <= WATCHDOG_MAX_SKEW) { > - if (nretries > 1 || nretries >= max_cswd_read_retries) { > + if (nretries > 1) > pr_warn("timekeeping watchdog on CPU%d: %s retried %d times before success\n", > smp_processor_id(), watchdog->name, nretries); > - } > return true; > } > } > -- > 2.33.1 >