mklinux v7.0-mk6 Adds RISC-V and AMD IOMMU Support: Separate Linux Kernels for Different CPU Cores
On December 1, U.S. local time, Linux kernel developer Cong Wang announced the release of mklinux v7.0-mk6 and its management tool, kerf 0.6.0. Wang said the kernel includes 88 patches on top of v7.0-mk5 and 419 on top of Linux 7.0.
As described in our coverage of the initial mklinux release, the host Linux kernel sets aside some CPUs, physical memory, and PCI devices, then boots another Linux kernel through an extended kexec_file_load(). Each kernel runs directly on its allocated physical resources, allowing multiple kernels to run concurrently without a hypervisor.
The update adds 64-bit RISC-V alongside x86_64 and Arm64. Cores that the host has never started or registered as logical CPUs can now be assigned to another kernel.
Wang gives the SpacemiT K3, which has different types of CPU cores, as an example. Cores of a type the host has not registered as logical CPUs automatically join the resource pool and can boot an independent Linux kernel. Each kernel must receive cores of a single type.
What stands out is that CPU allocation now extends beyond the host kernel to the entire physical machine. In some cases, assigning a separate kernel to each core type can address the difficulty of managing different types of cores in one kernel.
mklinux v7.0-mk6: Running multiple Linux kernels directly on one machine
| Area | Support or feature | Requirements or use |
|---|---|---|
| CPU | x86_64・Arm64 RISC-V added | 64-bit RISC-V |
| Mixed core types | Can use cores the host never started | One CPU type per kernel |
| RISC-V requirements | ||
| Startup | Start CPUs and confirm they stop | SBI HSM・IPI Host OpenSBI domain |
| Forced halt | Works with interrupts disabled | Requires SBI SSE |
| Restart | Physical machine must reboot | Without SSE, if stuck looping With interrupts disabled |
| Device assignment | PCI devices only | IMSIC for interrupts IOMMU limits DMA |
| AMD IOMMU | ||
| Interrupts | Supports remapping | Lent PCI devices |
| Takeover | Inherits IOMMU management | After host is fenced off |
| PCI devices and AMD CPUs | ||
| PCI assignment | By IOMMU group | Groups containing a bridge Are excluded |
| Expansion ROM | Read from a lent PCI device | GPU driver retrieves Video BIOS |
| AMD | Inherits failed-core records | CPU core parity error |
What separate kernels need on RISC-V
On RISC-V, mklinux uses SBI, the interface between the operating system and firmware, to start hardware execution units called harts, confirm that they have stopped, and release them. The host builds a device tree at each boot and passes it to the new kernel to describe resources such as assigned CPUs and memory.
The RISC-V design documentation lists firmware and interrupt requirements. It requires SBI extensions for hart state management (HSM) and interprocessor interrupts (IPIs), and the relevant harts must belong to the OpenSBI domain in which the host booted.
A forced halt can use firmware support for SBI SSE, which delivers software events to the operating system. Without SSE, a kernel stuck in a loop with interrupts disabled may be impossible to stop, leaving its instance unable to restart until the physical machine reboots.
Only PCI devices can be assigned to the new kernel. Interrupts also require an Incoming MSI Controller (IMSIC), which receives message-signaled interrupts. For devices behind an IOMMU, which manages device access to memory, access is limited to the assigned memory and the IMSIC area used for interrupts. Direct memory access (DMA) from devices outside an IOMMU lacks those restrictions.
RISC-V support entails design work from CPU startup through interrupt handling and memory protection.
AMD IOMMU support and kernel takeover
IOMMU support has also expanded. Interrupt remapping for lent devices, introduced for Intel VT-d in v7.0-mk5, now works on AMD hardware. The kernel that takes over after the host has been fenced off can also manage the IOMMUs.
PCI devices are assigned by IOMMU group, with all PCI functions in a group lent to the same kernel. Groups containing a bridge cannot be lent. A kernel can also read the expansion ROM of a PCI function assigned to it. GPU drivers need that capability to retrieve the video BIOS.
Mklinux lets another kernel take over the host role and is being developed as a basis for updating kernels or recovering from failures without rebooting the physical machine. Mk6 can also record an AMD CPU core disabled by a parity error and let a successor kernel report that information to user space.
Kernel takeover extends beyond CPU management. Inheriting device management and fault records as well as control of the CPUs could let a successor kernel keep the physical machine running while leaving a failed core unused.
Boundaries between independent kernels
Mklinux kernels communicate through shared-memory ring buffers and IPIs. Uses include console access, communication through AF_VSOCK, and access to PCI configuration space.
Management and protection in mklinux v7.0-mk6 and kerf 0.6.0
| Area | Method or setting | Requirements or behavior |
|---|---|---|
| Resource protection | Memory and I/O access Restricted through certain interfaces | Before host takeover Other kernels' resources Applies to root processes too |
| Takeover permission | Assume the host role | Host must authorize at startup |
| Static partitioning | No messaging region for host | Cannot change resource allocations Cannot lend PCI devices Cannot request graceful shutdown |
| Control interface | File descriptor (FD) Controlled via ioctl | Requires kerf 0.6.0 Incompatible with 0.5.0 |
| Boot options | Change per boot | No kernel reload needed |
| Connectivity | Network configuration | Set per boot No configuration if omitted |
| Startup action | Specify a program | Kernel halts when it exits |
| Lockdown settings | lockdown Protect integrity or confidentiality | Set per boot Not applied if omitted |
| Granular restrictions | In addition to integrity protection, Restricts confidentiality-sensitive access | Requires BPF LSM and BTF Rebuild the distributed kernel |
| Custom boot | Custom initramfs Granular restrictions | Root can remove restrictions |
In mk6, before a newly booted kernel takes over as host, even processes running as root have restricted access through device files and similar interfaces to memory and I/O ports used by other kernels. Only kernels explicitly authorized by the host at startup can fence it off and take over the machine.
A shared-memory message ring is created only if the instance requests it. Choosing static partitioning in kerf 0.6.0 without a messaging region for the host removes the ability to adjust the kernel's allocated resources, lend it PCI devices, or request a graceful shutdown.
Doing without inter-kernel messages also means giving up some ways to manage separate kernels as a single, flexible system. Being able to choose where kernels operate independently and where they cooperate is an interesting part of mklinux's design.
How kerf 0.6.0 changes instance management
Mk6 changes the application binary interface (ABI) for managing instances. Previously, additional operations in the reboot() system call started and stopped instances. Mk6 removes those operations and controls instances through kexec_file_load()'s returned file descriptor, using ioctl requests. It can also change boot parameters without reloading the kernel image.
Kerf 0.5.0 is incompatible with mk6, so kerf users need to upgrade to 0.6.0. With kerf 0.6.0, users specify networking, console settings, and the startup program for each boot. If no network configuration is specified, kerf does not carry over the previous boot's settings or configure a new network.
When the specified startup program exits, the kernel instance now stops as well. The tool can also list each CPU's physical ID, NUMA node, and assignment to the host, resource pool, or an instance.
Starting a kernel separately and stopping it when its program exits makes it behave more like a container. It points toward running a program with a dedicated Linux kernel of its own.
Choosing protection settings for each kernel
Kerf 0.6.0 can also apply kernel lockdown. Users can choose integrity or confidentiality protection, or pair integrity protection with fine-grained confidentiality restrictions through BPF LSM, a mechanism for extending Linux security policy. The custom restrictions require the target kernel to support BPF LSM and BPF Type Format (BTF).
Kerf applies these settings per boot. A later boot without a lockdown setting runs without kerf-applied lockdown. With a custom initial RAM filesystem (initramfs), root can remove custom confidentiality restrictions if no process is present to keep them in force.
The prebuilt packages do not include BTF, so using custom restrictions requires building a kernel with the necessary configuration.
A release based on Linux 7.0.14 is also available
The developers also published v7.0.14-mk6, which brings the mk6 changes to Linux 7.0.14. A change in how Linux identifies PCI drivers also required adjustments to the code that sets the driver for a lent PCI function.
Both releases offer prebuilt kernel packages in DEB and RPM formats for x86_64 and Arm64. The packages do not have Secure Boot signatures. RISC-V builds require compiling from source.
Mklinux is an independent development branch of the Linux kernel. It makes it possible for several kernels to share responsibility for physical resources that were once managed by one. A separate Linux kernel can boot even on cores the host has never registered. That broadens the choice of which kernel gets to use the machine's computing power.
KioskNews shows a cleaned-up reading view extracted from the publisher’s page — the original always lives on their site, not ours.
