net: fix skb_ext BUILD_BUG_ON failures with GCOV
Status from this message: This series was applied to netdev/net-next.git (main)
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest2 patches 0 repliesApplied 2/2
- v22 patches 0 repliesSuperseded
- v12 patches 3 repliesSuperseded
Changes in v3 from the cover letter
- Patch 2/2: added __init since skb_extensions_init() is only called from __init skb_init() - without it noinline would keep the function in permanent .text, wasting memory after boot.
Patches in v3 All 2 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | net: fix skb_ext_total_length() BUILD_BUG_ON with CONFIG_GCOV_PROFILE_ALLnet/ | +1 | 0 replies | Applied |
| 2/2 | net: add noinline __init __no_profile to skb_extensions_init() for GCOV compatibilitynet/ | +1 | 0 replies | Applied |
Reviews trailers per patch
1 of 2 patches has a Reviewed-by or Acked-by.
| Patch | Thomas Weissschuh |
|---|---|
| 1/2 | R-b |
| 2/2 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v3 0/2] net: fix skb_ext BUILD_BUG_ON failures with GCOV
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):
https://lore.kernel.org/lkml/[email protected]/T/#t
That combined series was split per subsystem as requested by Jakub. The companion patches are:
- iommu: use __always_inline for amdv1pt_install_leaf_entry() (sent to iommu maintainers)
- gcov: add -fprofile-update=atomic globally (sent to gcov/kbuild maintainers, depends on this series and the iommu patch)
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 v2 -> v3:
- Patch 2/2: added __init since skb_extensions_init() is only called from __init skb_init() - without it noinline would keep the function in permanent .text, wasting memory after boot.
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.
v2: https://lore.kernel.org/lkml/[email protected]/T/#t
v1: https://lore.kernel.org/lkml/[email protected]/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 __init __no_profile to skb_extensions_init() for
GCOV compatibility
net/core/skbuff.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Signature · 1 line
2.43.5