RT Kernel - Page 2

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Re: RT Kernel
On Thu, 07 Jan 2021 22:25:31 +0000, Folderol wrote:

Quoted text here. Click to load it

Does this mean that OS/9 doesn't have C++ yet?  
Pity, because its process scheduler beats the crap out of Linux.


--  
--  
Martin    | martin at
We've slightly trimmed the long signature. Click to see the full one.
Re: RT Kernel
On Thu, 7 Jan 2021 23:37:36 -0000 (UTC)

Quoted text here. Click to load it

It's not that, it's more a matter of all the linux based dependencies, the GUI
and the drivers for the Pi GPU. Then there's the theading. Yoshimi uses 4
separate threads. Highest priority for the audio, lowest for the CLI and GUI.

--  
W J G


Re: RT Kernel
On Fri, 08 Jan 2021 10:35:24 +0000, Folderol wrote:

Quoted text here. Click to load it

Fair point.
  

--  
--  
Martin    | martin at
We've slightly trimmed the long signature. Click to see the full one.
Re: RT Kernel
On 07/01/2021 17:26, Folderol wrote:
Quoted text here. Click to load it

This was the second link in a google search for "Raspberry Pi real time  
extensions"

https://lemariva.com/blog/2019/09/raspberry-pi-4b-preempt-rt-kernel-419y-performance-test

---druck

Re: RT Kernel
On Fri, 8 Jan 2021 20:40:51 +0000

Quoted text here. Click to load it

Thanks for that.
Very interesting indeed.
It seems there is far less difference overall than on Intel/AMD CPUs, and
although latency is considerably improved it's at the cost of overall
performance. For light to medium amounts of audio processing it's not worth the
bother.

--  
W J G


Re: RT Kernel
Quoted text here. Click to load it

You don't say what you're actually doing. I gather that it's some
software audio synth, and I don't know anything about that
application. I'm guessing it's probably existing Linux software
though, so suggestions such as building for bare-metal or another
OS are presumably not worthwhile.

There's a lot of info here, though not Pi-specific. Setting CPU
frequency scaling to "performance" was important for my application
(I also needed to disable video output on HDMI/Composite):
https://wiki.linuxaudio.org/wiki/system_configuration

Real-Time patches for the Linux Kernel:
PREEMPT_RT: https://wiki.linuxfoundation.org/realtime/start
Xenomai
RTAI

There is a PREEMPT_RT patched Linux distro for the Pi (this one
worked alright for me on a Pi Zero and seems to be fairly actively
developed, there might be others that I've forgotten about):
https://guysoft.wordpress.com/2017/10/09/realtimepi/

When I say "worked alright", I mean that it booted and probably
did everything that could be expected from it. Fiddling with the
scheduler settings and process priority still wasn't enough to
prevent _any_ task switching by the scheduler during the
timing-critical part of the code I was trying to run. Either
PREEMPT_RT or one of the other projects had some special calls
that controlled the kernel at a deeper level from user-space, but
the documentation was too light for me to really figure it out.

Projects such as LinuxCNC are possibly optimised for the real-time
Linux kernel in more advanced ways that I couldn't figure out myself.

In Debian/Devuan it may be possible to install a pre-built Real-Time
patched kernel as a package, depending on which Pi model you're using
(more details in these questions please!). Based on this page:
https://wiki.debian.org/RaspberryPi

This should work on the Pi3:
https://packages.debian.org/buster/kernel/linux-image-4.19.0-8-rt-arm64

And this with the Pi2:
https://packages.debian.org/buster/kernel/linux-image-4.19.0-12-rt-armmp

It doesn't look like there's a PREEMPT_RT armel package to suit the
Pi 1 and Pi Zero. I'm not sure which Debian arch. the Pi4 is
compatible with (arm64, like the Pi3?).

[you can probably ignore the rest if you are trying to run audio
 software, because I doubt it will work]

It's also possible on the Pi to disable all the system interrupts
from user-space (newest versions of the example code are later in
the thread):
https://www.raspberrypi.org/forums/viewtopic.php?f29%&t52%393

I used a variation of that, where before disbling the interrupts
and starting the protected bit of code, I checked that there weren't
any "tick" interrupts due before it would be finished. That at the
very least keeps the system clock accurate, if not also preventing
other problems.

RPi OS's default dwc_otg USB driver written by the Pi Foundation
crashes when the FIQ (Fast Interrupt) is disabled while USB device
is connected (testing on a Pi Zero). At one point there was an
undocumented setting to tell it not to use FIQ, but it doesn't seem
to work anymore. I'm using the alternative dwc2 driver (an "official"
Linux one) which doesn't have that problem. You configure that by
adding this line to /boot/config.txt:
dtoverlay=dwc2,dr_mode=otg

Note that disabling interrupts is probably only a good idea if your
program is doing everything you need by itself at that time. I don't
imagine that it would work if you're outputting audio through ALSA,
or writing to a file, or anything else "Linuxy" at the same time.

The "proper" way to disable interrupts is within a linux kernel
driver module, using function calls such as local_irq_disable. But
you're probably not going to want to split this program you're trying
to run into one piece that runs in user-space and another that runs
in kernel-space. I've been trying to do that for my application, and
as of yesterday have given up for the moment.

--  
__          __
#_ < |\| |< _#

Re: RT Kernel
On Fri, 8 Jan 2021 23:38:47 +0000 (UTC)
snipped-for-privacy@telling.you.invalid (Computer Nerd Kev) wrote:

Quoted text here. Click to load it

Thanks for all this further information.
It is indeed a software synthesiser, but a very unusual one. Whereas most of
these either work on sound samples, or previously generated wavetables, Yoshimi
creates everything on-the-fly from mathematical formulae. These can make
dynamic changes within individual cycles, resulting in incredibly rich sounds.

I do quite a lot of work on the overall structure but don't touch these sound
'engines' - I leave that to those with far better understanding or the
mathematics!

--  
W J G


Re: RT Kernel
declaimed the following:

Quoted text here. Click to load it
    Sounds like something inspired by Casio Phase-Distortion (CZ series in
the 80s). While there /was/ a cosine table stored in memory, the system
adjusted the "phase" during readout (essentially reading part of the table
faster than other parts while keeping the same total cycle time) to change
the wave shape of the DCO (a square wave effectively was read the rising
part of the curve so fast is looked vertical, then the top so slow it
looked flat, fast drop, slow bottom...).

https://en.wikipedia.org/wiki/Phase_distortion_synthesis


--  
    Wulfraed                 Dennis Lee Bieber         AF6VN
     snipped-for-privacy@ix.netcom.com    http://wlfraed.microdiversity.freeddns.org/

Re: RT Kernel
declaimed the following:

Quoted text here. Click to load it

https://www.raspberrypi.org/forums/viewtopic.php?t20%6750
"""
This means that if you want to try it out you'll have to build it yourself.
The general kernel-building instructions are here:
https://www.raspberrypi.org/documentati ... uilding.md

You will need to amend the instructions slightly - where it says

Code: Select all

git clone --depth=1 https://github.com/raspberrypi/linux

you will need:

Code: Select all

git clone --depth=1 https://github.com/raspberrypi/linux -b rpi-4.14.y-rt
"""
https://www.raspberrypi.org/documentation/linux/kernel/building.md



--  
    Wulfraed                 Dennis Lee Bieber         AF6VN
     snipped-for-privacy@ix.netcom.com    http://wlfraed.microdiversity.freeddns.org/

Site Timeline