-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Overview
This issue is well known within this project, and experimentation has shown that if we set CONFIG_LLVM_COV_KERNEL_MCDC_MAX_CONDITIONS = 47 the kernel exceeds its size limit. It is also worth nothing that Linus has made it clear on a number of occasions, including a few weeks ago [1] that build warnings are unacceptable.
Problem Statement
When the number of conditions in an expression exceeds the value set by CONFIG_LLVM_COV_KERNEL_MCDC_MAX_CONDITIONS, you get warnings like this:
arch/x86/mm/mem_encrypt_amd.c:253:10: warning: unsupported MC/DC boolean expression; number of conditions (47) exceeds max (44). Expression will not be covered
253 | return !cpu_feature_enabled(X86_FEATURE_SME_COHERENT);
| ^
./arch/x86/include/asm/cpufeature.h:143:3: note: expanded from macro 'cpu_feature_enabled'
143 | (__builtin_constant_p(bit) && DISABLED_MASK_BIT_SET(bit) ? 0 : static_cpu_has(bit))
| ^
arch/x86/mm/mem_encrypt_amd.c:253:10: warning: unsupported MC/DC boolean expression; number of conditions (47) exceeds max (44). Expression will not be covered
./arch/x86/include/asm/cpufeature.h:143:65: note: expanded from macro 'cpu_feature_enabled'
143 | (__builtin_constant_p(bit) && DISABLED_MASK_BIT_SET(bit) ? 0 : static_cpu_has(bit))
| ^
./arch/x86/include/asm/cpufeature.h:197:23: note: expanded from macro 'static_cpu_has'
197 | __builtin_constant_p(boot_cpu_has(bit)) ? \
| ^
./arch/x86/include/asm/cpufeature.h:145:27: note: expanded from macro 'boot_cpu_has'
145 | #define boot_cpu_has(bit) cpu_has(&boot_cpu_data, bit)
| ^
./arch/x86/include/asm/cpufeature.h:127:3: note: expanded from macro 'cpu_has'
127 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
| ^
arch/x86/mm/mem_encrypt_amd.c:253:10: warning: unsupported MC/DC boolean expression; number of conditions (47) exceeds max (44). Expression will not be covered
./arch/x86/include/asm/cpufeature.h:143:65: note: expanded from macro 'cpu_feature_enabled'
143 | (__builtin_constant_p(bit) && DISABLED_MASK_BIT_SET(bit) ? 0 : static_cpu_has(bit))
| ^
./arch/x86/include/asm/cpufeature.h:198:3: note: expanded from macro 'static_cpu_has'
198 | boot_cpu_has(bit) : \
| ^
./arch/x86/include/asm/cpufeature.h:145:27: note: expanded from macro 'boot_cpu_has'
145 | #define boot_cpu_has(bit) cpu_make -f ./scripts/Makefile.build obj=drivers/gpu/drm/bridge \
Options
- Potentially split up the large expressions so they do not trigger the warnings.
- Dig deeper into the size error, it might be something we can overcome when building the kernel with LLVM instrumentation.
- Simply disable coverage instrumentation (e.g.
-fno-profile-instr-generate -fno-coverage-mapping) for those areas pending better fixes. - Other ideas?
[1] https://lore.kernel.org/ksummit/CAHk-=wgOXd-meRuz5Gv2oz0W0wBUOpMO5CK9eifjfdR5Xz_-Fw@mail.gmail.com/
Metadata
Metadata
Assignees
Labels
No labels