linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Linux Doc Mailing List <linux-doc@vger.kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
	coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
	linux-block@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-hardening@vger.kernel.org, linux-iio@vger.kernel.org,
	linux-media@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-usb@vger.kernel.org, linux-wireless@vger.kernel.org,
	netdev@vger.kernel.org, workflows@vger.kernel.org
Subject: [RFC v2 00/38] Improve ABI documentation generation
Date: Tue, 28 Jan 2025 01:05:49 +0100	[thread overview]
Message-ID: <cover.1738020236.git.mchehab+huawei@kernel.org> (raw)

Hi Jon/Greg,

That's the second version of my RFC patches meant to modenize the ABI
parser that I wrote in Perl.

I originally started it due to some issues I noticed when searching for
ABI symbols. While I could just go ahead and fix the already existing
script, I noticed that the script maintainance didn't have much care over
all those years, probably because it is easier to find Python programmers
those days.

Also, the code is complex and was not using modules or classes and
were using lots of global variables.

So, I decided to rewrite it in Python. I started with a manual conversion
for each function. Yet, to avoid future maintainership issues, I opted to
divide the code on three classes. One class for the ABI parser, another
one for regex conversion (used when checking symbols from local hardware,
and an extra class for undefined symbols check.

I opted to change the Sphinx integration gradually using different
patch sets on 4 phases:

1. minimal integration: just execute the new script on a similar way as
   the perl one;
2. the kernel_abi module was changed to import the ABI parser class,
   using it directly;
3. the logic at kernel_abi were rewritten to better integrate. As a bonus,
   Sphinx now imports ReST data symbol by symbol. That solves one of
   the issues I was discomfortable with the original approach: when lots
   of data is sent to Sphinx parser, it stops in the middle of processing.
   This was addressed in the past on a hacky way, but it could cause
   problems in the future as the number of symbols increase;
4. the ABI parser part is now called either by automarkup and kernel_abi.
   This allowed automarkup to solve ABI symbols.

Together with this series, I added some patches fixing issues and warnings
when generating documentation.

Some notes about this new RFC:

- despite being able to generate documentation cross-references with
  auto-markup, the documentation build timt didn't increase on my machine
  (it was actually 5 seconds faster);
- I rewrote some algorithms at the undefined symbol detection code. With
  that, it is now a lot faster than the previous version, at least on my desktop
  (wich has 24 CPU threads). I didn't try it on a server yet;
- the undefined parser can optionally use multiple CPUs. This sounds
  fancier than it seems: Python (up to version 3.12) is really bad with
  multi-CPU support and doesn't have real multi-thread support. Python
  3.13 has now an optional way to address that (although I didn't test yet,
  as it requires Python manual compilation). When such feature becomes
  standard, maybe the undefined symbols detection will be faster.

Btw, I'm opting to send this as an RFC because I'd like to have more
people testing and checking it. In particular, the undefined ABI check
is complex, as it requires lots of tricks to reduce the run time from hours
to seconds.
  
On this series we have:

patches 1 to 11: several bug fixes addressing issues at ABI symbols;
patch 12: a fix for scripts/documentation-file-ref-check
patches 13-15: create new script with rest and search logic and 
  minimally integrate with kernel_abi Sphinx extension(phase 1);
patches 16-19: implement phase 2: class integration (phase 2);
patch 20: fix a bug at kernel_abi: the way it splits lines is buggy;
patches  21-24: rewrite kernel_abi logic to make it simpler and more
  robust;
patches 25-27: add cross-reference support at automarkup;
patches 28-36: several ABI cleanups to cope with the improvements;
patch 37: implement undefined command;
patch 38: get rid of the old Perl script.

To make it easier to review/apply, I may end breaking the next version
on a couple of different patchsets. Still it would be nice to have more
people testing it and providing some feedback.

---
RFC v2:
  - Dropped a patch touching the perl script;
  - Implemented phases 2-4 of the script's logic;
  - Added ABI cross-references via automarkup;
  - Added support for undefined logic;
  - Added more ABI and scripts' fixes;
  - Added undefined logic;
  - Added a patch to remove the old tool.

Mauro Carvalho Chehab (38):
  docs: power: video.rst: fix a footnote reference
  docs: media: ipu3: fix two footnote references
  docs: block: ublk.rst: remove a reference from a dropped text
  docs: sphinx: remove kernellog.py file
  docs: sphinx/kernel_abi: adjust coding style
  docs: admin-guide: abi: add SPDX tags to ABI files
  ABI: sysfs-class-rfkill: fix kernelversion tags
  ABI: sysfs-bus-coresight-*: fix kernelversion tags
  ABI: sysfs-driver-dma-idxd: fix date tags
  ABI: sysfs-fs-f2fs: fix date tags
  ABI: sysfs-power: fix a what tag
  scripts/documentation-file-ref-check: don't check perl/python scripts
  scripts/get_abi.py: add a Python tool to generate ReST output
  scripts/get_abi.py: add support for symbol search
  docs: use get_abi.py for ABI generation
  scripts/get_abi.py: optimize parse_abi() function
  scripts/get_abi.py: use an interactor for ReST output
  docs: sphinx/kernel_abi: use AbiParser directly
  docs: sphinx/kernel_abi: reduce buffer usage for ABI messages
  docs: sphinx/kernel_abi: properly split lines
  scripts/get_abi.pl: Add filtering capabilities to rest output
  scripts/get_abi.pl: add support to parse ABI README file
  docs: sphinx/kernel_abi: parse ABI files only once
  docs: admin-guide/abi: split files from symbols
  docs: sphinx/automarkup: add cross-references for ABI
  docs: sphinx/kernel_abi: avoid warnings during Sphinx module init
  scripts/get_abi.py: Rename title name for ABI files
  docs: media: Allow creating cross-references for RC ABI
  docs: thunderbolt: Allow creating cross-references for ABI
  docs: arm: asymmetric-32bit: Allow creating cross-references for ABI
  docs: arm: generic-counter: Allow creating cross-references for ABI
  docs: iio: Allow creating cross-references ABI
  docs: networking: Allow creating cross-references statistics ABI
  docs: submit-checklist: Allow creating cross-references for ABI README
  docs: translations: Allow creating cross-references for ABI README
  docs: ABI: drop two duplicate symbols
  scripts/get_abi.py: add support for undefined ABIs
  scripts/get_abi.pl: drop now obsoleted script

 Documentation/ABI/removed/sysfs-class-rfkill  |    2 +-
 Documentation/ABI/stable/sysfs-class-rfkill   |   12 +-
 .../ABI/stable/sysfs-devices-system-cpu       |   10 -
 .../ABI/stable/sysfs-driver-dma-idxd          |    4 +-
 .../testing/sysfs-bus-coresight-devices-cti   |   78 +-
 .../testing/sysfs-bus-coresight-devices-tpdm  |   52 +-
 Documentation/ABI/testing/sysfs-fs-f2fs       |    4 +-
 Documentation/ABI/testing/sysfs-power         |    2 +-
 .../admin-guide/abi-obsolete-files.rst        |    7 +
 Documentation/admin-guide/abi-obsolete.rst    |    6 +-
 Documentation/admin-guide/abi-readme-file.rst |    6 +
 .../admin-guide/abi-removed-files.rst         |    7 +
 Documentation/admin-guide/abi-removed.rst     |    6 +-
 .../admin-guide/abi-stable-files.rst          |    7 +
 Documentation/admin-guide/abi-stable.rst      |    6 +-
 .../admin-guide/abi-testing-files.rst         |    7 +
 Documentation/admin-guide/abi-testing.rst     |    6 +-
 Documentation/admin-guide/abi.rst             |   17 +
 Documentation/admin-guide/media/ipu3.rst      |   12 +-
 Documentation/admin-guide/thunderbolt.rst     |    2 +-
 Documentation/arch/arm64/asymmetric-32bit.rst |    2 +-
 Documentation/block/ublk.rst                  |    2 -
 Documentation/driver-api/generic-counter.rst  |    4 +-
 Documentation/driver-api/iio/core.rst         |    2 +-
 Documentation/iio/iio_devbuf.rst              |    2 +-
 Documentation/networking/statistics.rst       |    2 +-
 Documentation/power/video.rst                 |    2 +-
 Documentation/process/submit-checklist.rst    |    2 +-
 Documentation/sphinx/automarkup.py            |   56 +
 Documentation/sphinx/kernel_abi.py            |  162 +-
 Documentation/sphinx/kerneldoc.py             |   14 +-
 Documentation/sphinx/kernellog.py             |   22 -
 Documentation/sphinx/kfigure.py               |   81 +-
 .../it_IT/process/submit-checklist.rst        |    2 +-
 .../sp_SP/process/submit-checklist.rst        |    2 +-
 .../zh_CN/process/submit-checklist.rst        |    2 +-
 .../zh_TW/process/submit-checklist.rst        |    2 +-
 .../userspace-api/media/rc/rc-sysfs-nodes.rst |    2 +-
 scripts/documentation-file-ref-check          |    2 +-
 scripts/get_abi.pl                            | 1103 -------------
 scripts/get_abi.py                            | 1437 +++++++++++++++++
 41 files changed, 1804 insertions(+), 1354 deletions(-)
 create mode 100644 Documentation/admin-guide/abi-obsolete-files.rst
 create mode 100644 Documentation/admin-guide/abi-readme-file.rst
 create mode 100644 Documentation/admin-guide/abi-removed-files.rst
 create mode 100644 Documentation/admin-guide/abi-stable-files.rst
 create mode 100644 Documentation/admin-guide/abi-testing-files.rst
 delete mode 100644 Documentation/sphinx/kernellog.py
 delete mode 100755 scripts/get_abi.pl
 create mode 100755 scripts/get_abi.py

-- 
2.48.1



             reply	other threads:[~2025-01-28  0:06 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-28  0:05 Mauro Carvalho Chehab [this message]
2025-01-28  0:05 ` [RFC v2 01/38] docs: power: video.rst: fix a footnote reference Mauro Carvalho Chehab
2025-01-28 22:10   ` Jonathan Corbet
2025-01-28  0:05 ` [RFC v2 02/38] docs: media: ipu3: fix two footnote references Mauro Carvalho Chehab
2025-01-28  0:05 ` [RFC v2 03/38] docs: block: ublk.rst: remove a reference from a dropped text Mauro Carvalho Chehab
2025-01-28  0:05 ` [RFC v2 04/38] docs: sphinx: remove kernellog.py file Mauro Carvalho Chehab
2025-01-28  0:05 ` [RFC v2 05/38] docs: sphinx/kernel_abi: adjust coding style Mauro Carvalho Chehab
2025-02-04 17:19   ` Jonathan Corbet
2025-01-28  0:05 ` [RFC v2 06/38] docs: admin-guide: abi: add SPDX tags to ABI files Mauro Carvalho Chehab
2025-01-28  0:05 ` [RFC v2 07/38] ABI: sysfs-class-rfkill: fix kernelversion tags Mauro Carvalho Chehab
2025-01-28  0:05 ` [RFC v2 08/38] ABI: sysfs-bus-coresight-*: " Mauro Carvalho Chehab
2025-02-04 10:30   ` Suzuki K Poulose
2025-01-28  0:05 ` [RFC v2 09/38] ABI: sysfs-driver-dma-idxd: fix date tags Mauro Carvalho Chehab
2025-01-28  0:05 ` [RFC v2 10/38] ABI: sysfs-fs-f2fs: " Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 11/38] ABI: sysfs-power: fix a what tag Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 12/38] scripts/documentation-file-ref-check: don't check perl/python scripts Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 13/38] scripts/get_abi.py: add a Python tool to generate ReST output Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 14/38] scripts/get_abi.py: add support for symbol search Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 15/38] docs: use get_abi.py for ABI generation Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 16/38] scripts/get_abi.py: optimize parse_abi() function Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 17/38] scripts/get_abi.py: use an interactor for ReST output Mauro Carvalho Chehab
2025-01-29 11:04   ` Akira Yokosawa
2025-01-29 14:06     ` Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 18/38] docs: sphinx/kernel_abi: use AbiParser directly Mauro Carvalho Chehab
2025-01-28 22:37   ` Jonathan Corbet
2025-01-29  0:43     ` Mauro Carvalho Chehab
2025-02-02 14:56       ` Mauro Carvalho Chehab
2025-02-04 17:12         ` Jonathan Corbet
2025-02-10  7:27           ` Mauro Carvalho Chehab
2025-02-10 14:40             ` Jonathan Corbet
2025-02-10 16:03               ` Mauro Carvalho Chehab
2025-02-16 12:53                 ` Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 19/38] docs: sphinx/kernel_abi: reduce buffer usage for ABI messages Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 20/38] docs: sphinx/kernel_abi: properly split lines Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 21/38] scripts/get_abi.pl: Add filtering capabilities to rest output Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 22/38] scripts/get_abi.pl: add support to parse ABI README file Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 23/38] docs: sphinx/kernel_abi: parse ABI files only once Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 24/38] docs: admin-guide/abi: split files from symbols Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 25/38] docs: sphinx/automarkup: add cross-references for ABI Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 26/38] docs: sphinx/kernel_abi: avoid warnings during Sphinx module init Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 27/38] scripts/get_abi.py: Rename title name for ABI files Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 28/38] docs: media: Allow creating cross-references for RC ABI Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 29/38] docs: thunderbolt: Allow creating cross-references for ABI Mauro Carvalho Chehab
2025-01-28 11:27   ` Mika Westerberg
2025-01-28  0:06 ` [RFC v2 30/38] docs: arm: asymmetric-32bit: " Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 31/38] docs: arm: generic-counter: " Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 32/38] docs: iio: Allow creating cross-references ABI Mauro Carvalho Chehab
2025-01-28 18:27   ` Jonathan Cameron
2025-01-28  0:06 ` [RFC v2 33/38] docs: networking: Allow creating cross-references statistics ABI Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 34/38] docs: submit-checklist: Allow creating cross-references for ABI README Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 35/38] docs: translations: " Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 36/38] docs: ABI: drop two duplicate symbols Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 37/38] scripts/get_abi.py: add support for undefined ABIs Mauro Carvalho Chehab
2025-01-28  0:06 ` [RFC v2 38/38] scripts/get_abi.pl: drop now obsoleted script Mauro Carvalho Chehab
2025-01-28 22:42 ` [RFC v2 00/38] Improve ABI documentation generation Jonathan Corbet
2025-01-29  1:45   ` Mauro Carvalho Chehab
2025-01-29 14:22     ` Mauro Carvalho Chehab
2025-01-29 15:41   ` Mauro Carvalho Chehab
2025-01-29 15:58     ` Jonathan Corbet
2025-01-29 16:19       ` Mauro Carvalho Chehab
2025-03-27 21:58 ` [f2fs-dev] " patchwork-bot+f2fs

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=cover.1738020236.git.mchehab+huawei@kernel.org \
    --to=mchehab+huawei@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=corbet@lwn.net \
    --cc=coresight@lists.linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=workflows@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).