]> git.baikalelectronics.ru Git - kernel.git/commit
kcsan: Rate-limit reporting per data races
authorMarco Elver <elver@google.com>
Fri, 10 Jan 2020 18:48:34 +0000 (19:48 +0100)
committerIngo Molnar <mingo@kernel.org>
Sat, 21 Mar 2020 08:40:52 +0000 (09:40 +0100)
commite5f934b7ddde222b2a3ecfb06c38f66aee6cfbe6
treefb65a68f2d4d27a7dbfaca1c53e36e89e962381d
parentfab7fb93fe7b912c98a226e072105eaf59154f3d
kcsan: Rate-limit reporting per data races

KCSAN data-race reports can occur quite frequently, so much so as
to render the system useless.  This commit therefore adds support for
time-based rate-limiting KCSAN reports, with the time interval specified
by a new KCSAN_REPORT_ONCE_IN_MS Kconfig option.  The default is 3000
milliseconds, also known as three seconds.

Because KCSAN must detect data races in allocators and in other contexts
where use of allocation is ill-advised, a fixed-size array is used to
buffer reports during each reporting interval.  To reduce the number of
reports lost due to array overflow, this commit stores only one instance
of duplicate reports, which has the benefit of further reducing KCSAN's
console output rate.

Reported-by: Qian Cai <cai@lca.pw>
Suggested-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/kcsan/report.c
lib/Kconfig.kcsan