[meta-raspberrypi] Is Preempt-rt still supported in master / latest releases? #raspberrypi


Carles Sole
 

Hello all,

in case it helps someone else I found the dependency that was avoiding the RT patch to be applied to raspberrypi4-64 build.

In bcm2711_defconfig for arm64 KVM is enabled. If KVM is disabled then the patch is applied.

So in .cfg file you can add:
CONFIG_KVM=n


Carles Sole
 

Hi Joel,

thanks for creating the issue.

Does the solution from Aleksandr work for you with raspberrypi4-64? The funny thing is for me it doesn't. As I mentioned above if I use his solution:

for MACHINE = "raspberrypi4-64" in local.conf, the .config file has following configs:
CONFIG_HAVE_PREEMPT_LAZY=y
CONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set

If in the local.conf I replace the machine to MACHINE = "raspberrypi4" and I bitbake again, the .config file looks as follow:
CONFIG_HAVE_PREEMPT_LAZY=y
CONFIG_PREEMPT_LAZY=y
# CONFIG_PREEMPT_NONE is not set
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set
CONFIG_PREEMPT_RT=y
CONFIG_PREEMPT_COUNT=y
CONFIG_PREEMPTION=y

Meaning when the machine is set to raspberrypi4-64 and CONFIG_PREEMPT_RT is requested via the .cfg file in the file .config in work directory CONFIG_PREEMPT_NONE=y is getting set. Whereas with Machine raspberrypi4 it works as expected.


Joel Winarske
 


I would use Kuzemko Aleksandr's solution in bbappend until there is support in meta-raspberrypi.


Joel Winarske
 

Hi,

You should open issue with the upstream layer referencing this dialog:

Joel

On Thu, Feb 2, 2023, 11:18 PM Carles Sole via lists.yoctoproject.org <Carles.SoleMendi=de.bosch.com@...> wrote:

Hello Joel,

I do get the same, but my understanding is that the RT features are not enabled. I would expect to get:

  Linux raspberrypi4-64 5.15.34-v8 #1 SMP PREEMPT RT Tue Apr 19 19:21:26 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

When I check the .config file in the work folder CONFIG_PREEMPT=y is set but I would expect to see CONFIG_PREEMPT_RT=y instead.

That is what you get for rpi4 32 bit as mentioned by Aleksandr above. Is my understanding wrong?



Carles Sole
 

Hello Joel,

I do get the same, but my understanding is that the RT features are not enabled. I would expect to get:

  Linux raspberrypi4-64 5.15.34-v8 #1 SMP PREEMPT RT Tue Apr 19 19:21:26 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

When I check the .config file in the work folder CONFIG_PREEMPT=y is set but I would expect to see CONFIG_PREEMPT_RT=y instead.

That is what you get for rpi4 32 bit as mentioned by Aleksandr above. Is my understanding wrong?


Joel Winarske
 

In the case of kirkstone, this is what I get using `LINUX_KERNEL_TYPE = "preempt-rt"`:

    Linux raspberrypi4-64 5.15.34-v8 #1 SMP PREEMPT Tue Apr 19 19:21:26 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

I've experienced KERNEL_FEATURE conflicts using meta-virtualization with DISTRO_FEATURES += "virtualization kvm" with meta-raspberrypi.  Where the fragment applied is not compatible with Aarch64, and it just disables the linux-raspberrypi default config.  It's quite possible you are also experiencing something similar.  I would check the kernel build logs and see what fragments are being applied, and if there are any complaints with any of them.  The error may be a single line in a log file, and not entirely descriptive.  More context here:  https://github.com/agherzan/meta-raspberrypi/pull/1141


On Thu, Feb 2, 2023 at 2:24 AM Carles Sole via lists.yoctoproject.org <Carles.SoleMendi=de.bosch.com@...> wrote:

Hello Joel,

thanks for your reply. I was not aware about this possibility. I have tried it and the preemptive rt kernel is built instead of standard ("linux-raspberrypi4_64-preempt-rt-build" is available in build/work/linux-raspberrypi/...) but still the configuration file does not set the CONFIG_PREEMPT_RT=y for raspberrypi4-64, even if a .cfg is added using a .bbappend file. So in the end the RT option is not enabled.

Any idea why it works for raspberrypi4 but not for raspberrypi4-64?

Best Regards,
Carles



Carles Sole
 

Hello Joel,

thanks for your reply. I was not aware about this possibility. I have tried it and the preemptive rt kernel is built instead of standard ("linux-raspberrypi4_64-preempt-rt-build" is available in build/work/linux-raspberrypi/...) but still the configuration file does not set the CONFIG_PREEMPT_RT=y for raspberrypi4-64, even if a .cfg is added using a .bbappend file. So in the end the RT option is not enabled.

Any idea why it works for raspberrypi4 but not for raspberrypi4-64?

Best Regards,
Carles


Joel Winarske
 

In kirkstone for example, you build preempt-rt variant by adding to local.conf:

LINUX_KERNEL_TYPE = "preempt-rt"

Does this no longer work?


Carles Sole
 

Hello Lukasz, Aleksandr,

I have not managed to build it for Rpi4-64. I followed the same approach as Aleksandr but it does not work for 64bit system.

Doing exactly the same changes as Aleksandr if I build for MACHINE = "raspberrypi4-64" in local.conf, the .config file has following configs:
CONFIG_HAVE_PREEMPT_LAZY=y
CONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set

If in the local.conf I replace the machine to MACHINE = "raspberrypi4" and I bitbake again, the .config file looks as follow:
CONFIG_HAVE_PREEMPT_LAZY=y
CONFIG_PREEMPT_LAZY=y
# CONFIG_PREEMPT_NONE is not set
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set
CONFIG_PREEMPT_RT=y
CONFIG_PREEMPT_COUNT=y
CONFIG_PREEMPTION=y

So for raspberrypi4 the RT kernel is built whereas for raspberrypi4-64 a non preemptive kernel is built (without adding rt.cfg or the patch a PREEMPTIVE kernel will be built, i.e. CONFIG_PREEMPT=y is set in the .config file).

Once I figure out why this happens I will post it here. Any further hints are appreciated.

Best Regards,
Carles


Kuzemko Aleksandr
 

My results: (32bit CM4 system)
uname -a

Linux b2qt-raspberrypi4 5.15.56-rt56-v7l #1 SMP PREEMPT_RT Fri Jul 22 13:23:23 UTC 2022 armv7l GNU/Linux

I create
linux-raspberrypi_5.15.bbappend and add
SRC_URI += " \
           file://patch-5.15.86-rt56.patch \
           file://rt.cfg \
           "
in rt.cfg I put
CONFIG_PREEMPT_RT=y

with new line at the end.


?ukasz Majewski
 

Hi Carles

Hi Alex, Andrei,

thanks for your reply. Based on your feedback I've tried the
following:
- I have downloaded the patch patch-5.15.86-rt56.patch from
https://cdn.kernel.org/pub/linux/kernel/projects/rt/5.15/ and stored
in ./meta-raspberrypi/recipes-kernel/linux/files
- I have created a file linux-raspberrypi_%.bbappend in
./meta-raspberrypi/recipes-kernel/linux
- I have created a .cfg file with CONFIG_PREEMPT_RT_FULL = y in
./meta-raspberrypi/recipes-kernel/linux/files
- I have added both patch and cfg file in bbappend using
SRC_URI:append:rpi.

I can observe the following:
- patch and cfg files are available in
./build/tmp/work/raspberrypi4_64-agl-linux/linux-raspberrypi/1_5.15.34+gitAUTOINC+e1b976ee4f_0086da6acd-r0
- new folder linux-raspberrypi4_64-preempt-rt-build is available
inside the folder above. But the problem seems to be that
CONFIG_PREEMPT_RT = y is not applied to the .config file. So it seems
the preempt-rt kernel is built but without the full preempt-rt
support.
- When I do bitbake linux-raspberrypi -c menuconfig I cannot select
the full real time preempt kernel, only preemptible option available
is --> Preemptible Kernel (Low-Latency Desktop). Fully Preemptible
Kernel (Real-Time) is not available.
- When I flash the image in the Rpi4 and run uname -r I see that the
rt kernel has been built --> 5.15.34.rt56.v8
- but only with PREEMPT option but without RT when I do uname -v -->
#1 SMP PREEMPT Tue Aug 9 21:20:00 UTC 2022 (without RT).

I have tried building linux-yocto-rt for qemu and there I see that
CONFIG_PREEMP_RT = y is available in the .config file. Also if I open
menuconfig I have the option to select in General setup -->
Preemption Model --> Fully Preemptible Kernel (Real-Time)

If you can provide any hints on what am I missing it would be highly
appreciated.
Have you managed to go any further with your investigation regarding
PREEMPT-RT on RPi4-64?

Best Regards,
Carles



Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@...


Carles Sole
 

Hi Alex, Andrei,

thanks for your reply. Based on your feedback I've tried the following:
- I have downloaded the patch patch-5.15.86-rt56.patch from https://cdn.kernel.org/pub/linux/kernel/projects/rt/5.15/ and stored in ./meta-raspberrypi/recipes-kernel/linux/files
- I have created a file linux-raspberrypi_%.bbappend in ./meta-raspberrypi/recipes-kernel/linux
- I have created a .cfg file with CONFIG_PREEMPT_RT_FULL = y in ./meta-raspberrypi/recipes-kernel/linux/files
- I have added both patch and cfg file in bbappend using SRC_URI:append:rpi.

I can observe the following:
- patch and cfg files are available in ./build/tmp/work/raspberrypi4_64-agl-linux/linux-raspberrypi/1_5.15.34+gitAUTOINC+e1b976ee4f_0086da6acd-r0
- new folder linux-raspberrypi4_64-preempt-rt-build is available inside the folder above. But the problem seems to be that CONFIG_PREEMPT_RT = y is not applied to the .config file. So it seems the preempt-rt kernel is built but without the full preempt-rt support.
- When I do bitbake linux-raspberrypi -c menuconfig I cannot select the full real time preempt kernel, only preemptible option available is --> Preemptible Kernel (Low-Latency Desktop). Fully Preemptible Kernel (Real-Time) is not available.
- When I flash the image in the Rpi4 and run uname -r I see that the rt kernel has been built --> 5.15.34.rt56.v8
- but only with PREEMPT option but without RT when I do uname -v --> #1 SMP PREEMPT Tue Aug 9 21:20:00 UTC 2022 (without RT).

I have tried building linux-yocto-rt for qemu and there I see that CONFIG_PREEMP_RT = y is available in the .config file. Also if I open menuconfig I have the option to select in General setup --> Preemption Model --> Fully Preemptible Kernel (Real-Time)

If you can provide any hints on what am I missing it would be highly appreciated.

Best Regards,
Carles


Andrei Gherzan
 

On Mon, Jan 23, 2023 at 11:47:59AM +0100, Alexander Kanavin wrote:
meta-raspberrypi kernel comes from
https://github.com/raspberrypi/linux and they stopped providing -rt
options some time ago.

Your options are to apply the -rt patchset to regular rpi kernel and
enable needed options via custom .bbappend, or take linux-yocto-rt and
see how far you get.
That would be correct. There is no support out of the box in the BSP layer and
I am not aware of any layers providing that. If we find a person who wants to
maintain a fork with the RT patches, I'm happy to bring it as an optional
kernel provider in the layer.

--
Andrei Gherzan


Alexander Kanavin
 

meta-raspberrypi kernel comes from
https://github.com/raspberrypi/linux and they stopped providing -rt
options some time ago.

Your options are to apply the -rt patchset to regular rpi kernel and
enable needed options via custom .bbappend, or take linux-yocto-rt and
see how far you get.

Alex

On Mon, 23 Jan 2023 at 10:57, Carles Sole via lists.yoctoproject.org
<Carles.SoleMendi=de.bosch.com@...> wrote:

Hello all,

I would like to understand if it is still possible to build an image for raspberrypi4-64 where the preempt-rt patch is applied to the kernel, e.g. by adding "PREFERRED_PROVIDER_virtual/kernel" to local.conf.

I could see that in older branches of [meta-raspberrypi] there was a specific recipe for the preempt-rt patch, e.g. linux-raspberrypi-rt_4.19.bb. This recipe was using the specific raspberrypi branch rpi-4.19.y-rt.

I see that in newer branches this rt branch disappeared but I was not able to understand the history and what is the current method to implement this patch, assuming is still supported.

Any hints on how to do this would be much appreciated.

Best Regards,
Carles



Carles Sole
 

Hello all,

I would like to understand if it is still possible to build an image for raspberrypi4-64 where the preempt-rt patch is applied to the kernel, e.g. by adding "PREFERRED_PROVIDER_virtual/kernel" to local.conf.

I could see that in older branches of [meta-raspberrypi] there was a specific recipe for the preempt-rt patch, e.g.
linux-raspberrypi-rt_4.19.bb. This recipe was using the specific raspberrypi branch rpi-4.19.y-rt.

I see that in newer branches this rt branch disappeared but I was not able to understand the history and what is the current method to implement this patch, assuming is still supported.

Any hints on how to do this would be much appreciated.

Best Regards,
Carles