Re: [PATCH v2 3/9] kernel/api: add debugfs interface for kernel API specifications

Mauro Carvalho Chehab
2026-03-24T09:49:23Z

Hi Sasha,

On Mon, 23 Mar 2026 19:58:50 -0400
Sasha Levin <sashal@kernel.org> wrote:

> On Mon, Mar 23, 2026 at 02:52:58PM +0100, Greg Kroah-Hartman wrote:
> >On Sun, Mar 22, 2026 at 08:10:17AM -0400, Sasha Levin wrote:
> >> Add a debugfs interface to expose kernel API specifications at runtime.
> >> This allows tools and users to query the complete API specifications
> >> through the debugfs filesystem.
> >>
> >> The interface provides:
> >> - /sys/kernel/debug/kapi/list - lists all available API specifications
> >> - /sys/kernel/debug/kapi/specs/<name> - detailed info for each API
> >>
> >> Each specification file includes:
> >> - Function name, version, and descriptions
> >> - Execution context requirements and flags
> >> - Parameter details with types, flags, and constraints
> >> - Return value specifications and success conditions
> >> - Error codes with descriptions and conditions
> >> - Locking requirements and constraints
> >> - Signal handling specifications
> >> - Examples, notes, and deprecation status
> >>
> >> This enables runtime introspection of kernel APIs for documentation
> >> tools, static analyzers, and debugging purposes.
> >>
> >> Signed-off-by: Sasha Levin <sashal@kernel.org>
> >
> >Debugfs logic looks sane, nice.
>
> Thanks!
>
> >But this only works if the kabi stuff is built into the kernel image,
> >right? This doesn't work if any of these abi sections are in a module
> >or am I missing that logic here?
>
> That is correct, for now.
>
> I'm only trying to tackle syscalls to begin with, and since no syscalls live in
> modules, we have no need for module support.

Have you seen tools/docs/get_abi.py?

It handles debugfs/sysfs descriptions from Documentation/ABI/.

Its "rest" command converts ABI specs from it into RST.

The "undefined" command does realtime introspection for sysfs ABI,
checking if they're documented.

Perhaps you should consider integrating it on your new tool.

--
Thanks,
Mauro