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

meta-lxatac-bsp: lxatac-net-switch-hacks: workarounds for connection losses #216

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ IMAGE_INSTALL:append = "\
kernel-modules \
kernel-devicetree \
dt-utils-barebox-state \
lxatac-net-switch-hacks \
"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vm.min_free_kbytes=8192
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUBSYSTEM=="platform", DRIVER=="spi_stm32", TAG+="systemd"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=Increase kernel thread priority for the SPI bus to prevent timeouts
BindsTo=sys-devices-platform-soc-5c007000.bus-44009000.spi.device
After=sys-devices-platform-soc-5c007000.bus-44009000.spi.device

[Service]
Type=oneshot
ExecStart=/usr/bin/sh -c "chrt --pid 55 `pgrep irq/[0-9]+-44009000`"

[Install]
WantedBy=multi-user.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

inherit allarch systemd

SRC_URI += " \
file://01-increase-atomic-mem-pool-size.conf \
file://60-spi-device.rules \
file://spi-irq-prio-44009000.service \
"

do_install() {
# Increase the kernel atomic memory pool size.
# This pool is used for allocations in the hot path.
# It seems like the kernel sometimes runs out of memory in this pool when
# under high load.
install -D -m0644 ${WORKDIR}/01-increase-atomic-mem-pool-size.conf \
${D}${libdir}/sysctl.d/01-increase-atomic-mem-pool-size.conf

# Tag the SPI bus controllers with the `systemd` udev tag.
# This makes systemd create units like
# sys-devices-platform-soc-5c007000.bus-44009000.spi.device
# that we can use as `Requires=` and `After=` in other units.
install -D -m0644 ${WORKDIR}/60-spi-device.rules \
${D}${sysconfdir}/udev/rules.d/60-spi-device.rules

# Increase the priority of the kernel thread that handles the
# interrupts for the SPI controller the ethernet switch is connected to.
# This prevents timeouts when communicating with the switch while the
# system is under high load.
install -D -m0644 ${WORKDIR}/spi-irq-prio-44009000.service \
${D}${systemd_system_unitdir}/spi-irq-prio-44009000.service
}

SYSTEMD_SERVICE:${PN} = "spi-irq-prio-44009000.service"

# For chrt and pgrep in spi-irq-prio-44009000.service
RDEPENDS:${PN} += "util-linux busybox"

FILES:${PN} += "\
${libdir}/sysctl.d/ \
${sysconfdir} \
"