linux/Documentation/dev-tools
Andrey Konovalov 5ff3b30ab5 kcov: collect coverage from interrupts
This change extends kcov remote coverage support to allow collecting
coverage from soft interrupts in addition to kernel background threads.

To collect coverage from code that is executed in softirq context, a part
of that code has to be annotated with kcov_remote_start/stop() in a
similar way as how it is done for global kernel background threads.  Then
the handle used for the annotations has to be passed to the
KCOV_REMOTE_ENABLE ioctl.

Internally this patch adjusts the __sanitizer_cov_trace_pc() compiler
inserted callback to not bail out when called from softirq context.
kcov_remote_start/stop() are updated to save/restore the current per task
kcov state in a per-cpu area (in case the softirq came when the kernel was
already collecting coverage in task context).  Coverage from softirqs is
collected into pre-allocated per-cpu areas, whose size is controlled by
the new CONFIG_KCOV_IRQ_AREA_SIZE.

[andreyknvl@google.com: turn current->kcov_softirq into unsigned int to fix objtool warning]
  Link: http://lkml.kernel.org/r/841c778aa3849c5cb8c3761f56b87ce653a88671.1585233617.git.andreyknvl@google.com
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Marco Elver <elver@google.com>
Link: http://lkml.kernel.org/r/469bd385c431d050bc38a593296eff4baae50666.1584655448.git.andreyknvl@google.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-06-04 19:06:20 -07:00
..
kunit kunit: update documentation to describe debugfs representation 2020-03-26 14:09:16 -06:00
coccinelle.rst doc:process: add links where missing 2018-12-06 10:21:19 -07:00
gcov.rst docs: dev-tools: gcov: Remove a stray single-quote 2020-03-02 12:51:02 -07:00
gdb-kernel-debugging.rst docs: disable KASLR when debugging kernel 2017-07-17 14:49:01 -06:00
index.rst Documentation: kunit: add documentation for KUnit 2019-09-30 17:35:01 -06:00
kasan.rst kasan: Add riscv to KASAN documentation. 2020-01-22 13:10:00 -08:00
kcov.rst kcov: collect coverage from interrupts 2020-06-04 19:06:20 -07:00
kgdb.rst Documentation: kgdboc: Document new kgdboc_earlycon parameter 2020-06-02 15:15:45 +01:00
kmemleak.rst docs: dev-tools: kmemleak: Update list of architectures 2020-03-10 11:32:12 -06:00
kselftest.rst kselftest: add fixture variants 2020-04-28 13:30:44 -07:00
sparse.rst Remove references to dead website. 2019-07-19 12:22:04 -07:00
ubsan.rst docs: sphinxify ubsan.txt and move it to dev-tools 2016-08-18 17:41:51 -06:00