* [Devel] [PATCH hci-8.1 0/2] ms/kbuild: GCOV follow-ups to the prefer-atomic fix
@ 2026-10-19 18:26 Konstantin Khorenko
2026-10-19 18:26 ` [Devel] [PATCH hci-8.1 1/2] ms/kbuild: use $(CFLAGS_GCOV) in the prefer-atomic try-run test Konstantin Khorenko
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Konstantin Khorenko @ 2026-10-19 18:26 UTC (permalink / raw)
To: devel, Konstantin Khorenko
Two follow-ups to commit 6e1a837a05d4 ("ms/gcov: use atomic counter
updates to fix concurrent access crashes"). Peter Oberparleiter suggested
them while reviewing the upstream patch.
Both are taken from the akpm/mm tree, branch mm-nonmm-stable, and are not
in Linus's tree yet:
4719c9264131 kbuild: use $(CFLAGS_GCOV) in the prefer-atomic try-run test
f541906e89f9 kbuild: move GCOV flags to scripts/Makefile.gcov
- Patch 1 makes the try-run test compile with $(CFLAGS_GCOV) instead of a
copy of its flags, so the test also sees -fno-tree-loop-im. The outcome
of the test is unchanged.
- Patch 2 moves the CFLAGS_GCOV block into scripts/Makefile.gcov,
included via include-$(CONFIG_GCOV_KERNEL) like the KCOV and KASAN
makefiles. Builds without GCOV no longer run the try-run.
Patch 2 had a context conflict in Makefile: the CFLAGS_GCOV block has
different neighbours in this tree. The resolution is noted in the commit.
Upstream series:
https://lore.kernel.org/lkml/20261001-b4-prep-gcov-v1-0-794792e06f24@virtuozzo.com/
https://virtuozzo.atlassian.net/browse/VSTOR-148131
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
Konstantin Khorenko (2):
ms/kbuild: use $(CFLAGS_GCOV) in the prefer-atomic try-run test
ms/kbuild: move GCOV flags to scripts/Makefile.gcov
MAINTAINERS | 1 +
Makefile | 22 +---------------------
scripts/Makefile.gcov | 21 +++++++++++++++++++++
3 files changed, 23 insertions(+), 21 deletions(-)
---
base-commit: 8026fb5599f945a36a6911f8febad3ab569176da
change-id: 20261019-b4-prep-khorenko-vstor-148131-gcov-followups-697f640b297e
Best regards,
--
Konstantin Khorenko <khorenko@virtuozzo.com>
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 6+ messages in thread* [Devel] [PATCH hci-8.1 1/2] ms/kbuild: use $(CFLAGS_GCOV) in the prefer-atomic try-run test
2026-10-19 18:26 [Devel] [PATCH hci-8.1 0/2] ms/kbuild: GCOV follow-ups to the prefer-atomic fix Konstantin Khorenko
@ 2026-10-19 18:26 ` Konstantin Khorenko
2026-10-19 18:29 ` no-reply
2026-10-19 18:26 ` [Devel] [PATCH hci-8.1 2/2] ms/kbuild: move GCOV flags to scripts/Makefile.gcov Konstantin Khorenko
2026-10-19 19:54 ` [Devel] [PATCH hci-8.1 0/2] ms/kbuild: GCOV follow-ups to the prefer-atomic fix Konstantin Khorenko
2 siblings, 1 reply; 6+ messages in thread
From: Konstantin Khorenko @ 2026-10-19 18:26 UTC (permalink / raw)
To: devel, Konstantin Khorenko
Patch series "kbuild: GCOV cleanups following the prefer-atomic fix".
Two cleanups Peter Oberparleiter suggested while reviewing commit
56cb9b7d96b2 ("gcov: use atomic counter updates to fix concurrent access
crashes"):
https://lore.kernel.org/e1b6e768-51af-468b-a729-0ed3fceef2f1@linux.ibm.com
Patch 1 makes the prefer-atomic try-run test reuse $(CFLAGS_GCOV) instead
of spelling the flags out again, so the test compiles with the exact GCOV
flags, -fno-tree-loop-im included.
Patch 2 moves the CFLAGS_GCOV block into scripts/Makefile.gcov, included
via include-$(CONFIG_GCOV_KERNEL) like the other instrumentation
makefiles. The try-run also stops running on builds without GCOV.
This patch (of 2):
Reference $(CFLAGS_GCOV) in the try-run test introduced by
commit 56cb9b7d96b2 ("gcov: use atomic counter updates to fix
concurrent access crashes"), otherwise it can miss potential future
changes in the list of flags used for GCOV profiling like it misses
-fno-tree-loop-im at the moment.
The outcome of the test is unchanged: -fno-tree-loop-im does not affect
the undefined symbols the test compares.
Link: https://lore.kernel.org/20261001-b4-prep-gcov-v1-0-794792e06f24@virtuozzo.com
Link: https://lore.kernel.org/20261001-b4-prep-gcov-v1-1-794792e06f24@virtuozzo.com
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Suggested-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nicolas Schier <nsc@kernel.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Mikhail Zaslonko <zaslonko@linux.ibm.com>
(cherry picked from commit 4719c9264131b88fef209dc3342c23d3ac5356bd)
Picked from the akpm/mm tree, branch mm-nonmm-stable: not in Linus's
tree yet.
https://virtuozzo.atlassian.net/browse/VSTOR-148131
Feature: fix ms/gcov
Assisted-by: LLM
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
Makefile | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 288224078377f..3524889b5bb5f 100644
--- a/Makefile
+++ b/Makefile
@@ -1041,11 +1041,11 @@ CFLAGS_GCOV += -fno-tree-loop-im
# undefined symbols (e.g. libatomic calls that the kernel cannot link).
CFLAGS_GCOV += $(call try-run,\
echo 'long long x; void f(void){x++;}' | \
- $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -w -fprofile-arcs \
- -ftest-coverage -x c - -c -o "$$TMP.base" && \
+ $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -w $(CFLAGS_GCOV) \
+ -x c - -c -o "$$TMP.base" && \
echo 'long long x; void f(void){x++;}' | \
- $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -w -fprofile-arcs \
- -ftest-coverage -fprofile-update=prefer-atomic \
+ $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -w $(CFLAGS_GCOV) \
+ -fprofile-update=prefer-atomic \
-x c - -c -o "$$TMP" && \
$(NM) "$$TMP.base" | grep ' U ' > "$$TMP.ubase" || true ; \
$(NM) "$$TMP" | grep ' U ' > "$$TMP.utest" || true ; \
--
2.43.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 6+ messages in thread* [Devel] [PATCH hci-8.1 2/2] ms/kbuild: move GCOV flags to scripts/Makefile.gcov
2026-10-19 18:26 [Devel] [PATCH hci-8.1 0/2] ms/kbuild: GCOV follow-ups to the prefer-atomic fix Konstantin Khorenko
2026-10-19 18:26 ` [Devel] [PATCH hci-8.1 1/2] ms/kbuild: use $(CFLAGS_GCOV) in the prefer-atomic try-run test Konstantin Khorenko
@ 2026-10-19 18:26 ` Konstantin Khorenko
2026-10-19 18:30 ` no-reply
2026-10-19 19:54 ` [Devel] [PATCH hci-8.1 0/2] ms/kbuild: GCOV follow-ups to the prefer-atomic fix Konstantin Khorenko
2 siblings, 1 reply; 6+ messages in thread
From: Konstantin Khorenko @ 2026-10-19 18:26 UTC (permalink / raw)
To: devel, Konstantin Khorenko
* split the CFLAGS_GCOV block out of the top-level Makefile into
scripts/Makefile.gcov
* include it via include-$(CONFIG_GCOV_KERNEL) like neighbour
KASAN/KCOV/UBSAN makefiles do
* keep the include before scripts/Makefile.gcc-plugins: the try-run
must not get -fplugin= options, plugins do not exist on clean builds
CFLAGS_GCOV is no longer defined when CONFIG_GCOV_KERNEL is off:
* its user in scripts/Makefile.lib is guarded by the CONFIG_GCOV_KERNEL
* in i915/xe header an empty value is harmless
The try-run compiler invocations also stop running on builds without
GCOV.
Link: https://lore.kernel.org/20261001-b4-prep-gcov-v1-2-794792e06f24@virtuozzo.com
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Suggested-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nicolas Schier <nsc@kernel.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Mikhail Zaslonko <zaslonko@linux.ibm.com>
(cherry picked from commit f541906e89f9d08ef29f058b6cef1db071cd8163)
Picked from the akpm/mm tree, branch mm-nonmm-stable: not in Linus's
tree yet.
Conflict in Makefile: the CFLAGS_GCOV block sits next to different
lines in this tree. Removed the block and kept the local context.
https://virtuozzo.atlassian.net/browse/VSTOR-148131
Feature: fix ms/gcov
Assisted-by: LLM
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
MAINTAINERS | 1 +
Makefile | 22 +---------------------
scripts/Makefile.gcov | 21 +++++++++++++++++++++
3 files changed, 23 insertions(+), 21 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 9523da3c767cb..f0f955907fd7d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9535,6 +9535,7 @@ M: Peter Oberparleiter <oberpar@linux.ibm.com>
S: Maintained
F: Documentation/dev-tools/gcov.rst
F: kernel/gcov/
+F: scripts/Makefile.gcov
GDB KERNEL DEBUGGING HELPER SCRIPTS
M: Jan Kiszka <jan.kiszka@siemens.com>
diff --git a/Makefile b/Makefile
index 3524889b5bb5f..7c8f8e9b9be99 100644
--- a/Makefile
+++ b/Makefile
@@ -1033,27 +1033,6 @@ ifdef CONFIG_CC_IS_GCC
KBUILD_CFLAGS += -fconserve-stack
endif
-CFLAGS_GCOV := -fprofile-arcs -ftest-coverage
-ifdef CONFIG_CC_IS_GCC
-CFLAGS_GCOV += -fno-tree-loop-im
-# Use atomic counter updates to avoid concurrent-access crashes in GCOV.
-# Only enable if -fprofile-update=prefer-atomic does not introduce new
-# undefined symbols (e.g. libatomic calls that the kernel cannot link).
-CFLAGS_GCOV += $(call try-run,\
- echo 'long long x; void f(void){x++;}' | \
- $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -w $(CFLAGS_GCOV) \
- -x c - -c -o "$$TMP.base" && \
- echo 'long long x; void f(void){x++;}' | \
- $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -w $(CFLAGS_GCOV) \
- -fprofile-update=prefer-atomic \
- -x c - -c -o "$$TMP" && \
- $(NM) "$$TMP.base" | grep ' U ' > "$$TMP.ubase" || true ; \
- $(NM) "$$TMP" | grep ' U ' > "$$TMP.utest" || true ; \
- cmp -s "$$TMP.ubase" "$$TMP.utest",\
- -fprofile-update=prefer-atomic)
-endif
-export CFLAGS_GCOV
-
# change __FILE__ to the relative path from the srctree
KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
@@ -1066,6 +1045,7 @@ include-$(CONFIG_KCSAN) += scripts/Makefile.kcsan
include-$(CONFIG_KMSAN) += scripts/Makefile.kmsan
include-$(CONFIG_UBSAN) += scripts/Makefile.ubsan
include-$(CONFIG_KCOV) += scripts/Makefile.kcov
+include-$(CONFIG_GCOV_KERNEL) += scripts/Makefile.gcov
include-$(CONFIG_RANDSTRUCT) += scripts/Makefile.randstruct
include-$(CONFIG_AUTOFDO_CLANG) += scripts/Makefile.autofdo
include-$(CONFIG_PROPELLER_CLANG) += scripts/Makefile.propeller
diff --git a/scripts/Makefile.gcov b/scripts/Makefile.gcov
new file mode 100644
index 0000000000000..16c5b876440c2
--- /dev/null
+++ b/scripts/Makefile.gcov
@@ -0,0 +1,21 @@
+# SPDX-License-Identifier: GPL-2.0-only
+CFLAGS_GCOV := -fprofile-arcs -ftest-coverage
+ifdef CONFIG_CC_IS_GCC
+CFLAGS_GCOV += -fno-tree-loop-im
+# Use atomic counter updates to avoid concurrent-access crashes in GCOV.
+# Only enable if -fprofile-update=prefer-atomic does not introduce new
+# undefined symbols (e.g. libatomic calls that the kernel cannot link).
+CFLAGS_GCOV += $(call try-run,\
+ echo 'long long x; void f(void){x++;}' | \
+ $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -w $(CFLAGS_GCOV) \
+ -x c - -c -o "$$TMP.base" && \
+ echo 'long long x; void f(void){x++;}' | \
+ $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -w $(CFLAGS_GCOV) \
+ -fprofile-update=prefer-atomic \
+ -x c - -c -o "$$TMP" && \
+ $(NM) "$$TMP.base" | grep ' U ' > "$$TMP.ubase" || true ; \
+ $(NM) "$$TMP" | grep ' U ' > "$$TMP.utest" || true ; \
+ cmp -s "$$TMP.ubase" "$$TMP.utest",\
+ -fprofile-update=prefer-atomic)
+endif
+export CFLAGS_GCOV
--
2.43.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [Devel] [PATCH hci-8.1 0/2] ms/kbuild: GCOV follow-ups to the prefer-atomic fix
2026-10-19 18:26 [Devel] [PATCH hci-8.1 0/2] ms/kbuild: GCOV follow-ups to the prefer-atomic fix Konstantin Khorenko
2026-10-19 18:26 ` [Devel] [PATCH hci-8.1 1/2] ms/kbuild: use $(CFLAGS_GCOV) in the prefer-atomic try-run test Konstantin Khorenko
2026-10-19 18:26 ` [Devel] [PATCH hci-8.1 2/2] ms/kbuild: move GCOV flags to scripts/Makefile.gcov Konstantin Khorenko
@ 2026-10-19 19:54 ` Konstantin Khorenko
2 siblings, 0 replies; 6+ messages in thread
From: Konstantin Khorenko @ 2026-10-19 19:54 UTC (permalink / raw)
To: devel, Konstantin Khorenko
On Mon, 19 Oct 2026 20:26:49 +0200, Konstantin Khorenko wrote:
> ms/kbuild: GCOV follow-ups to the prefer-atomic fix
>
> Two follow-ups to commit 6e1a837a05d4 ("ms/gcov: use atomic counter
> updates to fix concurrent access crashes"). Peter Oberparleiter suggested
> them while reviewing the upstream patch.
>
> Both are taken from the akpm/mm tree, branch mm-nonmm-stable, and are not
> in Linus's tree yet:
>
> [...]
Applied to branch-rh10-6.12.0-211.52.1.22.x.vz10-ovz, will be released in rh10-6.12.0-211.52.1.22.9.vz10, thanks!
[1/2] ms/kbuild: use $(CFLAGS_GCOV) in the prefer-atomic try-run test
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/bcaa25137dc6
[2/2] ms/kbuild: move GCOV flags to scripts/Makefile.gcov
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/8f2170c160be
--
Konstantin Khorenko <khorenko@virtuozzo.com>
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-10-19 19:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-19 18:26 [Devel] [PATCH hci-8.1 0/2] ms/kbuild: GCOV follow-ups to the prefer-atomic fix Konstantin Khorenko
2026-10-19 18:26 ` [Devel] [PATCH hci-8.1 1/2] ms/kbuild: use $(CFLAGS_GCOV) in the prefer-atomic try-run test Konstantin Khorenko
2026-10-19 18:29 ` no-reply
2026-10-19 18:26 ` [Devel] [PATCH hci-8.1 2/2] ms/kbuild: move GCOV flags to scripts/Makefile.gcov Konstantin Khorenko
2026-10-19 18:30 ` no-reply
2026-10-19 19:54 ` [Devel] [PATCH hci-8.1 0/2] ms/kbuild: GCOV follow-ups to the prefer-atomic fix Konstantin Khorenko
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.