Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make kernel module work with kernel 5.10 and newer #11

Open
Tracked by #34
orgua opened this issue Sep 20, 2022 · 2 comments
Open
Tracked by #34

make kernel module work with kernel 5.10 and newer #11

orgua opened this issue Sep 20, 2022 · 2 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@orgua
Copy link
Owner

orgua commented Sep 20, 2022

We are currently locked in with kernel 4.19. For normal testbed-usage there is no problem, but unittests remove and reload the module for every test (~ 100 tests), which crashes the system at a random point in time eventually. I already removed (some) possible leaks and start to suspect the dusty kernel itself. There are kernel version 5.4 and 5.10 available for the beaglebone, but some internal interfaces changed with 5.4 and more with 5.10, so the transition is not done with a simple switch.

At least one kernel-change also affects PRU-Code regarding the intc-ressource:

Another problem are changes in the API and include system. part of the problem seems to be documented here

UPDATE: crashes were caused by the shepherd kernel-module and are fixed now. Update to 5.10 or 5.15 needs to happen anyway, as the next ubuntu-release might not allow downgrading the kernel to 4.19 anymore.

@orgua
Copy link
Owner Author

orgua commented Nov 17, 2022

Observation: the crashes got more frequent with latest changes to the kernel module in the dev-branch. Before the testsuite run through sometimes. Probably related to too excessive freeing of objects on unloading subroutines. Just a guess.
Starting-commit: 24. Oct 2022 -> 6d87b96 (one commit before kernel work begun)
Ending-commit: 25. Oct 2022 -> 5c237a7
Change-Comparison

Some more Notes

Fixing these crashes has highest priority. Even with warnings on the compiler is happy ATM, but maybe it is possible to learn more with sanitizers for memory, address and undefined behavior (asan, ubsan, ...) or debugging and looking at the crash dumps.

Kernel work on the beaglebone can be tedious, helpful tricks:

  • remove shepherd-module from autostart /etc/modules to stop crashing at boot
  • building kernel module is documented here

loading and unloading is currently done with these commands:

# reload index and load module
depmod -a
modprobe -a shepherd

# unload module
modprobe -rf shepherd

It also helps to have the main distro on the internal eMMC-Card and an emergency distro on sd-card.
(the sd-card distro can be copied to eMMC by activating the last line in /boot/uEnv.txt -> cmdline=init=/usr/sbin/init-beagle-flasher)

@orgua orgua added enhancement New feature or request bug Something isn't working labels Dec 8, 2022
@orgua orgua mentioned this issue Aug 30, 2023
7 tasks
@orgua
Copy link
Owner Author

orgua commented Jul 8, 2024

Porting to newer Kernel

pssp 5.9 for kernel <= 5.4
pssp 6.0 for kernel >= 5.10
pssp 6.2 for kernel >= 6.1

Linux 5.10 RemoteProc driver expects INTC information to be provided in an INTC
map structure. See Linux drivers/remoteproc/pru_rproc.h for details.

This commit adds structures pruss_int_map and pru_irq_rsc to
include/pru_types.h.

Linux 5.10 pruss_int_map provides PRU INTC mapping information for
system event --> channel --> host interrupt.

Linux 5.4 ch_map only provided system event --> channel mapping. ch_map will be
deprecated in a later commit.

The Linux RemoteProc driver loads PRU cores slightly differently in Linux kernel
5.10 than it did in Linux 5.4:

  • Resource tables are no longer required if RPMsg is not used (i.e., "empty"
    resource tables are no longer needed)
  • INTC configuration is passed to the RemoteProc driver in a different
    structure than the resource table
  • PRU firmware provides INTC configuration for interrupts going to the ICSS or
    ICSSG, while Linux client driver provides INTC configuration for interrupts
    going to the Linux host. Note that PRU firmware can also still manually
    configure the INTC within the PRU code. However, configuration for interrupts
    going to the Linux host should still be configured by Linux only. This allows
    the PRU Linux drivers to verify that there are no conflicting interrupt
    settings across different PRU Linux applications.

am335x: Port to Linux 5.10 -> https://git.ti.com/cgit/pru-software-support-package/pru-software-support-package/commit/?id=8c961a4def32cb0194325d033c5621a717882b85

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant