[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250803180558.2967962-1-soham.bagchi@utah.edu>
Date: Sun, 3 Aug 2025 12:05:58 -0600
From: Soham Bagchi <soham.bagchi@...h.edu>
To: elver@...gle.com
Cc: akpm@...ux-foundation.org,
andreyknvl@...il.com,
arnd@...db.de,
corbet@....net,
dvyukov@...gle.com,
glider@...gle.com,
kasan-dev@...glegroups.com,
linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org,
soham.bagchi@...h.edu,
sohambagchi@...look.com,
tglx@...utronix.de,
workflows@...r.kernel.org
Subject: [PATCH v2] kcov: load acquire coverage count in user-space code
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()
Signed-off-by: Soham Bagchi <soham.bagchi@...h.edu>
---
Changes in v2:
- note for load-acquire shifted to block comment
in code rather than in the preceding paragraphs
---
Documentation/dev-tools/kcov.rst | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Documentation/dev-tools/kcov.rst b/Documentation/dev-tools/kcov.rst
index 6611434e2dd..40a4b500073 100644
--- a/Documentation/dev-tools/kcov.rst
+++ b/Documentation/dev-tools/kcov.rst
@@ -361,7 +361,12 @@ local tasks spawned by the process and the global task that handles USB bus #1:
*/
sleep(2);
- n = __atomic_load_n(&cover[0], __ATOMIC_RELAXED);
+ /*
+ * The load to the coverage count should be an acquire to pair with
+ * pair with the corresponding write memory barrier (smp_wmb()) on
+ * the kernel-side in kcov_move_area().
+ */
+ 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))
--
2.34.1
Powered by blists - more mailing lists