Kernel hackers at Cauldron, 2025 edition
[LWN subscriber-only content]
Rust
The initial topic, guided by Miguel Ojeda over a remote link, was support for Rust code in the kernel. The Debian project, it seems, is the first to run into a problem that is likely to be felt more widely: the difficulties facing anyone who needs to compile out-of-tree modules written in Rust. As a general rule, loadable kernel modules should be built with the same version of the compiler that was used for the main kernel, but efforts (including the "modversions" mechanism) have long been made to loosen that requirement. So it will usually work to build a module with whichever version of the compiler happens to be handy.
The Rust compiler is different, though. When compiling code, it creates a number of files that serve in a role similar to that of C header files, and it will consume those files when building other translation units. But the Rust compiler insists on an exact version match or it will be unwilling to use those files, causing compilation to fail. That makes the building of out-of-tree modules nearly impossible if they involve Rust code.
LWN.net is able to bring you articles like this one because of our generous subscribers. If you want to see more like it, consider taking advantage of our special offer: 1 month trial subscription
The general consensus in the room was that this was a problem that needed to be fixed in the compiler. Since, for now, the only viable compiler for kernel code is rustc, there was not much that the assembled GCC developers could do about it. José Marchesi asked whether gccrs, the under-development GCC front-end for Rust, would have the same problem; how flexible that compiler will be on this point is unclear, and nobody had an answer to that question.
Inline support for BTF
Alan Maguire, also participating remotely, raised the topic of support for inline call sites in BTF, which describes the types of functions and data structures in the kernel. When the kernel is built, inline functions are directly substituted into the code by the compiler, so there is no separate call site in the resulting binary; that can make tracing those calls more difficult. Representing these call sites, of which there are over 400,000 in a built kernel, would make debugging and performance analysis easier.
Getting there, he said, requires adding three new types to BTF. The BTF_KIND_LOC_PARAM type indicates where a parameter to an inline function call can be found; objects of this type are gathered together under the BTF_KIND_PROTO type, which contains all of the parameters to a call. That, in turn, is pulled into an object of the BTF_KIND_LOCSEC type with the function names, prototypes, and address information. Generating this information in the build process is not a sure thing; Maguire was able to collect full information for 65% of the inline function calls, and partial information (only some of the parameters) for another 17%. After deduplication, the result is 9.5MB of collected BTF data.
Maguire is planning on making this data available via a new virtual file, such as /sys/kernel/btf/vmlinux.extra, to avoid bloating the ordinary BTF data with the inline information. There is also a way to build this information into a separate loadable module so that it need not be resident in memory when not in use.
There was seemingly more to be said about this topic but, at this point, the remote link, which was hosted on a free-of-charge but proprietary service, hit its time limit and abruptly shut down, so the conversation moved on.
Tracing and related
Alexei Starovoitov said that he would like to have a way to inject some assembly code at the call sites of inline functions, providing a hook that would be easy to attach to for tracing purposes. This would make the arguments to the function available, even if they have been optimized out by the compiler. Jakub Jelinek said that inserting the code is easy, but that the compiler's optimization passes can split up an inline function's code and spread it around, making the notion of a specific call site a bit fuzzy. Steve Rostedt said that would make exit tracing especially difficult to implement. Paul McKenney added that this kind of optimization could end up reordering calls to multiple inline functions, adding more potential for confusion.
Segher Boessenkool pointed out that it will often be difficult to reconstruct the arguments to an inline function; part of the whole point of inlining, he said, was to be able to perform global optimizations.
Marchesi asked for an update on which version of SFrame can be expected to land in the kernel. Indu Bhagat said that the deferred unwinding support needed to fully implement SFrame is in the kernel now, but the other pieces have not yet been merged. When the SFrame-specific code lands, it will support the upcoming version-3 specification. That version is also supported by binutils 2.46, which is expected in January. Rostedt said that the SFrame code is waiting for toolchain support, so it will not land in 6.18; it is likely to show up in 6.19 or 6.20. Bhagat added that LLVM will have SFrame support sometime in the (northern-hemisphere) spring.
Nick Clifton, the binutils maintainer, said that he would be willing to move the next binutils release forward to December if that would help, but Rostedt said that there was not that much urgency. Finishing the new version of the SFrame specification needs to happen first, as does the design of a new system call to get SFrame information from the kernel. It could take several kernel releases to get everything right, he said. Sam James said that distributors are waiting for version 3 of the specification as well.
Report from Paris
Thomas Schwinge reported that he had recently attended Kernel Recipes in Paris as a representative of the toolchain community, and had reported on the state of GCC there. The compiler, he said, is receiving commits at a rate of about 600/month — a rate that has remained essentially unchanged for the last two decades. He asked the group there how many were exclusively using LLVM to build their kernels, and only got a handful of responses; GCC is still relevant for kernel building, he said.
Some participants at Kernel Recipes raised concerns about the aging of the GCC development community, but Schwinge answered that there are new contributors coming into the community. There was a request to be able to build for multiple architectures from a single build of the toolchain — something that LLVM can do, but GCC cannot. Boessenkool evidently has a project toward that end, and it is seen as an achievable objective.
Schwinge concluded by noting that participants were happy for the ability to contribute to the toolchain with a developer's certificate of origin rather than a copyright assignment. They also liked the fact that new GCC releases don't tend to routinely break kernel builds, as happened more often in the past. There was a fair amount of interest in the state of gccrs as well.
The session ran out of time and concluded at this point, though much of the same group reconvened to discuss BPF support after lunch (report forthcoming). There was general agreement that this type of meeting between the kernel and toolchain communities is valuable and should be repeated.
[Thanks to the Linux Foundation, LWN's travel sponsor, for supporting my
travel to this event.]
Index entries for this article | |
---|---|
Kernel | Development tools/Compiler toolchain |
Kernel | Tracing |
Conference | GNU Tools Cauldron/2025 |
Posted Oct 2, 2025 16:01 UTC (Thu)
by segher (subscriber, #109337)
[Link] (2 responses)
This was about "buildall" I guess. Arnd built everything on https://www.kernel.org/pub/tools/crosstool/
The only thing really multiarch about this is the *source* tree. Really nothing about buildall is special,
Posted Oct 7, 2025 3:57 UTC (Tue)
by sam_c (subscriber, #139836)
[Link] (1 responses)
For those interested, see Joseph Myers's writeup at https://gcc.gnu.org/legacy-ml/gcc-patches/2010-06/msg0267... on his assessment for what would need to be done.
I will say though, while this would be useful for the kernel side, it's not a silver bullet for everything else, because you still need to build runtime libraries for all targets - and I often see people confused by that when trying to use Clang's --target support.
Posted Oct 8, 2025 16:30 UTC (Wed)
by segher (subscriber, #109337)
[Link]
We do not have a single configuration for a specific backend on a specific OS, for example, the way things are currently (and historically) what is supported by any particular build is a specific subset, a specific specialisation.
Not solving that but allowing more chaos elsewhere anyway is great fun, but it is a free-for-all melee, I don't see it ever becoming really useful to anyone.
Also, currently the compiler itself is greatly optimised to the target it is targeting. A chimera compiler as proposed has to lose all possibility of such optimisations by necessity.
Posted Oct 2, 2025 19:24 UTC (Thu)
by roc (subscriber, #30627)
[Link] (3 responses)
Posted Oct 4, 2025 19:26 UTC (Sat)
by PaulMcKenney (✭ supporter ✭, #9624)
[Link] (2 responses)
Posted Oct 5, 2025 8:34 UTC (Sun)
by roc (subscriber, #30627)
[Link] (1 responses)
Posted Oct 5, 2025 10:15 UTC (Sun)
by PaulMcKenney (✭ supporter ✭, #9624)
[Link]
However, the person doing the debugging might well be able to make the required modifications to the source code. In addition, that meeting discussed toolchain modifications to grant access to the inlined function's formal parameter values. And perhaps these modifications might inspire someone to apply similar techniques that would grant access to such a function's return value.
Yes, exposing the return value in this manner could be confusing in cases where several inlined functions' code was interleaved, removing the usual correlation between function call and function return. But it might nevertheless be a step forward from the perspective of those actually doing the debugging.
multiarch builds
using buildall, since 2018 or so. I probably should put a Git tree of it in public somewhere again.
everything is using out-of-the-box build options, the only thing it helps with is it knows some peculiarities of
many configurations (so it can pick good, *working*, options to build with); and of course it builds
everything with one command, binutils and GCC and the kernel itself if you want that.
multiarch builds
multiarch builds
Return values of inline functions
Return values of inline functions
Return values of inline functions
Return values of inline functions