From patchwork Tue Sep 29 11:13:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Stratiienko X-Patchwork-Id: 11805645 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 130966CA for ; Tue, 29 Sep 2020 11:14:21 +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 BC8F721D46 for ; Tue, 29 Sep 2020 11:14:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="F9e41iad"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CuDfLigk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BC8F721D46 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=DNoU2TFIJ0YPpmptvHmj1fo0SxNgQPL4tc0caxGujLU=; b=F9e41iadfOD5SKngnmnwVqgRP7 MqzZ7pY/TLJ98Y5aCn2wU7trjWwkuSws3J9utAhxb/40Je49IER5qmG0KfD02dG6dkm1+PuIBYu/o C0bczylSLX2DDhlndMFTrA4TujzDqkZiwXnoldgri68Aotv2eWz+KPR+n3NNjSP9ouKbb0b+enIXT zph7bK+KfJ92Ft8ltCOVmRh/ENUrgClnI1iRDj7f+cU/AfNH0/ZMLJhoPdI0q5syl2N3m/AJIKV1g PKEBJfTGqOV2JXW6KY7OI28mRmEe/9KXZ69lbM7yJnj3TmMOAVvN0w6pVIo2CTDdyKzlH882w0ael p925Yjsw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNDaC-0007ts-Nd; Tue, 29 Sep 2020 11:14:08 +0000 Received: from mail-lf1-x143.google.com ([2a00:1450:4864:20::143]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNDaA-0007sz-5s for linux-arm-kernel@lists.infradead.org; Tue, 29 Sep 2020 11:14:06 +0000 Received: by mail-lf1-x143.google.com with SMTP id b22so4986041lfs.13 for ; Tue, 29 Sep 2020 04:14:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OZ4P5eCNZlIGtDfFRqaX5188qIJ0Vd0GiDBdv3mnk2A=; b=CuDfLigkzrEE4BwFSYuMI1CE2TAXddfC2W4sMUVP2B78n8wvCD3c0UcaD2dtzvWr/X Z8/+8I5bhKS4pQHy6t3vEKFJ/x42hdPx4mQkwNgM4q5jVQZo9wh3ABeM706zzaRX9bKA zFLm5+BXNtjaBTFkC+mn7cM1eAu59isJ1zepfEX5F4x7JVc8R6GnvPXQTh6ILsK9hsv7 oGZQOrqrs1IiPsdftd762nGKhPhC40X1SIJP00N3DEhCV0AJ+5b7W15fI5vAMk8mE1OY 2JXDnxyzRSliB6jOpsnKamDB+jkjscry0cUEifAj+jtNGkdZEcNGlUIgvGpUFaoKjTwY bIXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OZ4P5eCNZlIGtDfFRqaX5188qIJ0Vd0GiDBdv3mnk2A=; b=Cf+cMjDYesHwWvuz2xSMXSRZDOSv3p+kFWVu8rHJdEhRC12zrfTh460iyszSw5FomX 6DqbNgibiopeYsBBFIEDM0vtMHRJgPvi1Uy08u4fsFze57S3VaOVp0x6nyAosD4+Icdb qeVmcHF0lVl+DH9SW9NG9Hjw4R/Ll6F7ytdSVDWa+lJoM+nHXvhAWSJE91j+aTcuBDxV hWQP3ywuSK124uSfeMNQcE1MR1mjh5pxlV8EWmCwfRglMYP2/AGgEcjT7wQjvKUo1O+n dqM/PsBbWJGyGbscBiF2PhG/fFMVlRrJDXAJ1Ws5hjhS8z5+CwvReVueQ+B5Nr0VZDzz dPng== X-Gm-Message-State: AOAM5312zW/9dGEoIhvoONTjizJHDjljkGbnFJIJT2W3lnLq4VI6fcWT x38RUYg5QZKuqz7x1gSy6Co= X-Google-Smtp-Source: ABdhPJwbsr4KqP9lUr/SPd0wqLe4sfUt3aQq9LtrAq87Ab3XluvBzFUACLuvEsdnhnPUmq2oWiBA5g== X-Received: by 2002:a19:be0b:: with SMTP id o11mr963382lff.117.1601378043293; Tue, 29 Sep 2020 04:14:03 -0700 (PDT) Received: from localhost.localdomain ([149.255.130.5]) by smtp.gmail.com with ESMTPSA id z7sm3199419lfb.221.2020.09.29.04.14.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 04:14:02 -0700 (PDT) From: Roman Stratiienko To: linux-sunxi@googlegroups.com Subject: [PATCH] RFC: arm64: arch_timer: Fix timer inconsistency test for A64 Date: Tue, 29 Sep 2020 14:13:47 +0300 Message-Id: <20200929111347.1967438-1-r.stratiienko@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200929_071406_266201_9177F233 X-CRM114-Status: GOOD ( 12.31 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:143 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [r.stratiienko[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Roman Stratiienko Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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 -------------------- 1601335525:467099095 1601335525:467099845 1601335525:467100637 1601335525:467101387 1601335525:467102179 1601335525:467102929 ''' 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); \ \ WARN_ON_ONCE(!_retries); \ - _val; \ + _val2; \ }) static u64 notrace sun50i_a64_read_cntpct_el0(void)