fs/f2fs/gc.c:29:12: warning: stack frame size of 2080 bytes in function 'gc_thread_func'

From: kernel test robot
Date: Sat Apr 17 2021 - 13:05:13 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 9cdbf6467424045617cd6e79dcaad06bb8efa31c
commit: cdf8a76fda4ae3b53c5a09e5a8c79e27b7b65d68 ubsan: move cc-option tests into Kconfig
date: 4 months ago
config: powerpc-randconfig-r011-20210417 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project f549176ad976caa3e19edd036df9a7e12770af7c)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cdf8a76fda4ae3b53c5a09e5a8c79e27b7b65d68
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout cdf8a76fda4ae3b53c5a09e5a8c79e27b7b65d68
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=powerpc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

arch/powerpc/include/asm/io-defs.h:45:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:601:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:55:1: note: expanded from here
__do_insw
^
arch/powerpc/include/asm/io.h:542:56: note: expanded from macro '__do_insw'
#define __do_insw(p, b, n) readsw((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from fs/f2fs/gc.c:10:
In file included from include/linux/backing-dev.h:15:
In file included from include/linux/blkdev.h:14:
In file included from include/linux/pagemap.h:11:
In file included from include/linux/highmem.h:10:
In file included from include/linux/hardirq.h:10:
In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:604:
arch/powerpc/include/asm/io-defs.h:47:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:601:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:57:1: note: expanded from here
__do_insl
^
arch/powerpc/include/asm/io.h:543:56: note: expanded from macro '__do_insl'
#define __do_insl(p, b, n) readsl((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from fs/f2fs/gc.c:10:
In file included from include/linux/backing-dev.h:15:
In file included from include/linux/blkdev.h:14:
In file included from include/linux/pagemap.h:11:
In file included from include/linux/highmem.h:10:
In file included from include/linux/hardirq.h:10:
In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:604:
arch/powerpc/include/asm/io-defs.h:49:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:601:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:59:1: note: expanded from here
__do_outsb
^
arch/powerpc/include/asm/io.h:544:58: note: expanded from macro '__do_outsb'
#define __do_outsb(p, b, n) writesb((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from fs/f2fs/gc.c:10:
In file included from include/linux/backing-dev.h:15:
In file included from include/linux/blkdev.h:14:
In file included from include/linux/pagemap.h:11:
In file included from include/linux/highmem.h:10:
In file included from include/linux/hardirq.h:10:
In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:604:
arch/powerpc/include/asm/io-defs.h:51:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:601:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:61:1: note: expanded from here
__do_outsw
^
arch/powerpc/include/asm/io.h:545:58: note: expanded from macro '__do_outsw'
#define __do_outsw(p, b, n) writesw((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from fs/f2fs/gc.c:10:
In file included from include/linux/backing-dev.h:15:
In file included from include/linux/blkdev.h:14:
In file included from include/linux/pagemap.h:11:
In file included from include/linux/highmem.h:10:
In file included from include/linux/hardirq.h:10:
In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:604:
arch/powerpc/include/asm/io-defs.h:53:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:601:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:63:1: note: expanded from here
__do_outsl
^
arch/powerpc/include/asm/io.h:546:58: note: expanded from macro '__do_outsl'
#define __do_outsl(p, b, n) writesl((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
>> fs/f2fs/gc.c:29:12: warning: stack frame size of 2080 bytes in function 'gc_thread_func' [-Wframe-larger-than=]
static int gc_thread_func(void *data)
^
fs/f2fs/gc.c:1358:12: warning: stack frame size of 2240 bytes in function 'gc_data_segment' [-Wframe-larger-than=]
static int gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
^
fs/f2fs/gc.c:622:12: warning: stack frame size of 3680 bytes in function 'get_victim_by_default' [-Wframe-larger-than=]
static int get_victim_by_default(struct f2fs_sb_info *sbi,
^
15 warnings generated.


vim +/gc_thread_func +29 fs/f2fs/gc.c

093749e296e29a Chao Yu 2020-08-04 25
da52f8ade40b03 Jack Qiu 2020-06-18 26 static unsigned int count_bits(const unsigned long *addr,
da52f8ade40b03 Jack Qiu 2020-06-18 27 unsigned int offset, unsigned int len);
da52f8ade40b03 Jack Qiu 2020-06-18 28
7bc0900347e069 Jaegeuk Kim 2012-11-02 @29 static int gc_thread_func(void *data)
7bc0900347e069 Jaegeuk Kim 2012-11-02 30 {
7bc0900347e069 Jaegeuk Kim 2012-11-02 31 struct f2fs_sb_info *sbi = data;
b59d0bae6ca30c Namjae Jeon 2013-08-04 32 struct f2fs_gc_kthread *gc_th = sbi->gc_thread;
7bc0900347e069 Jaegeuk Kim 2012-11-02 33 wait_queue_head_t *wq = &sbi->gc_thread->gc_wait_queue_head;
b8c502b81e3f89 Chao Yu 2017-08-07 34 unsigned int wait_ms;
7bc0900347e069 Jaegeuk Kim 2012-11-02 35
b59d0bae6ca30c Namjae Jeon 2013-08-04 36 wait_ms = gc_th->min_sleep_time;
7bc0900347e069 Jaegeuk Kim 2012-11-02 37
1d7be2708277ed Jaegeuk Kim 2017-05-17 38 set_freezable();
7bc0900347e069 Jaegeuk Kim 2012-11-02 39 do {
bbbc34fd666254 Chao Yu 2020-02-14 40 bool sync_mode;
bbbc34fd666254 Chao Yu 2020-02-14 41
7bc0900347e069 Jaegeuk Kim 2012-11-02 42 wait_event_interruptible_timeout(*wq,
d9872a698c393e Jaegeuk Kim 2017-08-06 43 kthread_should_stop() || freezing(current) ||
d9872a698c393e Jaegeuk Kim 2017-08-06 44 gc_th->gc_wake,
7bc0900347e069 Jaegeuk Kim 2012-11-02 45 msecs_to_jiffies(wait_ms));
1d7be2708277ed Jaegeuk Kim 2017-05-17 46
d9872a698c393e Jaegeuk Kim 2017-08-06 47 /* give it a try one time */
d9872a698c393e Jaegeuk Kim 2017-08-06 48 if (gc_th->gc_wake)
d9872a698c393e Jaegeuk Kim 2017-08-06 49 gc_th->gc_wake = 0;
d9872a698c393e Jaegeuk Kim 2017-08-06 50
274bd9ba394256 Chao Yu 2018-09-29 51 if (try_to_freeze()) {
274bd9ba394256 Chao Yu 2018-09-29 52 stat_other_skip_bggc_count(sbi);
1d7be2708277ed Jaegeuk Kim 2017-05-17 53 continue;
274bd9ba394256 Chao Yu 2018-09-29 54 }
7bc0900347e069 Jaegeuk Kim 2012-11-02 55 if (kthread_should_stop())
7bc0900347e069 Jaegeuk Kim 2012-11-02 56 break;
7bc0900347e069 Jaegeuk Kim 2012-11-02 57
d6212a5f18c8f9 Changman Lee 2013-01-29 58 if (sbi->sb->s_writers.frozen >= SB_FREEZE_WRITE) {
88dd8934194f6d Chao Yu 2015-01-26 59 increase_sleep_time(gc_th, &wait_ms);
274bd9ba394256 Chao Yu 2018-09-29 60 stat_other_skip_bggc_count(sbi);
d6212a5f18c8f9 Changman Lee 2013-01-29 61 continue;
d6212a5f18c8f9 Changman Lee 2013-01-29 62 }
d6212a5f18c8f9 Changman Lee 2013-01-29 63
55523519bc7227 Chao Yu 2017-02-25 64 if (time_to_inject(sbi, FAULT_CHECKPOINT)) {
c45d6002ff7a32 Chao Yu 2019-11-01 65 f2fs_show_injection_info(sbi, FAULT_CHECKPOINT);
0f34802858e74e Chao Yu 2016-09-26 66 f2fs_stop_checkpoint(sbi, false);
55523519bc7227 Chao Yu 2017-02-25 67 }
0f34802858e74e Chao Yu 2016-09-26 68
274bd9ba394256 Chao Yu 2018-09-29 69 if (!sb_start_write_trylock(sbi->sb)) {
274bd9ba394256 Chao Yu 2018-09-29 70 stat_other_skip_bggc_count(sbi);
dc6febb6bcec7f Chao Yu 2017-07-22 71 continue;
274bd9ba394256 Chao Yu 2018-09-29 72 }
dc6febb6bcec7f Chao Yu 2017-07-22 73
7bc0900347e069 Jaegeuk Kim 2012-11-02 74 /*
7bc0900347e069 Jaegeuk Kim 2012-11-02 75 * [GC triggering condition]
7bc0900347e069 Jaegeuk Kim 2012-11-02 76 * 0. GC is not conducted currently.
7bc0900347e069 Jaegeuk Kim 2012-11-02 77 * 1. There are enough dirty segments.
7bc0900347e069 Jaegeuk Kim 2012-11-02 78 * 2. IO subsystem is idle by checking the # of writeback pages.
7bc0900347e069 Jaegeuk Kim 2012-11-02 79 * 3. IO subsystem is idle by checking the # of requests in
7bc0900347e069 Jaegeuk Kim 2012-11-02 80 * bdev's request list.
7bc0900347e069 Jaegeuk Kim 2012-11-02 81 *
e1c42045203071 arter97 2014-08-06 82 * Note) We have to avoid triggering GCs frequently.
7bc0900347e069 Jaegeuk Kim 2012-11-02 83 * Because it is possible that some segments can be
7bc0900347e069 Jaegeuk Kim 2012-11-02 84 * invalidated soon after by user update or deletion.
7bc0900347e069 Jaegeuk Kim 2012-11-02 85 * So, I'd like to wait some time to collect dirty segments.
7bc0900347e069 Jaegeuk Kim 2012-11-02 86 */
0e5e81114de1c4 Daeho Jeong 2020-07-02 87 if (sbi->gc_mode == GC_URGENT_HIGH) {
d9872a698c393e Jaegeuk Kim 2017-08-06 88 wait_ms = gc_th->urgent_sleep_time;
fb24fea75ca5ce Chao Yu 2020-01-14 89 down_write(&sbi->gc_lock);
d9872a698c393e Jaegeuk Kim 2017-08-06 90 goto do_gc;
d9872a698c393e Jaegeuk Kim 2017-08-06 91 }
d9872a698c393e Jaegeuk Kim 2017-08-06 92
fb24fea75ca5ce Chao Yu 2020-01-14 93 if (!down_write_trylock(&sbi->gc_lock)) {
274bd9ba394256 Chao Yu 2018-09-29 94 stat_other_skip_bggc_count(sbi);
69babac019337b Jaegeuk Kim 2018-02-26 95 goto next;
274bd9ba394256 Chao Yu 2018-09-29 96 }
69babac019337b Jaegeuk Kim 2018-02-26 97
a7d10cf3e4e3e3 Sahitya Tummala 2018-09-19 98 if (!is_idle(sbi, GC_TIME)) {
88dd8934194f6d Chao Yu 2015-01-26 99 increase_sleep_time(gc_th, &wait_ms);
fb24fea75ca5ce Chao Yu 2020-01-14 100 up_write(&sbi->gc_lock);
274bd9ba394256 Chao Yu 2018-09-29 101 stat_io_skip_bggc_count(sbi);
dc6febb6bcec7f Chao Yu 2017-07-22 102 goto next;
7bc0900347e069 Jaegeuk Kim 2012-11-02 103 }
7bc0900347e069 Jaegeuk Kim 2012-11-02 104
7bc0900347e069 Jaegeuk Kim 2012-11-02 105 if (has_enough_invalid_blocks(sbi))
88dd8934194f6d Chao Yu 2015-01-26 106 decrease_sleep_time(gc_th, &wait_ms);
7bc0900347e069 Jaegeuk Kim 2012-11-02 107 else
88dd8934194f6d Chao Yu 2015-01-26 108 increase_sleep_time(gc_th, &wait_ms);
d9872a698c393e Jaegeuk Kim 2017-08-06 109 do_gc:
fc7100ea2a52fc Hridya Valsaraju 2020-01-22 110 stat_inc_bggc_count(sbi->stat_info);
7bc0900347e069 Jaegeuk Kim 2012-11-02 111
bbbc34fd666254 Chao Yu 2020-02-14 112 sync_mode = F2FS_OPTION(sbi).bggc_mode == BGGC_MODE_SYNC;
bbbc34fd666254 Chao Yu 2020-02-14 113
437275272f9e63 Jaegeuk Kim 2013-02-04 114 /* if return value is not zero, no victim was selected */
bbbc34fd666254 Chao Yu 2020-02-14 115 if (f2fs_gc(sbi, sync_mode, true, NULL_SEGNO))
b59d0bae6ca30c Namjae Jeon 2013-08-04 116 wait_ms = gc_th->no_gc_sleep_time;
81eb8d6e2869b1 Jaegeuk Kim 2013-10-24 117
84e4214f0868ae Jaegeuk Kim 2015-10-13 118 trace_f2fs_background_gc(sbi->sb, wait_ms,
84e4214f0868ae Jaegeuk Kim 2015-10-13 119 prefree_segments(sbi), free_segments(sbi));
84e4214f0868ae Jaegeuk Kim 2015-10-13 120
4660f9c0fe4843 Jaegeuk Kim 2013-10-24 121 /* balancing f2fs's metadata periodically */
7bcd0cfa735d72 Chao Yu 2020-03-19 122 f2fs_balance_fs_bg(sbi, true);
dc6febb6bcec7f Chao Yu 2017-07-22 123 next:
dc6febb6bcec7f Chao Yu 2017-07-22 124 sb_end_write(sbi->sb);
81eb8d6e2869b1 Jaegeuk Kim 2013-10-24 125
7bc0900347e069 Jaegeuk Kim 2012-11-02 126 } while (!kthread_should_stop());
7bc0900347e069 Jaegeuk Kim 2012-11-02 127 return 0;
7bc0900347e069 Jaegeuk Kim 2012-11-02 128 }
7bc0900347e069 Jaegeuk Kim 2012-11-02 129

:::::: The code at line 29 was first introduced by commit
:::::: 7bc0900347e069a1676d28ad6f98cafaf8cfd6e9 f2fs: add garbage collection functions

:::::: TO: Jaegeuk Kim <jaegeuk.kim@xxxxxxxxxxx>
:::::: CC: Jaegeuk Kim <jaegeuk.kim@xxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip