Re: [PATCH v2 03/20] coverage: add a common debugfs interface

From: Peter Oberparleiter

Date: Thu Nov 05 2026 - 12:53:31 EST


On 03.11.2026 02:52, Sasha Levin wrote:
> Each coverage implementation creates its own top-level debugfs entry
> with its own conventions: /sys/kernel/debug/gcov/ and
> /sys/kernel/debug/kcov. Give them a common root,
> /sys/kernel/debug/coverage/, which contains:
>
> backend name of the selected code coverage measurement implementation
> reset write to reset all coverage data of that implementation
> gcov symlink to ../gcov when gcov is enabled
> kcov symlink to ../kcov when KCOV is enabled
>
> backend and reset are only present when a code coverage measurement
> implementation is selected, so a kernel with only KCOV just has the kcov
> symlink. The data formats are defined by the respective toolchains and
> stay implementation specific. The existing paths are kept as they are,
> since lcov, distribution tooling and syzkaller rely on them; the gcov
> reset file now shares its implementation with the common one.
>
> The common reset never touches KCOV, whose coverage buffers are owned
> by the tasks that set them up.

This part is slightly inconsistent - there is a common reset attribute,
but it doesn't apply to all coverage mechanisms. Also for gcov, there
are two reset attributes that perform the same function.

Would it make sense to only keep the attribute in the backend directory
and possibly mandate a common name via convention?

[...]


> +void __init coverage_register_backend(const struct coverage_backend *backend)
> +{
> + if (WARN_ON(coverage_backend))
> + return;

Can this happen at all?


--
Peter Oberparleiter
Linux on IBM Z Development - IBM Germany R&D