[Letux-kernel] jz4730-i2c - clocksource

H. Nikolaus Schaller hns at goldelico.com
Sat Mar 6 18:07:58 CET 2021


Hi Paul,

> Am 06.03.2021 um 16:55 schrieb Paul Boddie <paul at boddie.org.uk>:
> 
> On Saturday, 6 March 2021 16:04:50 CET H. Nikolaus Schaller wrote:
>> Hi Paul,
>> seems as if I can now also boot with clocksource=ingenic-timer without
>> problems.
>> 
>> So avoiding regmap and using at least 26 bits (I also want to check 32 bit
>> again) makes it work.
> 
> Interesting to know that the counter width was an issue.

Maybe it is not THE issue but contributed. Basically a 16 bit counter
should overflow only every 18 ms. This is more than a tick for HZ100.

It may only become a problem because something else stalls for more
than 18 ms and blocks interrupt processing.

But 26 bit is on the safe side - and we have it. So there is no reason
to work with the smallest reasonable width.

Ideal would be if 32 bits work, or 31.

> 
>> BTW: there is one more fix: I am resetting the Underrun flag in the
>> interrupt handler. Maybe this prevents that the IRQ stays activated or is
>> still active immediately if a new timer request is written. But I have not
>> checked if this is really needed.
> 
> I think that resetting the flag is just standard practice. Whether it is 
> technically necessary I wouldn't know without testing: it would depend on the 
> nature of the hardware, I suppose.
> 
> [...]
> 
>> This seems to be a new research project:
>> a) what is the futex doing in sysbench (where is it hidden)?
> 
> I guess that somewhere in a library - maybe the C library - there is some 
> concurrency handling that requires it.

What I have understood is that futex is used for thread sync in user-space
if it needs kernel support. Then, there is a futex syscall:

https://man7.org/linux/man-pages/man2/futex.2.html

So yes, the futex syscall is part of glib or pthreads and it may be used in
many situations without any explicit reference.

BTW: there is a futex example code in the manual. I have planned to try
that as soon as my machine is no longer blocked building the binary LetuxOS
kernel releases v5.12-rc2 etc.

> 
>> b) how is futex implemented on jz4730?
> 
> A brief look at arch/mips/include/asm/futex.h indicates that the LL/SC 
> (https://en.wikipedia.org/wiki/Load-link/store-conditional) instruction is 
> required for futex support. I am not sure this is provided on the JZ4730 or 
> even on other early XBurst1 CPUs.

Oh, interesting! Maybe we have hit some fundamental issue here.

> 
>> c) why does it block that long?
>> 
>> Maybe this is also the reason why X11 is that slow.
> 
> If that is the cause then I guess it could also be the explanation.

I did do some other test: enable LCD, WiFi and run X11. And use ssh
over WiFi to get a nice "top" display. The X server is at low 10% load
unless I touch the touch pad to move the cursor. Then X load goes up to
90%. This shouldn't be just for redrawing the pointer.

BR,
Nikolaus




More information about the Letux-kernel mailing list