From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>,
Jonathan Corbet <corbet@lwn.net>,
Linux Doc Mailing List <linux-doc@vger.kernel.org>,
linux-kernel@vger.kernel.org,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
Kees Cook <kees@kernel.org>, Russell King <linux@armlinux.org.uk>,
linux-hardening@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH v3 00/33] Implement kernel-doc in Python
Date: Tue, 15 Apr 2025 16:51:02 +0800 [thread overview]
Message-ID: <20250415165102.44551ada@sal.lan> (raw)
In-Reply-To: <20250415164014.575c0892@sal.lan>
Em Tue, 15 Apr 2025 16:40:34 +0800
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> escreveu:
> Em Tue, 15 Apr 2025 11:19:26 +0300
> Andy Shevchenko <andriy.shevchenko@intel.com> escreveu:
>
> > On Tue, Apr 15, 2025 at 11:17:12AM +0300, Andy Shevchenko wrote:
> > > On Tue, Apr 15, 2025 at 10:49:29AM +0300, Jani Nikula wrote:
> > > > On Tue, 15 Apr 2025, Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> > > > > On Tue, Apr 15, 2025 at 10:01:04AM +0300, Andy Shevchenko wrote:
> > > > >> On Mon, Apr 14, 2025 at 09:17:51AM -0600, Jonathan Corbet wrote:
> > > > >> > Andy Shevchenko <andriy.shevchenko@intel.com> writes:
> > > > >> > > On Wed, Apr 09, 2025 at 12:30:00PM -0600, Jonathan Corbet wrote:
> > > > >> > >> Mauro Carvalho Chehab <mchehab+huawei@kernel.org> writes:
> > > > >> > >>
> > > > >> > >> > This changeset contains the kernel-doc.py script to replace the verable
> > > > >> > >> > kernel-doc originally written in Perl. It replaces the first version and the
> > > > >> > >> > second series I sent on the top of it.
> > > > >> > >>
> > > > >> > >> OK, I've applied it, looked at the (minimal) changes in output, and
> > > > >> > >> concluded that it's good - all this stuff is now in docs-next. Many
> > > > >> > >> thanks for doing this!
> > > > >> > >>
> > > > >> > >> I'm going to hold off on other documentation patches for a day or two
> > > > >> > >> just in case anything turns up. But it looks awfully good.
> > > > >> > >
> > > > >> > > This started well, until it becomes a scripts/lib/kdoc.
> > > > >> > > So, it makes the `make O=...` builds dirty *). Please make sure this doesn't leave
> > > > >> > > "disgusting turd" )as said by Linus) in the clean tree.
> > > > >> > >
> > > > >> > > *) it creates that __pycache__ disaster. And no, .gitignore IS NOT a solution.
> > > > >> >
> > > > >> > If nothing else, "make cleandocs" should clean it up, certainly.
> > > > >> >
> > > > >> > We can also tell CPython to not create that directory at all. I'll run
> > > > >> > some tests to see what the effect is on the documentation build times;
> > > > >> > I'm guessing it will not be huge...
> > > > >>
> > > > >> I do not build documentation at all, it's just a regular code build that leaves
> > > > >> tree dirty.
> > > > >>
> > > > >> $ python3 --version
> > > > >> Python 3.13.2
> > > > >>
> > > > >> It's standard Debian testing distribution, no customisation in the code.
> > > > >>
> > > > >> To reproduce.
> > > > >> 1) I have just done a new build to reduce the churn, so, running make again does nothing;
> > > > >> 2) The following snippet in shell shows the issue
> > > > >>
> > > > >> $ git clean -xdf
> > > > >> $ git status --ignored
> > > > >> On branch ...
> > > > >> nothing to commit, working tree clean
> > > > >>
> > > > >> $ make LLVM=-19 O=.../out W=1 C=1 CF=-D__CHECK_ENDIAN__ -j64
> > > > >> make[1]: Entering directory '...'
> > > > >> GEN Makefile
> > > > >> DESCEND objtool
> > > > >> CALL .../scripts/checksyscalls.sh
> > > > >> INSTALL libsubcmd_headers
> > > > >> .pylintrc: warning: ignored by one of the .gitignore files
> > > > >> Kernel: arch/x86/boot/bzImage is ready (#23)
> > > > >> make[1]: Leaving directory '...'
> > > > >>
> > > > >> $ touch drivers/gpio/gpiolib-acpi.c
> > > > >>
> > > > >> $ make LLVM=-19 O=.../out W=1 C=1 CF=-D__CHECK_ENDIAN__ -j64
> > > > >> make[1]: Entering directory '...'
> > > > >> GEN Makefile
> > > > >> DESCEND objtool
> > > > >> CALL .../scripts/checksyscalls.sh
> > > > >> INSTALL libsubcmd_headers
> > > > >> ...
> > > > >> OBJCOPY arch/x86/boot/setup.bin
> > > > >> BUILD arch/x86/boot/bzImage
> > > > >> Kernel: arch/x86/boot/bzImage is ready (#24)
> > > > >> make[1]: Leaving directory '...'
> > > > >>
> > > > >> $ git status --ignored
> > > > >> On branch ...
> > > > >> Untracked files:
> > > > >> (use "git add <file>..." to include in what will be committed)
> > > > >> scripts/lib/kdoc/__pycache__/
> > > > >>
> > > > >> nothing added to commit but untracked files present (use "git add" to track)
> > > > >
> > > > > FWIW, I repeated this with removing the O=.../out folder completely, so it's
> > > > > fully clean build. Still the same issue.
> > > > >
> > > > > And it appears at the very beginning of the build. You don't need to wait to
> > > > > have the kernel to be built actually.
> > > >
> > > > kernel-doc gets run on source files for W=1 builds. See Makefile.build.
> > >
> > > Thanks for the clarification, so we know that it runs and we know that it has
> > > an issue.
> >
> > Ideal solution what would I expect is that the cache folder should respect
> > the given O=... argument, or disabled at all (but I don't think the latter
> > is what we want as it may slow down the build).
>
> From:
> https://github.com/python/cpython/commit/b193fa996a746111252156f11fb14c12fd6267e6
> and:
> https://peps.python.org/pep-3147/
>
> It sounds that Python 3.8 and above have a way to specify the cache
> location, via PYTHONPYCACHEPREFIX env var, and via "-X pycache_prefix=path".
>
> As the current minimal Python version is 3.9, we can safely use it.
>
> So, maybe this would work:
>
> make O="../out" PYTHONPYCACHEPREFIX="../out"
>
> or a variant of it:
>
> PYTHONPYCACHEPREFIX="../out" make O="../out"
>
> If this works, we can adjust the building system to fill PYTHONPYCACHEPREFIX
> env var when O= is used.
That's interesting... Sphinx is already called with PYTHONDONTWRITEBYTECODE.
From Documentation/Makefile:
quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
cmd_sphinx = $(MAKE) BUILDDIR=$(abspath $(BUILDDIR)) $(build)=Documentation/userspace-api/media $2 && \
PYTHONDONTWRITEBYTECODE=1 \
...
It seems that the issue happens only when W=1 is used and kernel-doc
is called outside Sphinx.
Anyway, IMHO, the best would be to change the above to:
PYTHONPYCACHEPREFIX=$(abspath $(BUILDDIR))
And do the same for the other places where kernel-doc is called:
include/drm/Makefile: $(srctree)/scripts/kernel-doc -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \
scripts/Makefile.build: cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $(KDOCFLAGS) \
scripts/find-unused-docs.sh: str=$(scripts/kernel-doc -export "$file" 2>/dev/null)
Comments?
Regards,
Mauro
next prev parent reply other threads:[~2025-04-15 8:51 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-08 10:09 [PATCH v3 00/33] Implement kernel-doc in Python Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 01/33] scripts/kernel-doc: rename it to scripts/kernel-doc.pl Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 02/33] scripts/kernel-doc: add a symlink to the Perl version of kernel-doc Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 03/33] scripts/kernel-doc.py: add a Python parser Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 04/33] scripts/kernel-doc.py: output warnings the same way as kerneldoc Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 05/33] scripts/kernel-doc.py: better handle empty sections Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 06/33] scripts/kernel-doc.py: properly handle struct_group macros Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 07/33] scripts/kernel-doc.py: move regex methods to a separate file Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 08/33] scripts/kernel-doc.py: move KernelDoc class " Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 09/33] scripts/kernel-doc.py: move KernelFiles " Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 10/33] scripts/kernel-doc.py: move output classes " Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 11/33] scripts/kernel-doc.py: convert message output to an interactor Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 12/33] scripts/kernel-doc.py: move file lists to the parser function Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 13/33] scripts/kernel-doc.py: implement support for -no-doc-sections Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 14/33] scripts/kernel-doc.py: fix line number output Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 15/33] scripts/kernel-doc.py: fix handling of doc output check Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 16/33] scripts/kernel-doc.py: properly handle out_section for ReST Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 17/33] scripts/kernel-doc.py: postpone warnings to the output plugin Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 18/33] docs: add a .pylintrc file with sys path for docs scripts Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 19/33] docs: sphinx: kerneldoc: verbose kernel-doc command if V=1 Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 20/33] docs: sphinx: kerneldoc: ignore "\" characters from options Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 21/33] docs: sphinx: kerneldoc: use kernel-doc.py script Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 22/33] scripts/kernel-doc.py: Set an output format for --none Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 23/33] scripts/kernel-doc.py: adjust some coding style issues Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 24/33] scripts/lib/kdoc/kdoc_parser.py: fix Python compat with < v3.13 Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 25/33] scripts/kernel-doc.py: move modulename to man class Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 26/33] scripts/kernel-doc.py: properly handle KBUILD_BUILD_TIMESTAMP Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 27/33] scripts/lib/kdoc/kdoc_parser.py: remove a python 3.9 dependency Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 28/33] scripts/kernel-doc.py: Properly handle Werror and exit codes Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 29/33] scripts/kernel-doc: switch to use kernel-doc.py Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 30/33] scripts/lib/kdoc/kdoc_files.py: allow filtering output per fname Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 31/33] scripts/kernel_doc.py: better handle exported symbols Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 32/33] scripts/kernel-doc.py: Rename the kernel doc Re class to KernRe Mauro Carvalho Chehab
2025-04-08 10:09 ` [PATCH v3 33/33] scripts: kernel-doc: fix parsing function-like typedefs (again) Mauro Carvalho Chehab
2025-04-09 5:29 ` [PATCH v3 00/33] Implement kernel-doc in Python Mauro Carvalho Chehab
2025-04-09 10:16 ` Jani Nikula
2025-04-09 11:44 ` Mauro Carvalho Chehab
2025-04-09 18:30 ` Jonathan Corbet
2025-04-14 9:41 ` Andy Shevchenko
2025-04-14 15:17 ` Jonathan Corbet
2025-04-14 15:54 ` Jonathan Corbet
2025-04-15 7:01 ` Andy Shevchenko
2025-04-15 7:03 ` Andy Shevchenko
2025-04-15 7:49 ` Jani Nikula
2025-04-15 8:17 ` Andy Shevchenko
2025-04-15 8:19 ` Andy Shevchenko
2025-04-15 8:40 ` Mauro Carvalho Chehab
2025-04-15 8:51 ` Mauro Carvalho Chehab [this message]
2025-04-15 9:53 ` Andy Shevchenko
2025-04-15 9:51 ` Andy Shevchenko
2025-04-15 9:54 ` Andy Shevchenko
2025-04-15 10:06 ` Mauro Carvalho Chehab
2025-04-15 11:13 ` Andy Shevchenko
2025-04-15 13:34 ` Jonathan Corbet
2025-04-16 6:44 ` Mauro Carvalho Chehab
2025-04-15 8:30 ` Mauro Carvalho Chehab
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=20250415165102.44551ada@sal.lan \
--to=mchehab+huawei@kernel.org \
--cc=andriy.shevchenko@intel.com \
--cc=corbet@lwn.net \
--cc=gustavoars@kernel.org \
--cc=jani.nikula@linux.intel.com \
--cc=kees@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).