Skip to content

mklinux v7.0-mk6

Choose a tag to compare

@congwang-mk congwang-mk released this 29 Nov 23:25

Sixth mklinux release, 88 patches on top of v7.0-mk5.

Highlights

  • RISC-V support. Multikernel now runs on RISC-V as well as x86_64 and arm64: spawn kernels start through SBI HSM, take their MSIs in the IMSIC files of their own harts, and can be forced down through an SBI SSE event even with interrupts masked.
  • A spawn can run on CPUs the host never booted. The pool can hold CPUs of a kind the host kernel does not run on, such as the second kind of core of a SpacemiT K3, and an instance can be started on them.
  • Spawns work behind AMD IOMMUs. Interrupt remapping for lent devices and the takeover of a fenced host's IOMMUs, which v7.0-mk5 brought for VT-d, now work on AMD too.
  • Instances are driven through a file descriptor. kexec_file_load() returns a descriptor for the instance, and starting, halting and inspecting it are ioctls on that descriptor. A start can bring its own command line, so boot parameters change without loading the image again.
  • Root in a spawn can no longer reach the host's memory or I/O ports through /dev/mem, /dev/port, iopl(), ioperm() or TIOCSSERIAL.
  • More devices can be lent. The functions of an IOMMU group are lent together, and an instance can read the expansion ROM of a lent function, which GPU drivers need.
  • A core that failed is remembered across takeovers. A core that dies of an AMD core parity error is marked for every later kernel, and a successor shows the marked CPUs to user space.

Important

ABI change: the reboot() commands that started and halted an instance are removed, and so is /proc/kimage. A loader must use the descriptor kexec_file_load() returns and its KEXEC_MK_IOC_* ioctls. A spawn may fence its host only when the host started it with KEXEC_MK_START_MAY_FENCE.

Changes

RISC-V: multikernel runs on RISC-V. Harts are spawned, confirmed stopped and released through SBI HSM, and every started hart enters through a fence.i stub. An Image is loaded into an instance with kexec_file_load() and the instance boots from a device tree the host builds for it. The doorbell is an SBI IPI. A spawn takes its MSIs in the IMSIC files of its own harts, and the IOMMU of a lent device is given those files. An instance gets PCI devices only, no platform devices. A force halt injects an SBI SSE software event where firmware has it, which reaches a hart with interrupts masked, and rings the doorbell otherwise. Memory hot-remove on RISC-V splits the linear map leaves a partial removal ends in and can map part of removed memory back. A hart that belongs to another OpenSBI domain is reported as such.

CPUs the host never booted: the pool is defined over the machine and not over the host, so it can hold CPUs this kernel has no logical CPU for, such as the second kind of core of a SpacemiT K3. They join the pool without being asked for, and the root device tree shows them as cpus-unclaimed with one node per kind under /cpu-kinds. Every CPU of an instance must be of one kind. On RISC-V the harts the device tree leaves out are discovered through SBI.

AMD IOMMU: what VT-d got in v7.0-mk5 now holds on AMD. The host describes its IOMMUs to another kernel and writes the remapping entries of a lent function, a spawn remaps its interrupts behind the host's IOMMUs, and a spawn that took over claims them. On both vendors a spawn's interrupts are remapped behind a bridge's alias.

Devices: the PCI functions of an IOMMU group are lent together, with one owner and one domain, and a group that holds a bridge is not lent. An instance can decode the expansion ROM of a function lent to it, which a GPU driver needs for its video BIOS. A function that is lent out, or kept after its instance was released with a CPU still on, can no longer be put back into the pool, where it could be lent a second time.

kexec: kexec_file_load() returns a file descriptor for the instance it loads an image for, and KEXEC_FILE_MK_OPEN returns one for any instance that exists. An instance is started, halted and inspected through ioctls on it: KEXEC_MK_IOC_START, KEXEC_MK_IOC_HALT, KEXEC_MK_IOC_INFO and KEXEC_MK_IOC_CMDLINE. A start can bring a command line, which replaces the loaded one for that run. A graceful halt waits as long as its caller says. A spawn can fence its host only when the host started it with KEXEC_MK_START_MAY_FENCE, with KEXEC_MK_IOC_FENCE. The reboot() commands and /proc/kimage are gone, and a running instance cannot be unloaded. This changes the ABI: a loader that starts and halts instances with reboot() must move to the descriptor.

Isolation: the user space of a spawn kernel can no longer reach the rest of the machine through /dev/mem, /dev/port, iopl(), ioperm() or TIOCSSERIAL, until the spawn has fenced its host and taken the machine over. An instance gets a message ring to the host only if it asks for one, so a static partition that no kernel can message can be created. A spawn kernel on x86 does not scan for DMI or option ROMs.

Faulty CPUs: a core that dies of an AMD core parity error is marked in its park cells, which every later kernel on the machine inherits. A kernel that takes over shows the marked CPUs to user space in a multikernel,faults node, so that it can leave them out. The park table is listed in /proc/iomem.

Messaging: the sizes of a message are read once from its ring slot, in the core and in mktty, a halt notice is taken only from the kernel that halted, and connections to a stopped instance are reset in mk_transport.

Cleanup: the architecture interface is named and documented in one place, each architecture has its part of the cross-kernel ABI, and arm64 and RISC-V share the firmware park and boot tree code. The multikernel image code moves out of the common kexec path into kexec_multikernel.c. The in-tree DAXFS is removed; it is maintained as an out-of-tree module.

Fixes: pool memory is taken from any zone, so a machine whose RAM all sits below 4 GiB can have a pool, static reserved-memory regions are preserved, a GICv3 tenant that takes over disables every SPI, an instance whose boot tree failed is not started, locks taken from interrupt context are taken with interrupts off or as raw spinlocks, the command line is freed when a file load fails early, and the kernel builds without PCI.

Full changelog: v7.0-mk5...v7.0-mk6

Install

Packages built from this tag on GitHub Actions with the Ubuntu 26.04 generic config plus CONFIG_MULTIKERNEL=y, without debug info (so no BTF). They are not Secure Boot signed; modules are signed with a per-build key. Verify downloads with sha256sum -c --ignore-missing SHA256SUMS.

Debian/Ubuntu (amd64):

sudo apt install ./linux-image-7.0.0-mk6_7.0.0-1_amd64.deb ./linux-headers-7.0.0-mk6_7.0.0-1_amd64.deb

Debian/Ubuntu (arm64):

sudo apt install ./linux-image-7.0.0-mk6_7.0.0-1_arm64.deb ./linux-headers-7.0.0-mk6_7.0.0-1_arm64.deb

Fedora/RHEL (x86_64):

sudo dnf install ./kernel-7.0.0_mk6-2.x86_64.rpm ./kernel-devel-7.0.0_mk6-2.x86_64.rpm

Fedora/RHEL (aarch64):

sudo dnf install ./kernel-7.0.0_mk6-2.aarch64.rpm ./kernel-devel-7.0.0_mk6-2.aarch64.rpm