Re: [Ksummit-discuss] [TECH TOPIC] Documentation

Shuah Khan
2020-06-12T15:48:55Z

On 6/12/20 2:18 AM, Laurent Pinchart wrote:
> H Shuah,
>
> On Thu, Jun 11, 2020 at 01:44:45PM -0600, Shuah Khan wrote:
>> On 6/11/20 12:28 PM, Joe Perches wrote:
>>> On Thu, 2020-06-11 at 12:03 -0600, Shuah Khan wrote:
>>>> People that know the sub-systems well might not
>>>> have time to document and more importantly keeping the documents
>>>> updated.
>>>
>>> So you somehow expect people that do _not_ know the
>>> sub-system well to produce good and useful documentation?
>>
>> I didn't suggest anything like that. I merely mentioned that
>> lack of bandwidth is a reason for outdated documentation.
>
> I think it may be more of a priority issue than a bandwidth issue. Most
> subsystems have traditionally not put lots of effort in documenting
> designs and APIs, and very few of them, even today, enforce
> documentation rules.

First of all - thanks for a very detailed email.

+1. Yes priority is probably a bigger reason. We can make time for the
things we care about. In general documentation isn't fun for engineers
and also not as glamorous.

I don't disagree that some area of the kernel have
> little available bandwidth, we have some very small subsystems, or niche
> areas where only a handful of people would be able to understand what's
> going on (and if you ask me, that's a reason to have more documentation,
> not less :-)). We also have large subsystems where policies have been
> put in place over time to get developers to write documentation.

> I'm
> thinking about V4L2 or DRM for instance, where the former has extensive
> documentation of the userspace API, and the latter extensive
> documentation of the in-kernel API. I believe other subsystems could
> follow if maintainers considered lack of documentation to be a blocker
> on patch submission.
>

Correct. Media subsystem does this very well and can be held up as an
example for good documentation mainly because media maintainers
emphasize and make it a priority. I have been well trained by to start
with documentation when I am doing media work. :)

I follow this for the driver I maintain and kselftest. The latter not
as successfully. It is harder to have a cohesive strategy for subsystem
or an area that is generic and have more people involved, unless
everybody is on board and agree that documentation is important.

> This would however leave some developers in an uncomfortable situation.
> While writing documentation is no fun for most of us, it gets much worse
> for developers who are less fluent in English. Learning how to write
> good documentation is hard enough without having to also learn a new
> language. I think this is a problem that needs to be addressed on its
> own.
>

Yes. That is also correct. The way I address it depending on bandwidth
is working during the reviews to get get documentation right, when I
consider it very important to understand the patch and be able to
maintain it later.

> Another issue that I also believe is important is where to put the bar
> when it comes to documentation quality. I've reviewed many documentation
> patches where I wasn't completely happy with the proposal (as I'm prone
> to nit-picking during review I'll take blames here). Something that is
> clear to the author of the code won't be to someone who has less
> knowledge in that area, and more often that not patch authors don't
> write documentation from the point of view of the reader. This is
> something that can be learnt though, and I believe the kernel would
> benefit from involving more technical writers who could help reviewing
> documentation submissions and point out inconsistencies. There's a
> matter of budget there though, it may be difficult to attract technical
> writers who would help just for the fun of it.
>

Right. I find myself in the same place as you. I end up asking for info.
which annoys people at times. I find documenting work is an important
step in the development process. I might be in the minority, however, at
times, as I am writing my commit log explaining what I am doing in a
patch in, I find a better way to fix a problem.

So I find it useful and I also use it as learning tool. When I attempt
document or explain a concept or an area, I get a deeper understanding
of that area. I would counter the argument that new developers can't
document an area, they can and the document can be reviewed by experts.
I have had some level of success adding documentation tasks in the
mentoring program. It does requires experts spending time reviewing to
make sure it is correct.

The larger problem goes back to, documentation isn't glamorous. It
isn't valued at the same level of code. If we collectively agree that
it is, then we can make it happen. We might sending a wrong message
by saying "Code walks ...". I understand what we mean by that we don't
want a long proposal and we would rather see code.

Maybe we can amend it to say "Code with good documentation walks ...".

The documentation in my mind includes:

commit logs
doc area at the top of functions declarations
API documentation

thanks,
-- Shuah