drivers/media/common/videobuf2/videobuf2-core.c:391:12: warning: stack frame size of 2080 bytes in function '__vb2_queue_alloc'

From: kernel test robot
Date: Sun May 30 2021 - 06:44:01 EST


Hi Sergey,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b90e90f40b4ff23c753126008bf4713a42353af6
commit: bac63f1239aceb092e94fee3ef112dbaea79b372 media: vb2: set cache sync hints when init buffers
date: 6 months ago
config: powerpc64-randconfig-r034-20210530 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project bc6799f2f79f0ae87e9f1ebf9d25ba799fbd25a9)
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=bac63f1239aceb092e94fee3ef112dbaea79b372
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout bac63f1239aceb092e94fee3ef112dbaea79b372
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross 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 include/linux/dma-buf.h:18:
In file included from include/linux/scatterlist.h:9:
In file included from arch/powerpc/include/asm/io.h:604:
arch/powerpc/include/asm/io-defs.h:43:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(insb, (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>:249:1: note: expanded from here
__do_insb
^
arch/powerpc/include/asm/io.h:541:56: note: expanded from macro '__do_insb'
#define __do_insb(p, b, n) readsb((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from drivers/media/common/videobuf2/videobuf2-core.c:29:
In file included from include/media/videobuf2-core.h:18:
In file included from include/linux/dma-buf.h:18:
In file included from include/linux/scatterlist.h:9:
In file included from arch/powerpc/include/asm/io.h:604:
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>:251: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 drivers/media/common/videobuf2/videobuf2-core.c:29:
In file included from include/media/videobuf2-core.h:18:
In file included from include/linux/dma-buf.h:18:
In file included from include/linux/scatterlist.h:9:
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>:2: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 drivers/media/common/videobuf2/videobuf2-core.c:29:
In file included from include/media/videobuf2-core.h:18:
In file included from include/linux/dma-buf.h:18:
In file included from include/linux/scatterlist.h:9:
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>:4: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 drivers/media/common/videobuf2/videobuf2-core.c:29:
In file included from include/media/videobuf2-core.h:18:
In file included from include/linux/dma-buf.h:18:
In file included from include/linux/scatterlist.h:9:
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>:6: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 drivers/media/common/videobuf2/videobuf2-core.c:29:
In file included from include/media/videobuf2-core.h:18:
In file included from include/linux/dma-buf.h:18:
In file included from include/linux/scatterlist.h:9:
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>:8: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))
~~~~~~~~~~~~~~~~~~~~~^
>> drivers/media/common/videobuf2/videobuf2-core.c:391:12: warning: stack frame size of 2080 bytes in function '__vb2_queue_alloc' [-Wframe-larger-than=]
static int __vb2_queue_alloc(struct vb2_queue *q, enum vb2_memory memory,
^
14 warnings generated.


vim +/__vb2_queue_alloc +391 drivers/media/common/videobuf2/videobuf2-core.c

e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 383
2a87af6ba1b9df drivers/media/v4l2-core/videobuf2-core.c Mauro Carvalho Chehab 2017-11-27 384 /*
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 385 * __vb2_queue_alloc() - allocate videobuf buffer structures and (for MMAP type)
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 386 * video buffer memory for all buffers/planes on the queue and initializes the
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 387 * queue
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 388 *
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 389 * Returns the number of buffers successfully allocated.
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 390 */
bed04f93424737 drivers/media/v4l2-core/videobuf2-core.c Junghak Sung 2015-10-06 @391 static int __vb2_queue_alloc(struct vb2_queue *q, enum vb2_memory memory,
58e1ba3ce6b2c8 drivers/media/v4l2-core/videobuf2-core.c Hans Verkuil 2015-11-20 392 unsigned int num_buffers, unsigned int num_planes,
58e1ba3ce6b2c8 drivers/media/v4l2-core/videobuf2-core.c Hans Verkuil 2015-11-20 393 const unsigned plane_sizes[VB2_MAX_PLANES])
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 394 {
489648afcd309b drivers/media/v4l2-core/videobuf2-core.c Hans Verkuil 2015-11-20 395 unsigned int buffer, plane;
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 396 struct vb2_buffer *vb;
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 397 int ret;
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 398
df93dc61b0d8b1 drivers/media/common/videobuf/videobuf2-core.c Mauro Carvalho Chehab 2017-12-28 399 /* Ensure that q->num_buffers+num_buffers is below VB2_MAX_FRAME */
df93dc61b0d8b1 drivers/media/common/videobuf/videobuf2-core.c Mauro Carvalho Chehab 2017-12-28 400 num_buffers = min_t(unsigned int, num_buffers,
df93dc61b0d8b1 drivers/media/common/videobuf/videobuf2-core.c Mauro Carvalho Chehab 2017-12-28 401 VB2_MAX_FRAME - q->num_buffers);
df93dc61b0d8b1 drivers/media/common/videobuf/videobuf2-core.c Mauro Carvalho Chehab 2017-12-28 402
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 403 for (buffer = 0; buffer < num_buffers; ++buffer) {
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 404 /* Allocate videobuf buffer structures */
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 405 vb = kzalloc(q->buf_struct_size, GFP_KERNEL);
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 406 if (!vb) {
b820935b35479e drivers/media/common/videobuf2/videobuf2-core.c Laurent Pinchart 2020-06-21 407 dprintk(q, 1, "memory alloc for buffer struct failed\n");
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 408 break;
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 409 }
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 410
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 411 vb->state = VB2_BUF_STATE_DEQUEUED;
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 412 vb->vb2_queue = q;
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 413 vb->num_planes = num_planes;
2d7007153f0c9b drivers/media/v4l2-core/videobuf2-core.c Junghak Sung 2015-09-22 414 vb->index = q->num_buffers + buffer;
2d7007153f0c9b drivers/media/v4l2-core/videobuf2-core.c Junghak Sung 2015-09-22 415 vb->type = q->type;
2d7007153f0c9b drivers/media/v4l2-core/videobuf2-core.c Junghak Sung 2015-09-22 416 vb->memory = memory;
bac63f1239aceb drivers/media/common/videobuf2/videobuf2-core.c Sergey Senozhatsky 2020-11-30 417 /*
bac63f1239aceb drivers/media/common/videobuf2/videobuf2-core.c Sergey Senozhatsky 2020-11-30 418 * We need to set these flags here so that the videobuf2 core
bac63f1239aceb drivers/media/common/videobuf2/videobuf2-core.c Sergey Senozhatsky 2020-11-30 419 * will call ->prepare()/->finish() cache sync/flush on vb2
bac63f1239aceb drivers/media/common/videobuf2/videobuf2-core.c Sergey Senozhatsky 2020-11-30 420 * buffers when appropriate. However, we can avoid explicit
bac63f1239aceb drivers/media/common/videobuf2/videobuf2-core.c Sergey Senozhatsky 2020-11-30 421 * ->prepare() and ->finish() cache sync for DMABUF buffers,
bac63f1239aceb drivers/media/common/videobuf2/videobuf2-core.c Sergey Senozhatsky 2020-11-30 422 * because DMA exporter takes care of it.
bac63f1239aceb drivers/media/common/videobuf2/videobuf2-core.c Sergey Senozhatsky 2020-11-30 423 */
bac63f1239aceb drivers/media/common/videobuf2/videobuf2-core.c Sergey Senozhatsky 2020-11-30 424 if (q->memory != VB2_MEMORY_DMABUF) {
bac63f1239aceb drivers/media/common/videobuf2/videobuf2-core.c Sergey Senozhatsky 2020-11-30 425 vb->need_cache_sync_on_prepare = 1;
bac63f1239aceb drivers/media/common/videobuf2/videobuf2-core.c Sergey Senozhatsky 2020-11-30 426 vb->need_cache_sync_on_finish = 1;
bac63f1239aceb drivers/media/common/videobuf2/videobuf2-core.c Sergey Senozhatsky 2020-11-30 427 }
58e1ba3ce6b2c8 drivers/media/v4l2-core/videobuf2-core.c Hans Verkuil 2015-11-20 428 for (plane = 0; plane < num_planes; ++plane) {
58e1ba3ce6b2c8 drivers/media/v4l2-core/videobuf2-core.c Hans Verkuil 2015-11-20 429 vb->planes[plane].length = plane_sizes[plane];
58e1ba3ce6b2c8 drivers/media/v4l2-core/videobuf2-core.c Hans Verkuil 2015-11-20 430 vb->planes[plane].min_length = plane_sizes[plane];
58e1ba3ce6b2c8 drivers/media/v4l2-core/videobuf2-core.c Hans Verkuil 2015-11-20 431 }
8e013700bc1280 drivers/media/common/videobuf2/videobuf2-core.c Hans Verkuil 2018-06-01 432 call_void_bufop(q, init_buffer, vb);
8e013700bc1280 drivers/media/common/videobuf2/videobuf2-core.c Hans Verkuil 2018-06-01 433
e32f856ab29e93 drivers/media/v4l2-core/videobuf2-core.c Hans Verkuil 2015-11-20 434 q->bufs[vb->index] = vb;
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 435
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 436 /* Allocate video buffer memory for the MMAP type */
bed04f93424737 drivers/media/v4l2-core/videobuf2-core.c Junghak Sung 2015-10-06 437 if (memory == VB2_MEMORY_MMAP) {
c1426bc727b788 drivers/media/video/videobuf2-core.c Marek Szyprowski 2011-08-24 438 ret = __vb2_buf_mem_alloc(vb);
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 439 if (ret) {
b820935b35479e drivers/media/common/videobuf2/videobuf2-core.c Laurent Pinchart 2020-06-21 440 dprintk(q, 1, "failed allocating memory for buffer %d\n",
8720427c198b6d drivers/media/v4l2-core/videobuf2-core.c Mauro Carvalho Chehab 2016-10-18 441 buffer);
e32f856ab29e93 drivers/media/v4l2-core/videobuf2-core.c Hans Verkuil 2015-11-20 442 q->bufs[vb->index] = NULL;
58e1ba3ce6b2c8 drivers/media/v4l2-core/videobuf2-core.c Hans Verkuil 2015-11-20 443 kfree(vb);
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 444 break;
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 445 }
20eedf0e169180 drivers/media/v4l2-core/videobuf2-core.c Hans Verkuil 2015-11-20 446 __setup_offsets(vb);
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 447 /*
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 448 * Call the driver-provided buffer initialization
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 449 * callback, if given. An error in initialization
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 450 * results in queue setup failure.
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 451 */
b5b4541eef8eac drivers/media/v4l2-core/videobuf2-core.c Hans Verkuil 2014-01-29 452 ret = call_vb_qop(vb, buf_init, vb);
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 453 if (ret) {
b820935b35479e drivers/media/common/videobuf2/videobuf2-core.c Laurent Pinchart 2020-06-21 454 dprintk(q, 1, "buffer %d %p initialization failed\n",
8720427c198b6d drivers/media/v4l2-core/videobuf2-core.c Mauro Carvalho Chehab 2016-10-18 455 buffer, vb);
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 456 __vb2_buf_mem_free(vb);
e32f856ab29e93 drivers/media/v4l2-core/videobuf2-core.c Hans Verkuil 2015-11-20 457 q->bufs[vb->index] = NULL;
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 458 kfree(vb);
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 459 break;
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 460 }
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 461 }
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 462 }
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 463
b820935b35479e drivers/media/common/videobuf2/videobuf2-core.c Laurent Pinchart 2020-06-21 464 dprintk(q, 3, "allocated %d buffers, %d plane(s) each\n",
2d86401c2cbfce drivers/media/video/videobuf2-core.c Guennadi Liakhovetski 2011-09-28 465 buffer, num_planes);
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 466
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 467 return buffer;
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 468 }
e23ccc0ad92586 drivers/media/video/videobuf2-core.c Pawel Osciak 2010-10-11 469

:::::: The code at line 391 was first introduced by commit
:::::: bed04f9342473743fc96b71c3130f645c718bd47 [media] media: videobuf2: Replace v4l2-specific data with vb2 data

:::::: TO: Junghak Sung <jh1009.sung@xxxxxxxxxxx>
:::::: CC: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip