All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jonathan Corbet <corbet@lwn.net>,
	Jani Nikula <jani.nikula@intel.com>,
	ksummit <ksummit-discuss@lists.linuxfoundation.org>,
	ksummit@lists.linux.dev,
	Markus Heiser <markus.heiser@darmarit.de>
Subject: Re: [Ksummit-discuss] [TECH TOPIC] What kernel documentation could be
Date: Sun, 26 Jun 2022 08:55:24 +0100	[thread overview]
Message-ID: <20220626085524.42ee92c0@sal.lan> (raw)
In-Reply-To: <CAHk-=wi-NnjCMTd5aC_WLfXN02gCXFOm0dbvSPaDYDkiByfrEg@mail.gmail.com>

Em Sat, 25 Jun 2022 11:11:40 -0700
Linus Torvalds <torvalds@linux-foundation.org> escreveu:

> On Sat, Jun 25, 2022 at 7:00 AM Jonathan Corbet <corbet@lwn.net> wrote:
> >
> > I said "some" - this was a proof-of-concept hack.  The complexity of
> > their symbol lookup code is ... daunting ... and not something that gets
> > fixed in one place.  More research is required...  
> 
> Note that at least for me, the issue with building docs isn't hugely
> performance related.
> 
> Yes, yes, it would be good if it was faster. But..
> 
> The primary problems I see with building the docs (and thus checking
> them, the same way I do an allmodconfig build test) is
> 
>  (a) it's insanely noisy, which makes and "check that it's ok" ENTIRELY USELESS.

When the environment is set for building docs, almost all output there
are actually due to build errors/warnings that got introduced by patches
touching documentation that were never build-tested.

There are 4 components that report errors during "make htmldocs". 

1. Documentation cross-reference check. 

	$ scripts/documentation-file-ref-check --warn
	Warning: Documentation/admin-guide/kernel-parameters.txt references a file that doesn't exist: Documentation/virt/kvm/amd-memory-encryption.rst
	Warning: Documentation/dev-tools/kunit/run_wrapper.rst references a file that doesn't exist: Documentation/dev-tools/kunit/non_uml.rst
	...

Those warnings are result of build-untested patches moving/renaming/removing 
documentation without updating all documentation.

On almost all Kernel versions, I usually send a couple of patch series
addressing them, but incomplete patches that forget about updating references
keep being merged.

Without htmldocs build tests by patch authors, this is an endless job.

2. ABI documentation check:

	$ ./scripts/get_abi.pl validate
	Warning: /sys/bus/iio/devices/iio:deviceX/fault_ovuv is defined 2 times:  Documentation/ABI/testing/sysfs-bus-iio-temperature-max31865:0  Documentation/ABI/testing/sysfs-bus-iio-temperature-max31856:14
	Warning: /sys/bus/iio/devices/iio:deviceX/in_filter_notch_center_frequency is defined 2 times:  Documentation/ABI/testing/sysfs-bus-iio:1948  Documentation/ABI/testing/sysfs-bus-iio-temperature-max31865:12
	Warning: /sys/bus/iio/devices/triggerX/sampling_frequency is defined 2 times:  Documentation/ABI/testing/sysfs-bus-iio:96  Documentation/ABI/testing/sysfs-bus-iio-timer-stm32:92
	Warning: /sys/devices/system/cpu/cpuX/topology/core_id is defined 2 times:  Documentation/ABI/stable/sysfs-devices-system-cpu:38  Documentation/ABI/testing/sysfs-devices-system-cpu:69

Those warnings indicate problems with userspace API definitions, as the 
same symbol has different meanings.

Talking about ABI, the output is even worse if the script is used to check
if the ABIs used on a running system are all documented or not. On my
laptop (Kernel 5.18.5-200.fc36.x86_64), I'm getting, for instance, 2815
undocumented or badly-specified sysfs ABI symbols: 

	$ sudo ./scripts/get_abi.pl undefined >errors
	Reading /sys directory contents...done.
	Converting ABI What fields into regexes...done.
	4:59: processing sysfs files... done
	$ wc -l errors
	2815

3. kernel-doc warnings.

Those indicate kernel-doc markups with troubles. The output is the same
as running:

	$ ./scripts/kernel-doc --none ./include/linux/fscache.h
	./include/linux/fscache.h:269: warning: Function parameter or member 'cookie' not described in 'fscache_use_cookie'
	./include/linux/fscache.h:269: warning: Excess function parameter 'object' description in 'fscache_use_cookie'
	./include/linux/fscache.h:286: warning: Function parameter or member 'cookie' not described in 'fscache_unuse_cookie'
	./include/linux/fscache.h:286: warning: Excess function parameter 'object' description in 'fscache_unuse_cookie'

In this particular case, kernel-doc markup describes a non-existent "object"
symbol, while the function prototype has "cookie". Probably result of some
rename at the function prototype that was not validated via html build.

4. Sphinx warnings.

Most of them are one line warnings:

	Documentation/arm/samsung-s3c24xx/cpufreq.rst:2: WARNING: Explicit markup ends without a blank line; unexpected unindent.
	Documentation/admin-guide/device-mapper/writecache.rst:23: WARNING: Unexpected indentation.
	Documentation/vm/highmem:166: ./include/linux/highmem.h:154: WARNING: Inline emphasis start-string without end-string.
	Documentation/vm/highmem:166: ./include/linux/highmem.h:157: WARNING: Inline emphasis start-string without end-string.

But on errors, Sphinx is very noisy, as it outputs the offending
lines or tables. 

For instance, on next-20220620, some patch broke a table.
The error there is very noisy, as it outputs the entire broken table.

> Seriously. There's a very solid reason why I require the standard
> kernel build to be entirely warning-free. Warnings are *BAD*. Even a
> single false-positive warning invalidates all other warnings.

All the Sphinx warnings could be avoided if people start testing
documentation changes. A policy of making kernel htmldocs warning-free
would have solved all the above issues.

I can submit some patches addressing issues along this week against
linux-next (or against your tree?), but without developers trying to
build documentation, we'll keep having issues.

> And the doc build isn't about some "single warning" thing.
> 
>  (b) it requires some unusual build tools
> 
> Now, (b) may some historical oddity, but at least if you have Fedora
> installed and it still has sphinx version 2.2.11 or something like
> that.
>
> And when you try to build docs, the makefile gives you some random pip
> install thing that is entirely bogus.

That's likely the case. You probably installed Sphinx via pip
on, let's say, Fedora 35. After upgrading to Fedora 36, python version
got incremented, and the past install won't work anymore, because it
would be trying to use patch libraries from a different directory. 

Since this changeset:

	a8b380c379ef ("scripts: sphinx-pre-install: only ask to activate valid venvs")

the documentation build checks if this command works:

	sphinx-build --version

If it doesn't, it will give instructions about how to install Sphinx.

> The proper fix is to actually remove that old sphinx environment
> entirely, and install "python3-sphinx" instead, but that's not at all
> what the "to upgrade Sphinx" docs in the kernel say when you try to
> make the docs.

The script which checks for Sphinx availability is capable of either
recommend distro-specific Sphinx package or the usage of python venv.

As Sphinx release cycle is fast, it was opted to use venv by default,
so, it currently recommends the usage of pip. 

The same script called at htmldocs build time can be used to recommend
the usage of the distro-provided package. Running it in Fedora, it would
give:

	./scripts/sphinx-pre-install --no-virtualenv
	Detected OS: Fedora release 36 (Thirty Six).
	ERROR: please install "python-sphinx", otherwise, build won't work.
	Warning: better to also install "sphinx_rtd_theme".
	Warning: better to also install "texlive-ctex".
	You should run:

		sudo dnf install -y python3-sphinx python3-sphinx_rtd_theme texlive-ctex
	note: If you want pdf, you need at least Sphinx 2.4.4.

	Can't build as 1 mandatory dependency is missing at ./scripts/sphinx-pre-install line 955.

It would be trivial to change the default to recommend the usage of the
distro package. Yet:

1. Newer versions of Sphinx are two times slower than 2.4.x;

2. Recommending the same version everywhere ensures that the
   documentation will be compatible with Sphinx >= 2.4.

3. Older LTS distros may not have a Sphinx version compatible with the
   Kernel.

> Anyway, (b) is one of those "the docs about the docs are wrong" things
> and ironic - but easily fixable if you know about it.
> 
> But (a) then makes it all entirely pointless as far as I'm concerned.
> The doc build could take five seconds, and I *still* wouldn't bother,
> because building docs doesn't actually do anything useful for me. It's
> just noise.


The hope is that, if building it would be fast enough, developers and
maintainers would actually check if the build succeeds without warnings,
as ultimately, the big noise is due to patches merged without being
even build-tested.

Regards,
Mauro


  reply	other threads:[~2022-06-26  7:55 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-17 20:57 [TECH TOPIC] What kernel documentation could be Jonathan Corbet
2022-06-17 20:57 ` [Ksummit-discuss] " Jonathan Corbet
2022-06-17 21:48 ` Laurent Pinchart
2022-06-17 21:48   ` Laurent Pinchart
2022-06-27 15:18   ` Jonathan Corbet
2022-06-18  8:24 ` Mauro Carvalho Chehab
2022-06-18  8:24   ` Mauro Carvalho Chehab
2022-06-18 11:03   ` Miguel Ojeda
2022-06-18 11:16     ` Mauro Carvalho Chehab
2022-06-18 11:16       ` Mauro Carvalho Chehab
2022-06-18 14:37       ` Miguel Ojeda
2022-06-23  9:18   ` Jani Nikula
2022-06-23  9:57     ` Mauro Carvalho Chehab
2022-06-23 10:30       ` Jani Nikula
2022-06-23 13:40       ` Jonathan Corbet
2022-06-24  7:33         ` Mauro Carvalho Chehab
2022-06-24 16:37           ` Markus Heiser
2022-06-27 15:27             ` Jonathan Corbet
2022-06-27 15:31               ` Christoph Hellwig
2022-06-28  7:43               ` Mauro Carvalho Chehab
2022-06-28  7:57                 ` Geert Uytterhoeven
2022-06-28 11:01                   ` Mauro Carvalho Chehab
2022-07-02 12:43                     ` Stephen Rothwell
2022-06-24 22:57           ` Jonathan Corbet
2022-06-25  9:10             ` Mauro Carvalho Chehab
2022-06-25 14:00               ` Jonathan Corbet
2022-06-25 18:11                 ` Linus Torvalds
2022-06-26  7:55                   ` Mauro Carvalho Chehab [this message]
2022-06-26  9:26                     ` Mauro Carvalho Chehab
2022-06-26  9:53                     ` Mauro Carvalho Chehab
2022-06-27 15:28                       ` Liam Howlett
2022-06-27 15:54                         ` Christian Brauner
2022-06-27 16:27                         ` Mark Brown
2022-06-28 10:53                           ` Mauro Carvalho Chehab
2022-06-28 16:13                         ` Luck, Tony
2022-06-27 15:34                   ` Jonathan Corbet
2022-06-27 17:07                     ` Linus Torvalds
2022-07-01  8:48                       ` [PATCH 0/4] Address some issues with sphinx detection Mauro Carvalho Chehab
2022-07-01  8:48                         ` [PATCH 1/4] scripts: sphinx-pre-install: fix venv version check logic Mauro Carvalho Chehab
2022-07-01  8:48                         ` [PATCH 2/4] scripts: sphinx-pre-install: report broken venv Mauro Carvalho Chehab
2022-07-01  8:48                         ` [PATCH 3/4] scripts: sphinx-pre-install: check for PDF min version later on Mauro Carvalho Chehab
2022-07-01  8:48                         ` [PATCH 4/4] scripts: sphinx-pre-install: provide both venv and package installs Mauro Carvalho Chehab
2022-07-02 10:11                       ` [PATCH v2 0/5] Address some issues with sphinx detection Mauro Carvalho Chehab
2022-07-02 10:11                         ` [PATCH v2 1/5] scripts: sphinx-pre-install: fix venv version check logic Mauro Carvalho Chehab
2022-07-02 10:11                         ` [PATCH v2 2/5] scripts: sphinx-pre-install: report broken venv Mauro Carvalho Chehab
2022-07-02 10:11                         ` [PATCH v2 3/5] scripts: sphinx-pre-install: check for PDF min version later on Mauro Carvalho Chehab
2022-07-02 10:11                         ` [PATCH v2 4/5] scripts: sphinx-pre-install: provide both venv and package installs Mauro Carvalho Chehab
2022-07-02 10:11                         ` [PATCH v2 5/5] scripts: sphinx-pre-install: place a warning for Sphinx >= 3.0 Mauro Carvalho Chehab
2022-07-05  4:15                         ` [PATCH v2 0/5] Address some issues with sphinx detection Akira Yokosawa
2022-07-06 14:31                           ` Akira Yokosawa
2022-07-07 20:33                             ` Mauro Carvalho Chehab
2022-07-07 18:45                           ` Jonathan Corbet
2022-07-07 20:25                             ` Mauro Carvalho Chehab
2022-07-07 20:15                           ` Mauro Carvalho Chehab
2022-07-08 11:34                             ` Expectation to --no-pdf option (was Re: [PATCH v2 0/5] Address some issues with sphinx detection) Akira Yokosawa
2022-07-08 14:02                               ` Jonathan Corbet
2022-07-08 14:59                                 ` Mauro Carvalho Chehab
2022-07-08 15:27                                   ` Akira Yokosawa
2022-07-08 23:01                                     ` Akira Yokosawa
2022-07-09  7:59                                       ` Mauro Carvalho Chehab
2022-07-11 11:23                                         ` Akira Yokosawa
2022-08-01 23:30                         ` [PATCH v2 0/5] Address some issues with sphinx detection Tomasz Warniełło
2022-07-02 10:52                   ` [Ksummit-discuss] [TECH TOPIC] What kernel documentation could be Mauro Carvalho Chehab
2022-06-25 17:43 ` Steven Rostedt
2022-06-25 17:48   ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220626085524.42ee92c0@sal.lan \
    --to=mchehab@kernel.org \
    --cc=corbet@lwn.net \
    --cc=jani.nikula@intel.com \
    --cc=ksummit-discuss@lists.linuxfoundation.org \
    --cc=ksummit@lists.linux.dev \
    --cc=markus.heiser@darmarit.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.