2021-05-19 12:49:21

by Lukas Bulwahn

[permalink] [raw]
Subject: [RFC PATCH 0/1] Mining maintainers for kernel headers

Greg, Jiri,

Some basic data mining on the kernel development process [1, 2, 3] showed that
various files in ./include currently do not have a maintainer formally assigned
with a section in the MAINTAINERS file.

This is a first semi-automatic attempt of mining a mapping of header files to
MAINTAINERS section.

Currently, the automated code analysis basically does the following steps:

1. Heuristically map header files to the related source files.

The heuristics basically uses ctags to obtain the prototypes within a
header file and then elixir to identify in which these prototypes are
defined. The header file is then mapped to the source file with the highest
number of definitions for prototypes referred to. More fine-tuning may
still be required here.

2. Deterministically map these source files to its MAINTAINERS section.

Simply, using get_maintainer.pl, we obtain all relevant MAINTAINERS sections
for each source file linked to a header file above.

3. Combine those two mappings to identify which header files should be best
added to which section in the existing MAINTAINERS file.

As of now, we simply take the one most relevant source file identified and
map it to a maintainer section. However, as the mapping from step 1 does not
map every header file to a source file, the overall suggestions for
additions is still pretty incomplete.

4. Manually review the suggestions and manually create the patch for some
example sections.

At this early stage, we look at some selective sections, review the
suggestions made by this tool for a section, filter out suggestions that
seem rather wrong and then manually create the patch to add files and
patterns from ./include/linux to the appropriate section.

Hence, the provided additions in this patch should be correct, but are not
necessarily complete wrt. all header files in ./include/linux/ that actually
belong to the TTY LAYER.

As all of this work is still pretty early and experimental, please provide
feedback on its correctness or simply pick such change for your tree if it is
all okay to take for now (although not yet complete).

Also, criticism on the approach and the way providing such patches for
MAINTAINERS is welcome, e.g.:

Your suggestions need to have this specific quality before reaching out to me
or other kernel maintainers with patches of such kind.

Or: Please do not take up the maintainers' review time for such clean-up and
just keep MAINTAINERS in the state as it is. (I would hope that this MAINTAINERS
clean-up is worth my time to attempt it, and given some good heuristics and own
manual review, worth the time to pick up by the individual maintainers.)

Or: Please first work on this other clean-up topic in MAINTAINERS and then
afterwards clean up this aspect here.


[1] https://lore.kernel.org/lkml/alpine.DEB.2.21.2003090702440.3325@felia/#r
[2] https://lwn.net/Articles/842415/
[3] https://lists.elisa.tech/g/devel/message/1269


Thanks and best regards,

Lukas


Lukas Bulwahn (1):
MAINTAINERS: TTY LAYER: add some ./include/linux/ header files

MAINTAINERS | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

--
2.17.1



2021-05-19 12:49:21

by Lukas Bulwahn

[permalink] [raw]
Subject: [RFC PATCH 1/1] MAINTAINERS: TTY LAYER: add some ./include/linux/ header files

An early prototypical automated code analysis of headers and the
existing MAINTAINERS sections identified some header files in
./include/linux/ to be probably included into the TTY LAYER section.

I further checked those suggestions by this analysis and identified a
subset of files that I am rather certain to belong to the TTY LAYER.

Add these ./include/linux/ header files to TTY LAYER in MAINTAINERS.

The patterns include/linux/tty*.h and include/linux/vt_*.h currently cover:

include/linux/tty.h
include/linux/tty_driver.h
include/linux/tty_flip.h
include/linux/tty_ldisc.h

include/linux/vt_buffer.h
include/linux/vt_kern.h

Signed-off-by: Lukas Bulwahn <[email protected]>
---
applies cleanly on next-20210507

MAINTAINERS | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 8923f0064784..d056f777c1a5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -18563,9 +18563,13 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
F: Documentation/driver-api/serial/
F: drivers/tty/
F: drivers/tty/serial/serial_core.c
+F: include/linux/selection.h
F: include/linux/serial.h
F: include/linux/serial_core.h
-F: include/linux/tty.h
+F: include/linux/sysrq.h
+F: include/linux/tty*.h
+F: include/linux/vt.h
+F: include/linux/vt_*.h
F: include/uapi/linux/serial.h
F: include/uapi/linux/serial_core.h
F: include/uapi/linux/tty.h
--
2.17.1


2021-05-19 13:31:40

by Jiri Slaby

[permalink] [raw]
Subject: Re: [RFC PATCH 1/1] MAINTAINERS: TTY LAYER: add some ./include/linux/ header files

On 18. 05. 21, 7:21, Lukas Bulwahn wrote:
> An early prototypical automated code analysis of headers and the
> existing MAINTAINERS sections identified some header files in
> ./include/linux/ to be probably included into the TTY LAYER section.
>
> I further checked those suggestions by this analysis and identified a
> subset of files that I am rather certain to belong to the TTY LAYER.
>
> Add these ./include/linux/ header files to TTY LAYER in MAINTAINERS.
>
> The patterns include/linux/tty*.h and include/linux/vt_*.h currently cover:
>
> include/linux/tty.h
> include/linux/tty_driver.h
> include/linux/tty_flip.h
> include/linux/tty_ldisc.h
>
> include/linux/vt_buffer.h
> include/linux/vt_kern.h

Yes, that looks good.

Can you extend the tool to include/uapi too?

For example this is missing too:
include/uapi/linux/tty*.h

It expands to:
include/uapi/linux/tty_flags.h
include/uapi/linux/tty.h

> Signed-off-by: Lukas Bulwahn <[email protected]>
> ---
> applies cleanly on next-20210507
>
> MAINTAINERS | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 8923f0064784..d056f777c1a5 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -18563,9 +18563,13 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
> F: Documentation/driver-api/serial/
> F: drivers/tty/
> F: drivers/tty/serial/serial_core.c
> +F: include/linux/selection.h
> F: include/linux/serial.h
> F: include/linux/serial_core.h
> -F: include/linux/tty.h
> +F: include/linux/sysrq.h
> +F: include/linux/tty*.h
> +F: include/linux/vt.h
> +F: include/linux/vt_*.h
> F: include/uapi/linux/serial.h
> F: include/uapi/linux/serial_core.h
> F: include/uapi/linux/tty.h
>

thanks,
--
js
suse labs

2021-05-23 07:07:51

by Lukas Bulwahn

[permalink] [raw]
Subject: Re: [RFC PATCH 1/1] MAINTAINERS: TTY LAYER: add some ./include/linux/ header files

On Tue, May 18, 2021 at 7:37 AM Jiri Slaby <[email protected]> wrote:
>
> On 18. 05. 21, 7:21, Lukas Bulwahn wrote:
> > An early prototypical automated code analysis of headers and the
> > existing MAINTAINERS sections identified some header files in
> > ./include/linux/ to be probably included into the TTY LAYER section.
> >
> > I further checked those suggestions by this analysis and identified a
> > subset of files that I am rather certain to belong to the TTY LAYER.
> >
> > Add these ./include/linux/ header files to TTY LAYER in MAINTAINERS.
> >
> > The patterns include/linux/tty*.h and include/linux/vt_*.h currently cover:
> >
> > include/linux/tty.h
> > include/linux/tty_driver.h
> > include/linux/tty_flip.h
> > include/linux/tty_ldisc.h
> >
> > include/linux/vt_buffer.h
> > include/linux/vt_kern.h
>
> Yes, that looks good.
>
> Can you extend the tool to include/uapi too?
>
> For example this is missing too:
> include/uapi/linux/tty*.h
>
> It expands to:
> include/uapi/linux/tty_flags.h
> include/uapi/linux/tty.h
>

Jiri,

Greg already picked this patch up; so I will keep this patch as-is and move on.

But I agree:
I am still tuning my script and that still needs a bit of work, so I
will still need some time until the next patches will follow.
Once I am happy with the script and I go back to manual checking,
review and adjustment of its output, I will follow your suggestion,
and prioritize to check that all additions for ./include/linux and
./include/uapi/linux are complete.
However, I will probably not come back to the TTY LAYER for a while
(until I can fully automate those patches with high confidence). The
patch for the next subsystem will probably be MEMORY MANAGEMENT or so,
depending if the manual checks and reviews show that the patches are
sufficiently good for that second try. I will come back to TTY LAYER,
once my method can assign all files in ./include sufficiently well to
its corresponding MAINTAINERS section; that will then be probably part
of a larger patch series for all MAINTAINERS sections and not just to
check the method for one or two sections.

Lukas

2021-05-23 08:19:34

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [RFC PATCH 1/1] MAINTAINERS: TTY LAYER: add some ./include/linux/ header files

On Sun, May 23, 2021 at 09:05:48AM +0200, Lukas Bulwahn wrote:
> On Tue, May 18, 2021 at 7:37 AM Jiri Slaby <[email protected]> wrote:
> >
> > On 18. 05. 21, 7:21, Lukas Bulwahn wrote:
> > > An early prototypical automated code analysis of headers and the
> > > existing MAINTAINERS sections identified some header files in
> > > ./include/linux/ to be probably included into the TTY LAYER section.
> > >
> > > I further checked those suggestions by this analysis and identified a
> > > subset of files that I am rather certain to belong to the TTY LAYER.
> > >
> > > Add these ./include/linux/ header files to TTY LAYER in MAINTAINERS.
> > >
> > > The patterns include/linux/tty*.h and include/linux/vt_*.h currently cover:
> > >
> > > include/linux/tty.h
> > > include/linux/tty_driver.h
> > > include/linux/tty_flip.h
> > > include/linux/tty_ldisc.h
> > >
> > > include/linux/vt_buffer.h
> > > include/linux/vt_kern.h
> >
> > Yes, that looks good.
> >
> > Can you extend the tool to include/uapi too?
> >
> > For example this is missing too:
> > include/uapi/linux/tty*.h
> >
> > It expands to:
> > include/uapi/linux/tty_flags.h
> > include/uapi/linux/tty.h
> >
>
> Jiri,
>
> Greg already picked this patch up; so I will keep this patch as-is and move on.

This patch was fine as-is, but sending an additional patch with that
information added would be most welcome. No need for your tool to
create it, you can do it by hand :)

thanks,

greg k-h