lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Sat, 24 Dec 2022 18:43:22 +0800
From:   kernel test robot <lkp@...el.com>
To:     Tiezhu Yang <yangtiezhu@...ngson.cn>
Cc:     llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
        linux-kernel@...r.kernel.org,
        Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
        Youling Tang <tangyouling@...ngson.cn>,
        Jinyang He <hejinyang@...ngson.cn>
Subject: fs/f2fs/gc.c:1522:12: warning: stack frame size (2240) exceeds limit
 (2048) in 'do_garbage_collect'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   72a85e2b0a1e1e6fb4ee51ae902730212b2de25c
commit: cf8194e46c1edd2368d19b71476bb77dc7bcb4c0 MIPS: Loongson64: Give chance to build under !CONFIG_NUMA and !CONFIG_SMP
date:   2 years ago
config: mips-randconfig-r026-20221224
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project f5700e7b69048de958172fb513b336564e7f8709)
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 mips cross compiling tool for clang build
        # apt-get install binutils-mips64el-linux-gnuabi64
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cf8194e46c1edd2368d19b71476bb77dc7bcb4c0
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout cf8194e46c1edd2368d19b71476bb77dc7bcb4c0
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash fs/f2fs/ kernel/bpf/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

>> fs/f2fs/gc.c:1522:12: warning: stack frame size (2240) exceeds limit (2048) in 'do_garbage_collect' [-Wframe-larger-than]
   static int do_garbage_collect(struct f2fs_sb_info *sbi,
   ^
   1930/2240 (86.16%) spills, 310/2240 (13.84%) variables
   fatal error: error in backend: Nested variants found in inline asm string: '	.set		push
   .set		mips64r2
   .if ( (__builtin_constant_p(!!(( 0x00 ) != -1)) ? (!!(( 0x00 ) != -1)) : ($( static struct ftrace_branch_data __attribute__((__aligned__(4))) __attribute__((__section__("_ftrace_branch"))) __if_trace = $( .func = __func__, .file = "arch/mips/include/asm/bitops.h", .line = 105, $); (!!(( 0x00 ) != -1)) ? (__if_trace.miss_hit[1]++,1) : (__if_trace.miss_hit[0]++,0); $))) ) && ( 0 ); .set push; .set mips64r2; .rept 1; sync 0x00; .endr; .set pop; .else; ; .endif
   1:	lld	$0, $1
   or	$0, $2
   scd	$0, $1
   beqz	$0, 1b
   .set		pop
   '
   clang-16: error: clang frontend command failed with exit code 70 (use -v to see invocation)
   clang version 16.0.0 (git://gitmirror/llvm_project f5700e7b69048de958172fb513b336564e7f8709)
   Target: mips64el-unknown-linux
   Thread model: posix
   InstalledDir: /opt/cross/clang/bin
   clang-16: note: diagnostic msg:
   ********************


vim +/do_garbage_collect +1522 fs/f2fs/gc.c

7bc0900347e069 Jaegeuk Kim    2012-11-02  1521  
718e53fa633f84 Chao Yu        2016-01-23 @1522  static int do_garbage_collect(struct f2fs_sb_info *sbi,
718e53fa633f84 Chao Yu        2016-01-23  1523  				unsigned int start_segno,
7dda2af83b2b75 Changman Lee   2014-11-28  1524  				struct gc_inode_list *gc_list, int gc_type)
7bc0900347e069 Jaegeuk Kim    2012-11-02  1525  {
7bc0900347e069 Jaegeuk Kim    2012-11-02  1526  	struct page *sum_page;
7bc0900347e069 Jaegeuk Kim    2012-11-02  1527  	struct f2fs_summary_block *sum;
c718379b6b0954 Jaegeuk Kim    2013-04-24  1528  	struct blk_plug plug;
718e53fa633f84 Chao Yu        2016-01-23  1529  	unsigned int segno = start_segno;
718e53fa633f84 Chao Yu        2016-01-23  1530  	unsigned int end_segno = start_segno + sbi->segs_per_sec;
e3080b0120a15e Chao Yu        2018-10-24  1531  	int seg_freed = 0, migrated = 0;
718e53fa633f84 Chao Yu        2016-01-23  1532  	unsigned char type = IS_DATASEG(get_seg_entry(sbi, segno)->type) ?
718e53fa633f84 Chao Yu        2016-01-23  1533  						SUM_TYPE_DATA : SUM_TYPE_NODE;
48018b4cfd07dd Chao Yu        2018-09-13  1534  	int submitted = 0;
7bc0900347e069 Jaegeuk Kim    2012-11-02  1535  
e3080b0120a15e Chao Yu        2018-10-24  1536  	if (__is_large_section(sbi))
e3080b0120a15e Chao Yu        2018-10-24  1537  		end_segno = rounddown(end_segno, sbi->segs_per_sec);
e3080b0120a15e Chao Yu        2018-10-24  1538  
de881df97768d0 Aravind Ramesh 2020-07-16  1539  	/*
de881df97768d0 Aravind Ramesh 2020-07-16  1540  	 * zone-capacity can be less than zone-size in zoned devices,
de881df97768d0 Aravind Ramesh 2020-07-16  1541  	 * resulting in less than expected usable segments in the zone,
de881df97768d0 Aravind Ramesh 2020-07-16  1542  	 * calculate the end segno in the zone which can be garbage collected
de881df97768d0 Aravind Ramesh 2020-07-16  1543  	 */
de881df97768d0 Aravind Ramesh 2020-07-16  1544  	if (f2fs_sb_has_blkzoned(sbi))
de881df97768d0 Aravind Ramesh 2020-07-16  1545  		end_segno -= sbi->segs_per_sec -
de881df97768d0 Aravind Ramesh 2020-07-16  1546  					f2fs_usable_segs_in_sec(sbi, segno);
de881df97768d0 Aravind Ramesh 2020-07-16  1547  
093749e296e29a Chao Yu        2020-08-04  1548  	sanity_check_seg_type(sbi, get_seg_entry(sbi, segno)->type);
093749e296e29a Chao Yu        2020-08-04  1549  
718e53fa633f84 Chao Yu        2016-01-23  1550  	/* readahead multi ssa blocks those have contiguous address */
2c70c5e3874e8c Chao Yu        2018-10-24  1551  	if (__is_large_section(sbi))
4d57b86dd86404 Chao Yu        2018-05-30  1552  		f2fs_ra_meta_pages(sbi, GET_SUM_BLOCK(sbi, segno),
e3080b0120a15e Chao Yu        2018-10-24  1553  					end_segno - segno, META_SSA, true);
718e53fa633f84 Chao Yu        2016-01-23  1554  
718e53fa633f84 Chao Yu        2016-01-23  1555  	/* reference all summary page */
718e53fa633f84 Chao Yu        2016-01-23  1556  	while (segno < end_segno) {
4d57b86dd86404 Chao Yu        2018-05-30  1557  		sum_page = f2fs_get_sum_page(sbi, segno++);
edc55aaf0d1712 Jaegeuk Kim    2018-09-17  1558  		if (IS_ERR(sum_page)) {
edc55aaf0d1712 Jaegeuk Kim    2018-09-17  1559  			int err = PTR_ERR(sum_page);
edc55aaf0d1712 Jaegeuk Kim    2018-09-17  1560  
edc55aaf0d1712 Jaegeuk Kim    2018-09-17  1561  			end_segno = segno - 1;
edc55aaf0d1712 Jaegeuk Kim    2018-09-17  1562  			for (segno = start_segno; segno < end_segno; segno++) {
edc55aaf0d1712 Jaegeuk Kim    2018-09-17  1563  				sum_page = find_get_page(META_MAPPING(sbi),
edc55aaf0d1712 Jaegeuk Kim    2018-09-17  1564  						GET_SUM_BLOCK(sbi, segno));
edc55aaf0d1712 Jaegeuk Kim    2018-09-17  1565  				f2fs_put_page(sum_page, 0);
edc55aaf0d1712 Jaegeuk Kim    2018-09-17  1566  				f2fs_put_page(sum_page, 0);
edc55aaf0d1712 Jaegeuk Kim    2018-09-17  1567  			}
edc55aaf0d1712 Jaegeuk Kim    2018-09-17  1568  			return err;
edc55aaf0d1712 Jaegeuk Kim    2018-09-17  1569  		}
718e53fa633f84 Chao Yu        2016-01-23  1570  		unlock_page(sum_page);
718e53fa633f84 Chao Yu        2016-01-23  1571  	}
7bc0900347e069 Jaegeuk Kim    2012-11-02  1572  
c718379b6b0954 Jaegeuk Kim    2013-04-24  1573  	blk_start_plug(&plug);
c718379b6b0954 Jaegeuk Kim    2013-04-24  1574  
718e53fa633f84 Chao Yu        2016-01-23  1575  	for (segno = start_segno; segno < end_segno; segno++) {
aa987273290d20 Jaegeuk Kim    2016-06-06  1576  
718e53fa633f84 Chao Yu        2016-01-23  1577  		/* find segment summary of victim */
718e53fa633f84 Chao Yu        2016-01-23  1578  		sum_page = find_get_page(META_MAPPING(sbi),
718e53fa633f84 Chao Yu        2016-01-23  1579  					GET_SUM_BLOCK(sbi, segno));
718e53fa633f84 Chao Yu        2016-01-23  1580  		f2fs_put_page(sum_page, 0);
718e53fa633f84 Chao Yu        2016-01-23  1581  
d6c66cd19ef322 Yunlong Song   2018-10-24  1582  		if (get_valid_blocks(sbi, segno, false) == 0)
d6c66cd19ef322 Yunlong Song   2018-10-24  1583  			goto freed;
dabfbbc8f91450 Jaegeuk Kim    2020-02-09  1584  		if (gc_type == BG_GC && __is_large_section(sbi) &&
e3080b0120a15e Chao Yu        2018-10-24  1585  				migrated >= sbi->migration_granularity)
e3080b0120a15e Chao Yu        2018-10-24  1586  			goto skip;
d6c66cd19ef322 Yunlong Song   2018-10-24  1587  		if (!PageUptodate(sum_page) || unlikely(f2fs_cp_error(sbi)))
e3080b0120a15e Chao Yu        2018-10-24  1588  			goto skip;
de0dcc40f6e24d Jaegeuk Kim    2016-10-12  1589  
7bc0900347e069 Jaegeuk Kim    2012-11-02  1590  		sum = page_address(sum_page);
10d255c3540239 Chao Yu        2018-07-04  1591  		if (type != GET_SUM_TYPE((&sum->footer))) {
dcbb4c10e6d969 Joe Perches    2019-06-18  1592  			f2fs_err(sbi, "Inconsistent segment (%u) type [%d, %d] in SSA and SIT",
10d255c3540239 Chao Yu        2018-07-04  1593  				 segno, type, GET_SUM_TYPE((&sum->footer)));
10d255c3540239 Chao Yu        2018-07-04  1594  			set_sbi_flag(sbi, SBI_NEED_FSCK);
793ab1c8a792f8 Chao Yu        2019-04-10  1595  			f2fs_stop_checkpoint(sbi, false);
e3080b0120a15e Chao Yu        2018-10-24  1596  			goto skip;
10d255c3540239 Chao Yu        2018-07-04  1597  		}
7bc0900347e069 Jaegeuk Kim    2012-11-02  1598  
9236cac5666ea8 Jaegeuk Kim    2015-05-28  1599  		/*
9236cac5666ea8 Jaegeuk Kim    2015-05-28  1600  		 * this is to avoid deadlock:
9236cac5666ea8 Jaegeuk Kim    2015-05-28  1601  		 * - lock_page(sum_page)         - f2fs_replace_block
3d26fa6be3c487 Chao Yu        2017-10-30  1602  		 *  - check_valid_map()            - down_write(sentry_lock)
3d26fa6be3c487 Chao Yu        2017-10-30  1603  		 *   - down_read(sentry_lock)     - change_curseg()
9236cac5666ea8 Jaegeuk Kim    2015-05-28  1604  		 *                                  - lock_page(sum_page)
9236cac5666ea8 Jaegeuk Kim    2015-05-28  1605  		 */
718e53fa633f84 Chao Yu        2016-01-23  1606  		if (type == SUM_TYPE_NODE)
48018b4cfd07dd Chao Yu        2018-09-13  1607  			submitted += gc_node_segment(sbi, sum->entries, segno,
718e53fa633f84 Chao Yu        2016-01-23  1608  								gc_type);
48018b4cfd07dd Chao Yu        2018-09-13  1609  		else
48018b4cfd07dd Chao Yu        2018-09-13  1610  			submitted += gc_data_segment(sbi, sum->entries, gc_list,
48018b4cfd07dd Chao Yu        2018-09-13  1611  							segno, gc_type);
c718379b6b0954 Jaegeuk Kim    2013-04-24  1612  
718e53fa633f84 Chao Yu        2016-01-23  1613  		stat_inc_seg_count(sbi, type, gc_type);
8c7b9ac129d096 Jaegeuk Kim    2020-02-09  1614  		migrated++;
c56f16dab0dfc8 Chao Yu        2017-08-11  1615  
d6c66cd19ef322 Yunlong Song   2018-10-24  1616  freed:
c56f16dab0dfc8 Chao Yu        2017-08-11  1617  		if (gc_type == FG_GC &&
c56f16dab0dfc8 Chao Yu        2017-08-11  1618  				get_valid_blocks(sbi, segno, false) == 0)
c56f16dab0dfc8 Chao Yu        2017-08-11  1619  			seg_freed++;
e3080b0120a15e Chao Yu        2018-10-24  1620  
e3080b0120a15e Chao Yu        2018-10-24  1621  		if (__is_large_section(sbi) && segno + 1 < end_segno)
e3080b0120a15e Chao Yu        2018-10-24  1622  			sbi->next_victim_seg[gc_type] = segno + 1;
e3080b0120a15e Chao Yu        2018-10-24  1623  skip:
9236cac5666ea8 Jaegeuk Kim    2015-05-28  1624  		f2fs_put_page(sum_page, 0);
718e53fa633f84 Chao Yu        2016-01-23  1625  	}
718e53fa633f84 Chao Yu        2016-01-23  1626  
48018b4cfd07dd Chao Yu        2018-09-13  1627  	if (submitted)
b9109b0e49b93b Jaegeuk Kim    2017-05-10  1628  		f2fs_submit_merged_write(sbi,
b9109b0e49b93b Jaegeuk Kim    2017-05-10  1629  				(type == SUM_TYPE_NODE) ? NODE : DATA);
718e53fa633f84 Chao Yu        2016-01-23  1630  
718e53fa633f84 Chao Yu        2016-01-23  1631  	blk_finish_plug(&plug);
718e53fa633f84 Chao Yu        2016-01-23  1632  
17d899df4678a1 Chao Yu        2016-02-22  1633  	stat_inc_call_count(sbi->stat_info);
17d899df4678a1 Chao Yu        2016-02-22  1634  
c56f16dab0dfc8 Chao Yu        2017-08-11  1635  	return seg_freed;
7bc0900347e069 Jaegeuk Kim    2012-11-02  1636  }
7bc0900347e069 Jaegeuk Kim    2012-11-02  1637  

:::::: The code at line 1522 was first introduced by commit
:::::: 718e53fa633f84d09acb4b76f1ad572ccbf75a12 f2fs: enhance foreground GC

:::::: TO: Chao Yu <chao2.yu@...sung.com>
:::::: CC: Jaegeuk Kim <jaegeuk@...nel.org>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (160943 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ