From: Roman Stratiienko <r.stratiienko@gmail.com>
To: linux-sunxi@googlegroups.com
Cc: megous@megous.com, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Roman Stratiienko <r.stratiienko@gmail.com>
Subject: [PATCH] RFC: arm64: arch_timer: Fix timer inconsistency test for A64
Date: Tue, 29 Sep 2020 14:13:47 +0300 [thread overview]
Message-ID: <20200929111347.1967438-1-r.stratiienko@gmail.com> (raw)
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 <r.stratiienko@gmail.com>
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)
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2020-09-29 11:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-29 11:13 Roman Stratiienko [this message]
2020-09-29 11:35 ` [PATCH] RFC: arm64: arch_timer: Fix timer inconsistency test for A64 Ondřej Jirman
2020-09-29 15:40 ` Mark Rutland
2020-09-30 1:00 ` Samuel Holland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200929111347.1967438-1-r.stratiienko@gmail.com \
--to=r.stratiienko@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@googlegroups.com \
--cc=megous@megous.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox