* + kcov-load-acquire-coverage-count-in-user-space-code.patch added to mm-nonmm-unstable branch
@ 2025-07-28 19:47 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2025-07-28 19:47 UTC (permalink / raw)
To: mm-commits, tglx, glider, elver, dvyukov, corbet, arnd,
andreyknvl, soham.bagchi, akpm
The patch titled
Subject: kcov: load acquire coverage count in user-space code
has been added to the -mm mm-nonmm-unstable branch. Its filename is
kcov-load-acquire-coverage-count-in-user-space-code.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/kcov-load-acquire-coverage-count-in-user-space-code.patch
This patch will later appear in the mm-nonmm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: Soham Bagchi <soham.bagchi@utah.edu>
Subject: kcov: load acquire coverage count in user-space code
Date: Mon, 28 Jul 2025 12:43:18 -0600
Updating 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()
Link: https://lkml.kernel.org/r/20250728184318.1839137-2-soham.bagchi@utah.edu
Signed-off-by: Soham Bagchi <soham.bagchi@utah.edu>
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: Macro Elver <elver@google.com>
Cc: Thomas Gleinxer <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
Documentation/dev-tools/kcov.rst | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
--- a/Documentation/dev-tools/kcov.rst~kcov-load-acquire-coverage-count-in-user-space-code
+++ a/Documentation/dev-tools/kcov.rst
@@ -287,6 +287,11 @@ handle instance id.
The following program demonstrates using KCOV to collect coverage from both
local tasks spawned by the process and the global task that handles USB bus #1:
+The user-space code for KCOV should also use an acquire to fetch the count
+of coverage entries in the shared buffer. This acquire pairs with the
+corresponding write memory barrier (smp_wmb()) on the kernel-side in
+kcov_move_area().
+
.. code-block:: c
/* Same includes and defines as above. */
@@ -361,7 +366,7 @@ local tasks spawned by the process and t
*/
sleep(2);
- n = __atomic_load_n(&cover[0], __ATOMIC_RELAXED);
+ n = __atomic_load_n(&cover[0], __ATOMIC_ACQUIRE);
for (i = 0; i < n; i++)
printf("0x%lx\n", cover[i + 1]);
if (ioctl(fd, KCOV_DISABLE, 0))
_
Patches currently in -mm which might be from soham.bagchi@utah.edu are
kcov-use-write-memory-barrier-after-memcpy-in-kcov_move_area.patch
kcov-load-acquire-coverage-count-in-user-space-code.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-07-28 19:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-28 19:47 + kcov-load-acquire-coverage-count-in-user-space-code.patch added to mm-nonmm-unstable branch Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.