Subject: Re: [PATCH bpf-next 00/17] Improve BPF syscall command documentation

From: Jonathan Corbet <[email-masked]>
Date: Wed, 17 Feb 2021 10:32:49 -0700

[CC += linux-doc]

Joe Stringer <[email-masked]> writes:

> From: Joe Stringer <[email-masked]>
>
> The state of bpf(2) manual pages today is not exactly ideal. For the
> most part, it was written several years ago and has not kept up with the
> pace of development in the kernel tree. For instance, out of a total of
> ~35 commands to the BPF syscall available today, when I pull the
> kernel-man-pages tree today I find just 6 documented commands: The very
> basics of map interaction and program load.
>
> In contrast, looking at bpf-helpers(7), I am able today to run one
> command[0] to fetch API documentation of the very latest eBPF helpers
> that have been added to the kernel. This documentation is up to date
> because kernel maintainers enforce documenting the APIs as part of
> the feature submission process. As far as I can tell, we rely on manual
> synchronization from the kernel tree to the kernel-man-pages tree to
> distribute these more widely, so all locations may not be completely up
> to date. That said, the documentation does in fact exist in the first
> place which is a major initial hurdle to overcome.
>
> Given the relative success of the process around bpf-helpers(7) to
> encourage developers to document their user-facing changes, in this
> patch series I explore applying this technique to bpf(2) as well.

So I am totally in favor of improving the BPF docs, this is great work.

That said, I am a bit less thrilled about creating a new, parallel
documentation-build system in the kernel.  I don't think that BPF is so
special that it needs to do its own thing here.

In particular, I would love to have the bpf() syscall API information
incorporated into the userspace-api book with all the rest of the
user-space API docs.  That could be done now by formatting your
information as a DOC: block.

If you started that way, you'd get the whole existing build system for
free.  You would also have started down a path that could, some bright
shining day, lead to this kind of documentation for *all* of our system
calls.  That would be a huge improvement in how we do things.

The troff output would still need implementation, but we'd like to have
that anyway.  We used to create man pages for internal kernel APIs; that
was lost in the sphinx transition and hasn't been a priority since
people haven't been screaming, but it could still be nice to have it
back.

So...could I ask you to have a look at doing this within the kernel's
docs system instead of in addition to it?  Even if it means digging into
scripts/kernel-doc, which isn't all that high on my list of Fun Things
To Do either?  I'm willing to try to help, and maybe we can get some
other assistance too - I'm ever the optimist.

Thanks,

jon