RFC: KCSAN single report "feature"

From: Breno Leitao

Date: Tue Jul 07 2026 - 10:34:59 EST


Hello Marco and KCSAN community

KCSAN rate-limits reports so that a given data race is printed at most once
per CONFIG_KCSAN_REPORT_ONCE_IN_MS (3s by default): duplicates within that
window are dropped, but once it elapses the race is printed again in full.

On a long-running machine a persistent race therefore reprints the same
multi-line report every few seconds for as long as the racy code runs, flooding
dmesg/netconsole with identical reports and drowning out genuinely new ones.

Raising REPORT_ONCE_IN_MS only widens the window — the full report still
eventually recurs — and setting it to 0 disables rate limiting entirely, so
there is no way today to get a race reported just once.

I have some debug kernel running in my of Meta fleet, with these debug features
and I would like to enable KCSAN, but, this behaviour is flooding our data
pipeline.

I've recently solved something similar on kmemleak and I am wondering if there
is interested in solving something similar on KCSAN.

77d100d11c87e mm/kmemleak: dedupe verbose scan output by allocation backtrace

Would it be OK to have a "report once" mode that prints each race once and never
re-reports it, maybe exposed as a bool CONFIG_KCSAN_REPORT_ONCE or a
kcsan.report_once module parameter ?

Thanks,
--breno