Skip to content

Commit 6166caf

Browse files
hcahcaVasily Gorbik
authored andcommitted
s390/bitops: Disable arch_test_bit() optimization for PROFILE_ALL_BRANCHES
With PROFILE_ALL_BRANCHES enabled gcc sometimes fails to handle __builtin_constant_p() correctly: In function 'arch_test_bit', inlined from 'node_state' at include/linux/nodemask.h:423:9, inlined from 'warn_if_node_offline' at include/linux/gfp.h:252:2, inlined from '__alloc_pages_node_noprof' at include/linux/gfp.h:267:2, inlined from 'alloc_pages_node_noprof' at include/linux/gfp.h:296:9, inlined from 'vm_area_alloc_pages.constprop' at mm/vmalloc.c:3591:11: >> arch/s390/include/asm/bitops.h:60:17: warning: 'asm' operand 2 probably does not match constraints 60 | asm volatile( | ^~~ >> arch/s390/include/asm/bitops.h:60:17: error: impossible constraint in 'asm' Therefore disable the optimization for this case. This is similar to commit 63678ee ("s390/preempt: disable __preempt_count_add() optimization for PROFILE_ALL_BRANCHES") Fixes: b2bc1b1 ("s390/bitops: Provide optimized arch_test_bit()") Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Acked-by: Vasily Gorbik <[email protected]> Signed-off-by: Heiko Carstens <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent 32ae4a2 commit 6166caf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

arch/s390/include/asm/bitops.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ static __always_inline bool arch_test_bit(unsigned long nr, const volatile unsig
5353
unsigned long mask;
5454
int cc;
5555

56-
if (__builtin_constant_p(nr)) {
56+
/*
57+
* With CONFIG_PROFILE_ALL_BRANCHES enabled gcc fails to
58+
* handle __builtin_constant_p() in some cases.
59+
*/
60+
if (!IS_ENABLED(CONFIG_PROFILE_ALL_BRANCHES) && __builtin_constant_p(nr)) {
5761
addr = (const volatile unsigned char *)ptr;
5862
addr += (nr ^ (BITS_PER_LONG - BITS_PER_BYTE)) / BITS_PER_BYTE;
5963
mask = 1UL << (nr & (BITS_PER_BYTE - 1));

0 commit comments

Comments
 (0)