Skip to content

Commit 686d773

Browse files
Tzung-Bi Shihtursulin
authored andcommitted
drm/i915/pmu: Fix build error with GCOV and AutoFDO enabled
i915_pmu.c may fail to build with GCOV and AutoFDO enabled. ../drivers/gpu/drm/i915/i915_pmu.c:116:3: error: call to '__compiletime_assert_487' declared with 'error' attribute: BUILD_BUG_ON failed: bit > BITS_PER_TYPE(typeof_member(struct i915_pmu, enable)) - 1 116 | BUILD_BUG_ON(bit > | ^ Here is a way to reproduce the issue: $ git checkout v6.15 $ mkdir build $ ./scripts/kconfig/merge_config.sh -O build -n -m <(cat <<EOF CONFIG_DRM=y CONFIG_PCI=y CONFIG_DRM_I915=y CONFIG_PERF_EVENTS=y CONFIG_DEBUG_FS=y CONFIG_GCOV_KERNEL=y CONFIG_GCOV_PROFILE_ALL=y CONFIG_AUTOFDO_CLANG=y EOF ) $ PATH=${PATH}:${HOME}/llvm-20.1.5-x86_64/bin make LLVM=1 O=build \ olddefconfig $ PATH=${PATH}:${HOME}/llvm-20.1.5-x86_64/bin make LLVM=1 O=build \ CLANG_AUTOFDO_PROFILE=...PATH_TO_SOME_AFDO_PROFILE... \ drivers/gpu/drm/i915/i915_pmu.o Although not super sure what happened, by reviewing the code, it should depend on `__builtin_constant_p(bit)` directly instead of assuming `__builtin_constant_p(config)` makes `bit` a builtin constant. Also fix a nit, to reuse the `bit` local variable. Fixes: a644fde ("drm/i915/pmu: Change bitmask of enabled events to u32") Reviewed-by: Nathan Chancellor <[email protected]> Signed-off-by: Tzung-Bi Shih <[email protected]> Signed-off-by: Tvrtko Ursulin <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent f36a75a commit 686d773

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/i915/i915_pmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static u32 config_mask(const u64 config)
112112
{
113113
unsigned int bit = config_bit(config);
114114

115-
if (__builtin_constant_p(config))
115+
if (__builtin_constant_p(bit))
116116
BUILD_BUG_ON(bit >
117117
BITS_PER_TYPE(typeof_member(struct i915_pmu,
118118
enable)) - 1);
@@ -121,7 +121,7 @@ static u32 config_mask(const u64 config)
121121
BITS_PER_TYPE(typeof_member(struct i915_pmu,
122122
enable)) - 1);
123123

124-
return BIT(config_bit(config));
124+
return BIT(bit);
125125
}
126126

127127
static bool is_engine_event(struct perf_event *event)

0 commit comments

Comments
 (0)