Skip to content

RFC Improve ABI documentation generation

Mauro Carvalho Chehab bpf linux-arm-kernel linux-block linux-doc linux-f2fs-devel linux-hardening linux-iio linux-media linux-pm linux-usb linux-wireless lkml netdev workflows 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest38 patches 21 repliesIn review 1 of 38 applied
  2. v1 RFC10 patches 0 repliesSuperseded 1 of 10 applied

Changes in v2 from the cover letter

- 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.

Patches in v2 1 of 38 applied

#Subject and filesSizeRepliesApplied
1/38docs: power: video.rst: fix a footnote referenceDocumentation/power/video.rst+1 -11 reply
2/38docs: media: ipu3: fix two footnote referencesDocumentation/admin-guide/media/ipu3.rst+6 -60 replies
3/38docs: block: ublk.rst: remove a reference from a dropped textDocumentation/block/ublk.rst+0 -20 replies
4/38docs: sphinx: remove kernellog.py fileDocumentation/sphinx/kernel_abi.py Documentation/sphinx/kerneldoc.py Documentation/sphinx/kernellog.py +1 more+53 -690 replies
5/38docs: sphinx/kernel_abi: adjust coding styleDocumentation/sphinx/kernel_abi.py+13 -151 reply
6/38docs: admin-guide: abi: add SPDX tags to ABI filesDocumentation/admin-guide/abi-obsolete.rst Documentation/admin-guide/abi-removed.rst Documentation/admin-guide/abi-stable.rst +2 more+10 -00 replies
7/38ABI: sysfs-class-rfkill: fix kernelversion tagsDocumentation/ABI/removed/sysfs-class-rfkill Documentation/ABI/stable/sysfs-class-rfkill+7 -70 replies
8/38ABI: sysfs-bus-coresight-*: fix kernelversion tagsDocumentation/ABI/testing/sysfs-bus-coresight-devices-cti Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm+65 -651 reply
9/38ABI: sysfs-driver-dma-idxd: fix date tagsDocumentation/ABI/stable/sysfs-driver-dma-idxd+2 -20 replies
10/38ABI: sysfs-fs-f2fs: fix date tagsDocumentation/ABI/testing/sysfs-fs-f2fs+2 -20 repliesApplied
11/38ABI: sysfs-power: fix a what tagDocumentation/ABI/testing/sysfs-power+1 -10 replies
12/38scripts/documentation-file-ref-check: don't check perl/python scriptsscripts/documentation-file-ref-check+1 -10 replies
13/38scripts/get_abi.py: add a Python tool to generate ReST outputscripts/get_abi.py+619 -00 replies
14/38scripts/get_abi.py: add support for symbol searchscripts/get_abi.py+76 -00 replies
15/38docs: use get_abi.py for ABI generationDocumentation/admin-guide/abi-obsolete.rst Documentation/admin-guide/abi-removed.rst Documentation/admin-guide/abi-stable.rst +2 more+3 -110 replies
16/38scripts/get_abi.py: optimize parse_abi() functionscripts/get_abi.py+38 -190 replies
17/38scripts/get_abi.py: use an interactor for ReST outputscripts/get_abi.py+29 -232 replies
18/38docs: sphinx/kernel_abi: use AbiParser directlyDocumentation/sphinx/kernel_abi.py scripts/get_abi.py+16 -128 replies
19/38docs: sphinx/kernel_abi: reduce buffer usage for ABI messagesDocumentation/sphinx/kernel_abi.py scripts/get_abi.py+48 -450 replies
20/38docs: sphinx/kernel_abi: properly split linesDocumentation/sphinx/kernel_abi.py+3 -20 replies
21/38scripts/get_abi.pl: Add filtering capabilities to rest outputscripts/get_abi.py+26 -80 replies
22/38scripts/get_abi.pl: add support to parse ABI README filescripts/get_abi.py+20 -50 replies
23/38docs: sphinx/kernel_abi: parse ABI files only onceDocumentation/admin-guide/abi-obsolete.rst Documentation/admin-guide/abi-removed.rst Documentation/admin-guide/abi-stable.rst +3 more+81 -640 replies
24/38docs: admin-guide/abi: split files from symbolsDocumentation/admin-guide/abi-obsolete-files.rst Documentation/admin-guide/abi-obsolete.rst Documentation/admin-guide/abi-readme-file.rst +7 more+53 -00 replies
25/38docs: sphinx/automarkup: add cross-references for ABIDocumentation/sphinx/automarkup.py scripts/get_abi.py+56 -00 replies
26/38docs: sphinx/kernel_abi: avoid warnings during Sphinx module initDocumentation/sphinx/automarkup.py Documentation/sphinx/kernel_abi.py+22 -50 replies
27/38scripts/get_abi.py: Rename title name for ABI filesscripts/get_abi.py+1 -10 replies
28/38docs: media: Allow creating cross-references for RC ABIDocumentation/sphinx/automarkup.py Documentation/userspace-api/media/rc/rc-sysfs-nodes.rst+14 -50 replies
29/38docs: thunderbolt: Allow creating cross-references for ABIDocumentation/admin-guide/thunderbolt.rst+1 -11 reply
30/38docs: arm: asymmetric-32bit: Allow creating cross-references for ABIDocumentation/arch/arm64/asymmetric-32bit.rst+1 -10 replies
31/38docs: arm: generic-counter: Allow creating cross-references for ABIDocumentation/driver-api/generic-counter.rst+2 -20 replies
32/38docs: iio: Allow creating cross-references ABIDocumentation/driver-api/iio/core.rst Documentation/iio/iio_devbuf.rst+2 -21 reply
33/38docs: networking: Allow creating cross-references statistics ABIDocumentation/networking/statistics.rst+1 -10 replies
34/38docs: submit-checklist: Allow creating cross-references for ABI READMEDocumentation/process/submit-checklist.rst+1 -10 replies
35/38docs: translations: Allow creating cross-references for ABI READMEDocumentation/translations/it_IT/process/submit-checklist.rst Documentation/translations/sp_SP/process/submit-checklist.rst Documentation/translations/zh_CN/process/submit-checklist.rst +1 more+4 -40 replies
36/38docs: ABI: drop two duplicate symbolsDocumentation/ABI/stable/sysfs-devices-system-cpu+0 -100 replies
37/38scripts/get_abi.py: add support for undefined ABIsscripts/get_abi.py+669 -10 replies
38/38scripts/get_abi.pl: drop now obsoleted scriptscripts/get_abi.pl+0 -11030 replies

Reviews trailers per patch

3 of 38 patches have a Reviewed-by or Acked-by.

PatchMika WesterbergJonathan CameronSuzuki K Poulose
1/38
2/38
3/38
4/38
5/38
6/38
7/38
8/38A-b
9/38
10/38
11/38
12/38
13/38
14/38
15/38
16/38
17/38
18/38
19/38
20/38
21/38
22/38
23/38
24/38
25/38
26/38
27/38
28/38
29/38A-b
30/38
31/38
32/38A-b
33/38
34/38
35/38
36/38
37/38
38/38

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [RFC v2 00/38] Improve ABI documentation generation

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
Signature · 1 line
2.48.1