From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23D6CC4727C for ; Tue, 29 Sep 2020 15:43:04 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7D1FC206CD for ; Tue, 29 Sep 2020 15:43:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="da08NU4C" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D1FC206CD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kT3rJ9YpvfD8SFz55ayem+HRIhlZdrMKgHwpNfuXwP4=; b=da08NU4C5MYKuAHbuKSgRcZHL cI+ShPwjdaK2BHilGLesL14XH6HtcMnXOk2LvAFYmXNM9WL52q0xUMF+Khrid+js8+MjkcprMfBfK Z57F8KT2foy95QrMFsmnFLTAw4Mt3qIs4VJYOckrWX2fq1W1TyLLzrZpnDo+bnU1EBazor44uFlfm 195IrZZw1ri/Hs8f46PFrWnqNUMXs9V/hC5k+wIbVxk7+jqOeP8f1NDhZcWs8lyVrbZBaPAC7ePzP G13Rq5uryzSjg6KbJV343tXwoEUeQAUbbtV9L5Ny48A9CYAIHMtfSfRWRyJgJQiFb4XyGXRUkG1Hd go+jGlR5g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNHjr-0004Yt-VD; Tue, 29 Sep 2020 15:40:23 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNHjp-0004YY-FL for linux-arm-kernel@lists.infradead.org; Tue, 29 Sep 2020 15:40:22 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 36A941063; Tue, 29 Sep 2020 08:40:17 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.51.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A44C43F70D; Tue, 29 Sep 2020 08:40:15 -0700 (PDT) Date: Tue, 29 Sep 2020 16:40:12 +0100 From: Mark Rutland To: Roman Stratiienko Subject: Re: [PATCH] RFC: arm64: arch_timer: Fix timer inconsistency test for A64 Message-ID: <20200929154012.GF53442@C02TD0UTHF1T.local> References: <20200929111347.1967438-1-r.stratiienko@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200929111347.1967438-1-r.stratiienko@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200929_114021_592158_4C80CC47 X-CRM114-Status: GOOD ( 20.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: megous@megous.com, maz@kernel.org, linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, Please Cc maintainers for drivers -- Marc and I maintain the arch timer driver. On Tue, Sep 29, 2020 at 02:13:47PM +0300, Roman Stratiienko wrote: > Fixes linux_kselftest:timers_inconsistency-check_arm_64 > > Test logs without the fix: > ''' > binary returned non-zero. Exit code: 1, stderr: , stdout: > Consistent CLOCK_REALTIME > 1601335525:467086804 > 1601335525:467087554 > 1601335525:467088345 > 1601335525:467089095 > 1601335525:467089887 > 1601335525:467090637 > 1601335525:467091429 > 1601335525:467092179 > 1601335525:467092929 > 1601335525:467093720 > 1601335525:467094470 > 1601335525:467095262 > 1601335525:467096012 > 1601335525:467096804 > -------------------- > 1601335525:467097554 > 1601335525:467077012 That's 0x1BD757D2 followed by 0x1BD70794. The rollback is somewhere in bits 15:12 to go from 0x1BD75xxx to 0x1BD70xxx, which suggests the analysis in the existing comment is incomplete. > -------------------- > 1601335525:467099095 > 1601335525:467099845 > 1601335525:467100637 > 1601335525:467101387 > 1601335525:467102179 > 1601335525:467102929 > ''' It would be very helpful if the commit message could explain the rough idea behind the change, because the rationale is not clear to me. > Signed-off-by: Roman Stratiienko > CC: linux-arm-kernel@lists.infradead.org > CC: linux-kernel@vger.kernel.org > CC: linux-sunxi@googlegroups.com > CC: megous@megous.com > --- > drivers/clocksource/arm_arch_timer.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c > index 6c3e841801461..d50aa43cb654b 100644 > --- a/drivers/clocksource/arm_arch_timer.c > +++ b/drivers/clocksource/arm_arch_timer.c > @@ -346,16 +346,17 @@ static u64 notrace arm64_858921_read_cntvct_el0(void) > * number of CPU cycles in 3 consecutive 24 MHz counter periods. > */ > #define __sun50i_a64_read_reg(reg) ({ \ > - u64 _val; \ > + u64 _val1, _val2; \ > int _retries = 150; \ > \ > do { \ > - _val = read_sysreg(reg); \ > + _val1 = read_sysreg(reg); \ > + _val2 = read_sysreg(reg); \ > _retries--; \ > - } while (((_val + 1) & GENMASK(9, 0)) <= 1 && _retries); \ > + } while (((_val2 - _val1) > 0x10) && _retries); \ This is going to fail quite often at low CPU frequencies, and it's not clear to me that this solves the problem any more generally. DO we know what the underlying erratum is here? Thanks, Mark. > \ > WARN_ON_ONCE(!_retries); \ > - _val; \ > + _val2; \ > }) > > static u64 notrace sun50i_a64_read_cntpct_el0(void) > -- > 2.25.1 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel