drivers/md/dm-log-writes.c:452:12: warning: stack frame size of 1184 bytes in function 'log_writes_kthread'

From: kernel test robot
Date: Sat Apr 17 2021 - 19:28:48 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 194cf4825638256e9afe1d360831aa5379b3517a
commit: 309dca309fc39a9e3c31b916393b74bd174fd74e block: store a block_device pointer in struct bio
date: 3 months ago
config: powerpc64-randconfig-r032-20210418 (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 powerpc64 cross compiling tool for clang build
# apt-get install binutils-powerpc64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=309dca309fc39a9e3c31b916393b74bd174fd74e
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 309dca309fc39a9e3c31b916393b74bd174fd74e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=powerpc64

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

All warnings (new ones prefixed by >>):

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:619:
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:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:116:1: note: expanded from here
__do_insw
^
arch/powerpc/include/asm/io.h:557: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 drivers/md/dm-log-writes.c:7:
In file included from include/linux/device-mapper.h:11:
In file included from include/linux/bio.h:8:
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:619:
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:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:118:1: note: expanded from here
__do_insl
^
arch/powerpc/include/asm/io.h:558: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 drivers/md/dm-log-writes.c:7:
In file included from include/linux/device-mapper.h:11:
In file included from include/linux/bio.h:8:
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:619:
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:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:120:1: note: expanded from here
__do_outsb
^
arch/powerpc/include/asm/io.h:559: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 drivers/md/dm-log-writes.c:7:
In file included from include/linux/device-mapper.h:11:
In file included from include/linux/bio.h:8:
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:619:
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:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:122:1: note: expanded from here
__do_outsw
^
arch/powerpc/include/asm/io.h:560: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 drivers/md/dm-log-writes.c:7:
In file included from include/linux/device-mapper.h:11:
In file included from include/linux/bio.h:8:
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:619:
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:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:124:1: note: expanded from here
__do_outsl
^
arch/powerpc/include/asm/io.h:561:58: note: expanded from macro '__do_outsl'
#define __do_outsl(p, b, n) writesl((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
>> drivers/md/dm-log-writes.c:452:12: warning: stack frame size of 1184 bytes in function 'log_writes_kthread' [-Wframe-larger-than=]
static int log_writes_kthread(void *arg)
^
7 warnings generated.


vim +/log_writes_kthread +452 drivers/md/dm-log-writes.c

0e9cebe724597a Josef Bacik 2015-03-20 451
0e9cebe724597a Josef Bacik 2015-03-20 @452 static int log_writes_kthread(void *arg)
0e9cebe724597a Josef Bacik 2015-03-20 453 {
0e9cebe724597a Josef Bacik 2015-03-20 454 struct log_writes_c *lc = (struct log_writes_c *)arg;
0e9cebe724597a Josef Bacik 2015-03-20 455 sector_t sector = 0;
0e9cebe724597a Josef Bacik 2015-03-20 456
0e9cebe724597a Josef Bacik 2015-03-20 457 while (!kthread_should_stop()) {
0e9cebe724597a Josef Bacik 2015-03-20 458 bool super = false;
0e9cebe724597a Josef Bacik 2015-03-20 459 bool logging_enabled;
0e9cebe724597a Josef Bacik 2015-03-20 460 struct pending_block *block = NULL;
0e9cebe724597a Josef Bacik 2015-03-20 461 int ret;
0e9cebe724597a Josef Bacik 2015-03-20 462
0e9cebe724597a Josef Bacik 2015-03-20 463 spin_lock_irq(&lc->blocks_lock);
0e9cebe724597a Josef Bacik 2015-03-20 464 if (!list_empty(&lc->logging_blocks)) {
0e9cebe724597a Josef Bacik 2015-03-20 465 block = list_first_entry(&lc->logging_blocks,
0e9cebe724597a Josef Bacik 2015-03-20 466 struct pending_block, list);
0e9cebe724597a Josef Bacik 2015-03-20 467 list_del_init(&block->list);
0e9cebe724597a Josef Bacik 2015-03-20 468 if (!lc->logging_enabled)
0e9cebe724597a Josef Bacik 2015-03-20 469 goto next;
0e9cebe724597a Josef Bacik 2015-03-20 470
0e9cebe724597a Josef Bacik 2015-03-20 471 sector = lc->next_sector;
228bb5b26038a7 Josef Bacik 2017-07-28 472 if (!(block->flags & LOG_DISCARD_FLAG))
228bb5b26038a7 Josef Bacik 2017-07-28 473 lc->next_sector += dev_to_bio_sectors(lc, block->nr_sectors);
228bb5b26038a7 Josef Bacik 2017-07-28 474 lc->next_sector += dev_to_bio_sectors(lc, 1);
0e9cebe724597a Josef Bacik 2015-03-20 475
0e9cebe724597a Josef Bacik 2015-03-20 476 /*
0e9cebe724597a Josef Bacik 2015-03-20 477 * Apparently the size of the device may not be known
0e9cebe724597a Josef Bacik 2015-03-20 478 * right away, so handle this properly.
0e9cebe724597a Josef Bacik 2015-03-20 479 */
0e9cebe724597a Josef Bacik 2015-03-20 480 if (!lc->end_sector)
0e9cebe724597a Josef Bacik 2015-03-20 481 lc->end_sector = logdev_last_sector(lc);
0e9cebe724597a Josef Bacik 2015-03-20 482 if (lc->end_sector &&
0e9cebe724597a Josef Bacik 2015-03-20 483 lc->next_sector >= lc->end_sector) {
0e9cebe724597a Josef Bacik 2015-03-20 484 DMERR("Ran out of space on the logdev");
0e9cebe724597a Josef Bacik 2015-03-20 485 lc->logging_enabled = false;
0e9cebe724597a Josef Bacik 2015-03-20 486 goto next;
0e9cebe724597a Josef Bacik 2015-03-20 487 }
0e9cebe724597a Josef Bacik 2015-03-20 488 lc->logged_entries++;
0e9cebe724597a Josef Bacik 2015-03-20 489 atomic_inc(&lc->io_blocks);
0e9cebe724597a Josef Bacik 2015-03-20 490
0e9cebe724597a Josef Bacik 2015-03-20 491 super = (block->flags & (LOG_FUA_FLAG | LOG_MARK_FLAG));
0e9cebe724597a Josef Bacik 2015-03-20 492 if (super)
0e9cebe724597a Josef Bacik 2015-03-20 493 atomic_inc(&lc->io_blocks);
0e9cebe724597a Josef Bacik 2015-03-20 494 }
0e9cebe724597a Josef Bacik 2015-03-20 495 next:
0e9cebe724597a Josef Bacik 2015-03-20 496 logging_enabled = lc->logging_enabled;
0e9cebe724597a Josef Bacik 2015-03-20 497 spin_unlock_irq(&lc->blocks_lock);
0e9cebe724597a Josef Bacik 2015-03-20 498 if (block) {
0e9cebe724597a Josef Bacik 2015-03-20 499 if (logging_enabled) {
0e9cebe724597a Josef Bacik 2015-03-20 500 ret = log_one_block(lc, block, sector);
0e9cebe724597a Josef Bacik 2015-03-20 501 if (!ret && super)
0e9cebe724597a Josef Bacik 2015-03-20 502 ret = log_super(lc);
0e9cebe724597a Josef Bacik 2015-03-20 503 if (ret) {
0e9cebe724597a Josef Bacik 2015-03-20 504 spin_lock_irq(&lc->blocks_lock);
0e9cebe724597a Josef Bacik 2015-03-20 505 lc->logging_enabled = false;
0e9cebe724597a Josef Bacik 2015-03-20 506 spin_unlock_irq(&lc->blocks_lock);
0e9cebe724597a Josef Bacik 2015-03-20 507 }
0e9cebe724597a Josef Bacik 2015-03-20 508 } else
0e9cebe724597a Josef Bacik 2015-03-20 509 free_pending_block(lc, block);
0e9cebe724597a Josef Bacik 2015-03-20 510 continue;
0e9cebe724597a Josef Bacik 2015-03-20 511 }
0e9cebe724597a Josef Bacik 2015-03-20 512
0e9cebe724597a Josef Bacik 2015-03-20 513 if (!try_to_freeze()) {
0e9cebe724597a Josef Bacik 2015-03-20 514 set_current_state(TASK_INTERRUPTIBLE);
0e9cebe724597a Josef Bacik 2015-03-20 515 if (!kthread_should_stop() &&
0c79c62021d23f Josef Bacik 2017-07-28 516 list_empty(&lc->logging_blocks))
0e9cebe724597a Josef Bacik 2015-03-20 517 schedule();
0e9cebe724597a Josef Bacik 2015-03-20 518 __set_current_state(TASK_RUNNING);
0e9cebe724597a Josef Bacik 2015-03-20 519 }
0e9cebe724597a Josef Bacik 2015-03-20 520 }
0e9cebe724597a Josef Bacik 2015-03-20 521 return 0;
0e9cebe724597a Josef Bacik 2015-03-20 522 }
0e9cebe724597a Josef Bacik 2015-03-20 523

:::::: The code at line 452 was first introduced by commit
:::::: 0e9cebe724597a76ab1b0ebc0a21e16f7db11b47 dm: add log writes target

:::::: TO: Josef Bacik <jbacik@xxxxxx>
:::::: CC: Mike Snitzer <snitzer@xxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip