8 8
linda

pine64: massive date/time clock problem

Recommended Posts

On 8/20/2019 at 2:32 PM, martinayotte said:

Do you have "CONFIG_SUN50I_ERRATUM_UNKNOWN1=y" in /boot/config-4.19.63-sunxi64 ?

 

 

I followed all the threads and checked all the config settings, I have this and all the others you usually ask enabled.

 

and for the record, it happened again this morning. 

 

Share this post


Link to post
Share on other sites
3 hours ago, mrstone78 said:

I have this and all the others you usually ask enabled.

Strange ...

I've a Pine64, OPiWin and OlinuxinoA64 and none of them got the issue since months ...

Maybe @smaeul can give more details since he is the author of the latest patch ?

 

Share this post


Link to post
Share on other sites

I got tired of trying to cleanup after the Pine A64/Armbian clock skips and shut off the board for a few months.

 

Then I came across this linux 5.3 patch for the Allwinner clock

https://github.com/torvalds/linux/commit/c950ca8c35eeb32224a63adc47e12f9e226da241

 

The stock 5.3-rc5 kernel built on the pine64 and installed without much trouble. Its been a day and a half under fairly heavy load (a heavy load would increase the frequency of clock skips) with no skips yet so I am cautiously optimistic.

 

the new clock fix kernel flag is: (already set in the tarball below)

CONFIG_SUN50I_ERRATUM_UNKNOWN1=y

 

If someone wants to try this on their own board without having to complie the kernel, I tar'ed up the kernel, modules, and /boot bits.

 

https://donp.org/linux-5.3-rc5-pinea64.tar.xz

 

By moving the /boot symlinks, the board should boot into this kernel:

 

lrwxrwxrwx  1 root root       11 Aug 21  2116 dtb -> dtb-5.3-rc5
lrwxrwxrwx  1 root root       17 Oct 13  2114 Image -> vmlinuz-5.3.0-rc5
lrwxrwxrwx  1 root root       17 Oct 13  2114 uInitrd -> uInitrd-5.3.0-rc5

 

haha you can see the timestamps of the symlinks happened after a clock skip.

 

Don

 

Share this post


Link to post
Share on other sites
21 hours ago, Don Park said:

Then I came across this linux 5.3 patch for the Allwinner clock

As you can see in this commit, it was originally introduced during v5.1-rc1 in January.

It is exactly the same patch that Armbian is using since months ...

Share this post


Link to post
Share on other sites

Ah perhaps I read the bottom row wrong, where it was saying 5.3-rc5 that was the most recent tag and not the tag that contains the patch.

 

For someone who has a pine A64 today, what armbian build should be used? The ones on https://www.armbian.com/pine64/ report kernel 4.19.

Share this post


Link to post
Share on other sites
On 8/22/2019 at 2:08 PM, martinayotte said:

I've a Pine64, OPiWin and OlinuxinoA64 and none of them got the issue since months ...

 

What can I say, lucky you :)

 

 

FTR, it just happened again. 

In the meantime I had updated the kernel to 5.3.0-rc3-sunxi64

 

Share this post


Link to post
Share on other sites

Hi guys!
Facing the same issue :)
 

$ date  
Thu Oct 25 18:17:22 UTC 2114

$ uname -a
Linux pine64so-node6 4.19.57-sunxi64 #5.90 SMP Fri Jul 5 18:38:49 CEST 2019 aarch64 aarch64 aarch64 GNU/Linux

$ grep CONFIG_SUN50I_ERRATUM_UNKNOWN1 /boot/config-4.19.57-sunxi64 
CONFIG_SUN50I_ERRATUM_UNKNOWN1=y

 

Share this post


Link to post
Share on other sites

I switched to 5.3.0-rc3, but not work. After +/- 8 days.

 

Welcome to Debian Stretch with Armbian Linux 5.3.0-rc3-sunxi64
System load:   0.82 0.73 0.70  	Up time:       24855 days	

# date
Sat Dec 16 19:19:42 -03 2209

 

Share this post


Link to post
Share on other sites
12 hours ago, ams.br said:

I switched to 5.3.0-rc3, but not work. After +/- 8 days.

 


Welcome to Debian Stretch with Armbian Linux 5.3.0-rc3-sunxi64
System load:   0.82 0.73 0.70  	Up time:       24855 days	

# date
Sat Dec 16 19:19:42 -03 2209

 

This was same for me.

Share this post


Link to post
Share on other sites

I compiled the kernel (branch next 4.19.y) applying a patch based in https://github.com/arctype-co/linux/commit/5fcb4e57eeaa4d670ef4acf5818c6fe16aa0d3d0

 

Strikes me as a more stable workaround, but I'm still evaluating.

 

 

Patch:

--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -328,16 +328,17 @@
  * number of CPU cycles in 3 consecutive 24 MHz counter periods.
  */
 #define __sun50i_a64_read_reg(reg) ({                                  \
-       u64 _val;                                                       \
-       int _retries = 150;                                             \
+       u64 _old, _new;                                                 \
+       int _retries = 200;                                             \
                                                                        \
        do {                                                            \
-               _val = read_sysreg(reg);                                \
+               _old = read_sysreg(reg);                                \
+                _new = read_sysreg(reg);                               \
                _retries--;                                             \
-       } while (((_val + 1) & GENMASK(9, 0)) <= 1 && _retries);        \
+       } while (unlikely(_old != _new) && _retries);                   \
                                                                        \
        WARN_ON_ONCE(!_retries);                                        \
-       _val;                                                           \
+       _new;                                                           \
 })
 
 static u64 notrace sun50i_a64_read_cntpct_el0(void)

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
8 8