Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kcov: load acquire coverage count in user-space code

Update the KCOV documentation to use a load-acquire operation for the
first element of the shared memory buffer between kernel-space and
user-space.

The load-acquire pairs with the write memory barrier used in
kcov_move_area().

[soham.bagchi@utah.edu: v2]
Link: https://lkml.kernel.org/r/20250803180558.2967962-1-soham.bagchi@utah.edu
Link: https://lkml.kernel.org/r/20250728184318.1839137-2-soham.bagchi@utah.edu
Signed-off-by: Soham Bagchi <soham.bagchi@utah.edu>
Reviewed-by: Marco Elver <elver@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Dmitriy Vyukov <dvyukov@google.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Thomas Gleinxer <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Soham Bagchi and committed by
Andrew Morton
1455b6ac c2fe368b

+6 -1
+6 -1
Documentation/dev-tools/kcov.rst
··· 361 361 */ 362 362 sleep(2); 363 363 364 - n = __atomic_load_n(&cover[0], __ATOMIC_RELAXED); 364 + /* 365 + * The load to the coverage count should be an acquire to pair with 366 + * pair with the corresponding write memory barrier (smp_wmb()) on 367 + * the kernel-side in kcov_move_area(). 368 + */ 369 + n = __atomic_load_n(&cover[0], __ATOMIC_ACQUIRE); 365 370 for (i = 0; i < n; i++) 366 371 printf("0x%lx\n", cover[i + 1]); 367 372 if (ioctl(fd, KCOV_DISABLE, 0))