From: Konstantin Khorenko <khorenko@virtuozzo.com>
To: "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: "Simon Horman" <horms@kernel.org>,
"Thomas Weißschuh" <linux@weissschuh.net>,
"Arnd Bergmann" <arnd@arndb.de>,
"Peter Oberparleiter" <oberpar@linux.ibm.com>,
"Mikhail Zaslonko" <zaslonko@linux.ibm.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
"Pavel Tikhomirov" <ptikhomirov@virtuozzo.com>,
"Vasileios Almpanis" <vasileios.almpanis@virtuozzo.com>,
"Konstantin Khorenko" <khorenko@virtuozzo.com>
Subject: [PATCH v2 0/2] net: fix skb_ext BUILD_BUG_ON failures with GCOV
Date: Fri, 10 Apr 2026 00:47:34 +0300 [thread overview]
Message-ID: <20260409214736.2651198-1-khorenko@virtuozzo.com> (raw)
In-Reply-To: <20260402140558.1437002-1-khorenko@virtuozzo.com>
This mini-series fixes build failures in net/core/skbuff.c when the
kernel is built with CONFIG_GCOV_PROFILE_ALL=y.
This is part of a larger effort to add -fprofile-update=atomic to
global CFLAGS_GCOV (posted earlier as a combined series) [1].
The companion patch:
- gcov: add -fprofile-update=atomic globally (sent to gcov/kbuild
maintainers, depends on this series) [2]
There was another companion patch here, but i appeared to be already
applied recently: 8b72aa5704c7 ("iommupt/amdv1: mark
amdv1pt_install_leaf_entry as __always_inline").
Patch 1/2 fixes a pre-existing build failure with CONFIG_GCOV_PROFILE_ALL:
GCOV counters prevent GCC from constant-folding the skb_ext_total_length()
loop. It also removes the CONFIG_KCOV_INSTRUMENT_ALL preprocessor guard
from d6e5794b06c0: that guard was a precaution in case KCOV instrumentation
also prevented constant folding, but KCOV's -fsanitize-coverage=trace-pc
does not interfere with GCC's constant folding (verified experimentally
with GCC 14.2 and GCC 16.0.1), so the guard is unnecessary.
Patch 2/2 is an additional fix needed when -fprofile-update=atomic is
added to CFLAGS_GCOV: __no_profile on the __always_inline function alone
is insufficient because after inlining, the code resides in the caller's
profiled body. The caller (skb_extensions_init) needs __no_profile and
noinline to prevent re-exposure to GCOV instrumentation.
Changes v1 -> v2:
- Patch 1/2: expanded the commit message to explain why removing the
CONFIG_KCOV_INSTRUMENT_ALL guard is safe (KCOV's
-fsanitize-coverage=trace-pc does not inhibit constant folding,
unlike GCOV's -fprofile-arcs + -fno-tree-loop-im).
Changed Fixes tag to point at the commit that introduced the 5th
SKB extension type which triggered the failure.
Removed empty lines in tags area.
- Patch 2/2: added noinline to skb_extensions_init() to prevent
the compiler from inlining it into skb_init(), which would
re-expose the function body to GCOV instrumentation.
v1: https://lore.kernel.org/lkml/20260402140558.1437002-1-khorenko@virtuozzo.com/T/#t
[1] https://lore.kernel.org/lkml/20260401142020.1434243-1-khorenko@virtuozzo.com/T/#t
[2] https://lore.kernel.org/lkml/20260402141831.1437357-1-khorenko@virtuozzo.com/T/#t
Tested with:
- GCC 14.2.1, CONFIG_GCOV_PROFILE_ALL=y
- GCC 14.2.1, CONFIG_KCOV_INSTRUMENT_ALL=y (GCOV disabled)
- GCC 16.0.1 20260327 (experimental), CONFIG_GCOV_PROFILE_ALL=y
Konstantin Khorenko (2):
net: fix skb_ext_total_length() BUILD_BUG_ON with
CONFIG_GCOV_PROFILE_ALL
net: add noinline __no_profile to skb_extensions_init() for GCOV
compatibility
net/core/skbuff.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
--
2.43.5
next prev parent reply other threads:[~2026-04-09 21:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 14:05 [PATCH 0/2] net: fix skb_ext BUILD_BUG_ON failures with GCOV Konstantin Khorenko
2026-04-02 14:05 ` [PATCH 1/2] net: fix skb_ext_total_length() BUILD_BUG_ON with CONFIG_GCOV_PROFILE_ALL Konstantin Khorenko
2026-04-02 14:09 ` Vasileios Almpanis
2026-04-07 7:55 ` Paolo Abeni
2026-04-09 21:43 ` Konstantin Khorenko
2026-04-02 14:05 ` [PATCH 2/2] net: add __no_profile to skb_extensions_init() for GCOV compatibility Konstantin Khorenko
2026-04-09 21:47 ` Konstantin Khorenko [this message]
2026-04-09 21:47 ` [PATCH v2 1/2] net: fix skb_ext_total_length() BUILD_BUG_ON with CONFIG_GCOV_PROFILE_ALL Konstantin Khorenko
2026-04-09 21:47 ` [PATCH v2 2/2] net: add noinline __no_profile to skb_extensions_init() for GCOV compatibility Konstantin Khorenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260409214736.2651198-1-khorenko@virtuozzo.com \
--to=khorenko@virtuozzo.com \
--cc=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=netdev@vger.kernel.org \
--cc=oberpar@linux.ibm.com \
--cc=pabeni@redhat.com \
--cc=ptikhomirov@virtuozzo.com \
--cc=vasileios.almpanis@virtuozzo.com \
--cc=zaslonko@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox