Nícolas F. R. A. Prado
December 11, 2023
Reading time:
As mentioned in a previous blog post, we have been busy working on improving the kernel integration landscape on multiple fronts, one of which includes improving the quality of the tests available for all.
Despite most of the functionality of each platform coming from drivers, which will expose interfaces to allow userspace to interact with the underlying hardware, we still didn't have an established way to detect regressions in any of the platform's drivers setup. The majority of the subsystems in the kernel share this common driver framework, so it's time we made use of that to identify issues lower in the stack more easily and generically.
A standalone test that checks for device probes does already exist, called bootrr, and we have been running it on KernelCI for a while. However, we have noticed some important issues with it. The biggest problem is that it relies on unstable ABIs from the kernel (specifically, device and driver names), which would occasionally change from one kernel version to the next, resulting in false regressions being reported by the test, and requiring it to be updated to work differently for each kernel version. The other problem is that it requires, for each new platform, a list of all of its devices to be crafted (See here for an example). This results in a lot of effort for both enabling and maintaining tests for each platform.
In order to improve the situation, we have worked with the community and landed a new kselftest upstream. The key benefit of this test is that it relies on the Devicetree, which is already maintained for each platform, to provide the list of devices present. Therefore no additional effort is needed to enable it on a new platform or to keep it compatible with changes in the kernel.
The test works by iterating over the nodes in the currently loaded Devicetree and verifying whether there's a corresponding device and driver bound to it through sysfs. Not all Devicetree nodes are expected to register a device and have it bound to a driver though, so the test is able to ignore those based on the list of Devicetree compatibles that it extracts from all drivers in the kernel source.
We have recently added this new test in KernelCI. For the MT8195-based Tomato Chromebook, for example, you can see the results for the Linux-next tree below (available here).
As can be seen, there are 181 passing tests - devices that have been checked to have successfully bound to drivers; 34 skipped tests - devices that don't have a matching driver in the kernel and therefore aren't checked; and 11 failing tests of which:
In short, all of them correctly indicate missing support for the platform, and as soon as they are fixed upstream, they will enable us to detect regressions reliably.
Naturally the new DT kselftest only covers devices described in the Devicetree. For ACPI-based platforms, we have a series adding a similar kselftest currently on the mailing list. And for discoverable buses such as USB and PCI, we are currently discussing the best approach on the mailing list. We'll cover them in more detail in future articles.
As we work towards making tests for the kernel that are as robust and require as little maintenance as possible, we will strive to make them first-class citizens in the kernel development process. Through this technique, we can increase confidence in every step - from patch submission to product integration.
08/10/2024
Having multiple developers work on pre-merge testing distributes the process and ensures that every contribution is rigorously tested before…
15/08/2024
After rigorous debugging, a new unit testing framework was added to the backend compiler for NVK. This is a walkthrough of the steps taken…
01/08/2024
We're reflecting on the steps taken as we continually seek to improve Linux kernel integration. This will include more detail about the…
27/06/2024
With each board running a mainline-first Linux software stack and tested in a CI loop with the LAVA test framework, the Farm showcased Collabora's…
26/06/2024
WirePlumber 0.5 arrived recently with many new and essential features including the Smart Filter Policy, enabling audio filters to automatically…
12/06/2024
Part 3 of the cmtp-responder series with a focus on USB gadgets explores several new elements including a unified build environment with…
Comments (0)
Add a Comment