Re: [PATCH 4/5] vfio: selftests: Add sysfs_kernel_warn_count_get()
From: Alex Williamson
Date: Tue Nov 10 2026 - 12:56:15 EST
On Thu, 29 Oct 2026 20:33:23 +0000
David Matlack <dmatlack@xxxxxxxxxx> wrote:
> Add a helper to read /sys/kernel/warn_count, which counts the number of
> warnings (e.g. WARN(), KASAN, and UBSAN reports) the kernel has
> encountered since boot. Return a negative value if the file does not
> exist, e.g. on kernels that predate it.
>
> Factor the code to read an integer from a sysfs file out of
> sysfs_val_get_int() so that it can be shared by both helpers.
>
> This will be used in a subsequent commit to detect kernel warnings
> triggered by tests.
>
> Signed-off-by: David Matlack <dmatlack@xxxxxxxxxx>
> ---
> .../vfio/lib/include/libvfio/sysfs.h | 7 +++++++
> tools/testing/selftests/vfio/lib/sysfs.c | 19 +++++++++++++++----
> 2 files changed, 22 insertions(+), 4 deletions(-)
I have a concern with this approach. I run selftests in parallel as
much as possible, using multiple devices, each targeted at specific
tests, with other functional and performance tests running
concurrently. When wiring this into my harness, I initially saw a
failure, but can't reproduce and have no log from the original event.
I've updated my local CI to keep a console log so that I might have a
chance of chasing the next instance, but I don't much like the fact
that any warning occurring concurrently with this test can trigger a
failure and the test doesn't provide anything to go on in the test logs
themselves. Thanks,
Alex