Ports/loongarch64/Kernel

From ALT Linux Wiki
Stub.png
Under construction.
This page is not finished yet and may lack substantial information.


This page describes the kernels that are available in sisyphus_loongarch64.

Flavours

Out of tree modules

  • zfs -- kernel-modules-zfs-[flavour] -- ZFS filesystem supprt
  • yt6801 -- kernel-modules-yt6801-[flavour] -- support for Motorcomm YT6801 network adapters (e.g from XC-LS3A6M boards).
  • la_ow_syscall -- kernel-modules-la_ow_syscall-[flavour] -- kernel part of libLoL.

The full list of out-of-tree module is available on packages.altlinux.org.

6.12

The default flavour, technically and ideologically close to 6.12 kernels on main architectures.

Additional patches

ACPI cpufreq driver for LoongArch

Some Loongson 3 based systems allow to manage CPU frequencies via ACPI. The interface is specific for those systems, so a special driver is required on the kernel side. This dirver is included into our kernels for loongarch64 architecture.

The management interface is similar to "standard" cpufreq. Each CPU is controlled intependnently. Two governors are supported:

# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
performance powersave

Bo default the preformance governor is used. With this governor the CPU always works on the basic (maximal) frequency, so that cpufreq does not affect preformance in any way.

The same sysfs interface can be used to switch between governors:

# echo 'powersave' | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
powersave

Let's check the results:

# grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor:powersave
/sys/devices/system/cpu/cpu1/cpufreq/scaling_governor:powersave
/sys/devices/system/cpu/cpu2/cpufreq/scaling_governor:powersave
/sys/devices/system/cpu/cpu3/cpufreq/scaling_governor:powersave

Let's get back to performance governor:

# echo 'performance' | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
performance

It is also possible to rise the minimal CPU frequency to reduce the lags when powersave governor is used, or reduce the maximal CPU frequency for energy savings.

Known problems

When the settings are changed very rapidly, sometimes the last change does not get applied. Usually this is not a problem, as CPU frequencies are seldom switched several times per second; but, for example, powertop does exactly that, so using powertop on loongarch64 laptops is not recommended.

pci: irq: Add an early parameter to limit pci irq numbers

Server-grade loongarch64 systems often don't have enough MSIX vectors for PCI devices. Вrivers tend to allocate a few vectors per CPU core. This is ok on x86_64 (which mostly has many more MSIX vectors available) or loongarch64 desktops (which have fewer CPU cores), but larger loongarch64 systems may run out of MSI vectors just with 3 or 4 devices.

To give a system administrator a tool to tackle this, we add a kernel command line parameter pci_irq_limit=NNN, which restricts the number of MSIX vectors that can be allocated via a single request. This allows to distribute the available MSIX vectors more evenly across devices.

By default these restrictions are disabled.

ice: Introduce parameters to clamp number of MSI-X vectors

The previous problem is especially evident when working with Intel network adapters. So, we decided to implement and enable by default additional restrictions for ice driver as module parameters:

  • max_lan_msix=32 for number of interrupt vectors used for LAN-traffic handling;
  • max_rdma_msix = ICE_RDMA_NUM_AEQ_MSIX + 1 for number of interrupt vectors used for handling RDMA.

These parameters can be controlled by creating a special file in /etc/modprobe.d, for example:

# cat /etc/modprobe.d/ice.conf
options ice max_rdma_msix=10 max_lan_msix=24

To apply the changes made in such file it is necessary to unload (rmmod) and then modprobe ice kernel module; or just reboot the system.

loongarch

Deprecated flavour. Was the only falvour available from the creation of loongarch64 port up to the middle of march 2025, when 6.12 became the recommended flavour. Later it may be used for lightweight experimental kernels.

Switching to 6.12

Due to the packaging differences (mostly because of a separate pacakge for DRM modules) automatic upgrade of systems using kernel-image-loongarch to 6.12 kernels is not yet implemented. To do this manually it is necessary to install the packages with the kernel and necessary modules via apt-get install:

  • kernel-image-6.12;
  • kernel-modules-drm-6.12, if you use a video card (maybe not needed for a sever);
  • kernel-modules-la_ow_syscall, if you use libLoL;
  • kernel-modules-zfs-6.12, if you uze ZFS;
  • ...

For example:

apt-get install kernel-image-6.12 kernel-modules-drm-6.12 kernel-modules-zfs-6.12

After reboot 6.12 kernel will be used by default. For further updates of any kernels we still recommend using update-kernel.