[Letux-kernel] jz4730-i2c - clocksource

H. Nikolaus Schaller hns at goldelico.com
Fri Mar 5 13:28:58 CET 2021


> Am 05.03.2021 um 11:16 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
> 
> Hi Paul,
> I have switched to attempt a different debugging approach.
> 
> The key observation is that we can boot with clocksource=jiffies.
> And we can switch through /sys to clocksource=ingenic-timer.
> 
> The ingenic-timer seems to be running well (incl. interrupts),
> at least if I boot to login:
> 
> Here is some log what happens if we switch the clock source:
> 
> 
> root at letux:~# cat /proc/interrupts 
>           CPU0       
>  2:     144402      MIPS   2  SoC intc cascade interrupt
>  9:       1322      INTC   9  ttyS0
> 14:       7368      INTC  14  10021000.mmc
> 15:          0     GPIOA   0  matrix-keypad
> 16:          0     GPIOA   1  matrix-keypad
> 17:          0     GPIOA   2  matrix-keypad
> 18:          0     GPIOA   3  matrix-keypad
> 19:          0     GPIOA   4  matrix-keypad
> 21:          0      INTC  21  13020000.dma
> 24:     135738      INTC  24  TCU0
> 29:          0     GPIOA   5  matrix-keypad
> 31:          0     GPIOA   6  matrix-keypad
> 32:          0     GPIOA   7  matrix-keypad
> 33:          0     GPIOC   0  10021000.mmc cd
> 34:          0     GPIOA  16  Touchpad Left
> 35:          0     GPIOA  13  Touchpad Right
> ERR:          0
> root at letux:~# sleep 1;cat /proc/interrupts
>           CPU0       
>  2:     145675      MIPS   2  SoC intc cascade interrupt
>  9:       1502      INTC   9  ttyS0
> 14:       7368      INTC  14  10021000.mmc
> 15:          0     GPIOA   0  matrix-keypad
> 16:          0     GPIOA   1  matrix-keypad
> 17:          0     GPIOA   2  matrix-keypad
> 18:          0     GPIOA   3  matrix-keypad
> 19:          0     GPIOA   4  matrix-keypad
> 21:          0      INTC  21  13020000.dma
> 24:     136831      INTC  24  TCU0
> 29:          0     GPIOA   5  matrix-keypad
> 31:          0     GPIOA   6  matrix-keypad
> 32:          0     GPIOA   7  matrix-keypad
> 33:          0     GPIOC   0  10021000.mmc cd
> 34:          0     GPIOA  16  Touchpad Left
> 35:          0     GPIOA  13  Touchpad Right
> ERR:          0
> root at letux:~# root at letux:~# cat clocksource 
> echo available
> cat /sys/devices/system/clocksource/clocksource0/available_clocksource
> echo current
> cat /sys/devices/system/clocksource/clocksource0/current_clocksource
> sleep 1
> echo switching
> echo ingenic-timer >/sys/devices/system/clocksource/clocksource0/current_clocksource
> for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
> do
>        date
>        sleep 0.1
> done
> echo done
> sleep 1
> root at letux:~# ./clocksource 
> available
> ingenic-timer jiffies 
> current
> jiffies
> switching
> [  682.715103] clocksource: Switched to clocksource ingenic-timer
> Thu Jan  1 00:11:15 UTC 1970
> 
> I interpret this as:
> * TCU0 interrupts are working

One more observation:

root at letux:~# fgrep TCU /proc/interrupts; sleep 10; fgrep TCU /proc/interrupts
 24:     939380      INTC  24  TCU0
 24:     940387      INTC  24  TCU0
root at letux:~# 

This needs real time 10s meaning sleep is ok!

And the difference between 940387 and 939380 is 1007.

This means the TCU interrupts are running with 100 Hz while we sleep.
IMHO this correlates with clocksource=jiffies.

It makes it more strange what the clocksource=ingenic-timer is really doing
or should be doing?

I do not know any other system which uses or needs clocksource=jiffies.

BR,
Nikolaus

> * the only other interrupt being active seems to be ttyS0
> * cevt based on TCU0 is in operation despite clocksource=jiffies
> * there are background processes making use of it
> * sleep 1 works with clocksource=jiffies
> * the first "date" command after switching still succeeds
> * sleep 0.1 hangs with clocksource=ingenic-timer
> 
> So the questions become:
> * which subsystem is using or preferring "clocksource"?
> * and why does it break down if we switch clocksource
> * why is cevt using TCU0 in clocksource=jiffies mode? Priority?
> * how does jiffies work if there is no other timer & interrupt?
> 
> BR,
> Nikolaus
> 



More information about the Letux-kernel mailing list