Re: [PATCH v4 3/4] kernel hacking: new config CC_OPTIMIZE_FOR_DEBUGGING to apply GCC -Og optimization

From: kbuild test robot
Date: Thu May 10 2018 - 23:19:10 EST


Hi Changbin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.17-rc4 next-20180510]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/changbin-du-intel-com/kernel-hacking-GCC-optimization-for-better-debug-experience-Og/20180509-213955
config: x86_64-randconfig-s1-05100951 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

lib/test_firmware.c: In function 'trigger_batched_requests_async_store':
>> lib/test_firmware.c:779:31: warning: 'rc' may be used uninitialized in this function [-Wmaybe-uninitialized]
test_fw_config->test_result = rc;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
--
kernel/futex.c: In function 'futex_atomic_op_inuser':
>> kernel/futex.c:1604:17: warning: 'oldval' may be used uninitialized in this function [-Wmaybe-uninitialized]
return oldval > cmparg;
~~~~~~~^~~~~~~~
--
kernel/kexec_file.c: In function 'kexec_apply_relocations':
>> kernel/kexec_file.c:896:6: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (ret)
^
--
mm/swap_state.c: In function '__add_to_swap_cache':
>> mm/swap_state.c:156:9: warning: 'error' may be used uninitialized in this function [-Wmaybe-uninitialized]
return error;
^~~~~
--
mm/swapfile.c: In function 'setup_swap_map_and_extents':
>> mm/swapfile.c:3061:10: warning: 'nr_extents' may be used uninitialized in this function [-Wmaybe-uninitialized]
return nr_extents;
^~~~~~~~~~
--
mm/ksm.c: In function 'stable_node_dup':
>> mm/ksm.c:1365:15: warning: 'found_rmap_hlist_len' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (!found ||
~~~~~~~^~
dup->rmap_hlist_len > found_rmap_hlist_len) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
mm/huge_memory.c: In function 'do_huge_pmd_wp_page':
>> mm/huge_memory.c:1318:15: warning: 'huge_gfp' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (unlikely(mem_cgroup_try_charge(new_page, vma->vm_mm,
^~~~~~~~~~~~~~~~~~~~~
--
fs/splice.c: In function 'iter_file_splice_write':
>> fs/splice.c:694:10: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
ssize_t ret;
^~~
--
In file included from include/asm-generic/bug.h:5:0,
from arch/x86/include/asm/bug.h:83,
from include/linux/bug.h:5,
from include/linux/mmdebug.h:5,
from include/linux/gfp.h:5,
from include/linux/slab.h:15,
from ipc/sem.c:73:
ipc/sem.c: In function 'find_alloc_undo':
>> include/linux/compiler.h:215:31: warning: 'ulp' may be used uninitialized in this function [-Wmaybe-uninitialized]
case 8: *(volatile __u64 *)p = *(__u64 *)res; break;
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
ipc/sem.c:1843:24: note: 'ulp' was declared here
struct sem_undo_list *ulp;
^~~
--
block/blk-merge.c: In function '__blk_recalc_rq_segments':
>> block/blk-merge.c:284:21: warning: 'bbio' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (seg_size > bbio->bi_seg_back_size)
~~~~^~~~~~~~~~~~~~~~~~

vim +/ulp +215 include/linux/compiler.h

230fa253 Christian Borntraeger 2014-11-25 208
43239cbe Christian Borntraeger 2015-01-13 209 static __always_inline void __write_once_size(volatile void *p, void *res, int size)
230fa253 Christian Borntraeger 2014-11-25 210 {
230fa253 Christian Borntraeger 2014-11-25 211 switch (size) {
230fa253 Christian Borntraeger 2014-11-25 212 case 1: *(volatile __u8 *)p = *(__u8 *)res; break;
230fa253 Christian Borntraeger 2014-11-25 213 case 2: *(volatile __u16 *)p = *(__u16 *)res; break;
230fa253 Christian Borntraeger 2014-11-25 214 case 4: *(volatile __u32 *)p = *(__u32 *)res; break;
230fa253 Christian Borntraeger 2014-11-25 @215 case 8: *(volatile __u64 *)p = *(__u64 *)res; break;
230fa253 Christian Borntraeger 2014-11-25 216 default:
230fa253 Christian Borntraeger 2014-11-25 217 barrier();
230fa253 Christian Borntraeger 2014-11-25 218 __builtin_memcpy((void *)p, (const void *)res, size);
230fa253 Christian Borntraeger 2014-11-25 219 barrier();
230fa253 Christian Borntraeger 2014-11-25 220 }
230fa253 Christian Borntraeger 2014-11-25 221 }
230fa253 Christian Borntraeger 2014-11-25 222

:::::: The code at line 215 was first introduced by commit
:::::: 230fa253df6352af12ad0a16128760b5cb3f92df kernel: Provide READ_ONCE and ASSIGN_ONCE

:::::: TO: Christian Borntraeger <borntraeger@xxxxxxxxxx>
:::::: CC: Christian Borntraeger <borntraeger@xxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip