[PATCH] dma-buf: fix and rework dma_buf_poll v5

kernel test robot lkp at intel.com
Fri Jul 9 12:50:20 UTC 2021


Hi "Christian,

I love your patch! Perhaps something to improve:

[auto build test WARNING on tegra-drm/drm/tegra/for-next]
[also build test WARNING on v5.13]
[cannot apply to linus/master next-20210709]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Christian-K-nig/dma-buf-fix-and-rework-dma_buf_poll-v5/20210708-192030
base:   git://anongit.freedesktop.org/tegra/linux.git drm/tegra/for-next
config: mips-randconfig-r032-20210709 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8d69635ed9ecf36fd0ca85906bfde17949671cbe)
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-mips-linux-gnu
        # https://github.com/0day-ci/linux/commit/07538f7542063f6043e1a5dab5f4aa572a091c96
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Christian-K-nig/dma-buf-fix-and-rework-dma_buf_poll-v5/20210708-192030
        git checkout 07538f7542063f6043e1a5dab5f4aa572a091c96
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=mips SHELL=/bin/bash drivers/dma-buf/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All warnings (new ones prefixed by >>):

>> drivers/dma-buf/dma-buf.c:253:11: warning: unused variable 'shared_count'
   unsigned shared_count;
   ^
>> drivers/dma-buf/dma-buf.c:255:9: warning: unused variable 'i'
   int r, i;
   ^
>> drivers/dma-buf/dma-buf.c:255:6: warning: unused variable 'r'
   int r, i;
   ^
   fatal error: error in backend: Nested variants found in inline asm string: ' .set push
   .set mips64r2
   .if ( 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/atomic.h", .line = 153, $); 0x00 ) != -1)) : $))) ) && ( 0 ); .set push; .set mips64r2; .rept 1; sync 0x00; .endr; .set pop; .else; ; .endif
   1: ll $1, $2 # atomic_fetch_add
   addu $0, $1, $3
   sc $0, $2
   beqz $0, 1b
   .set pop
   move $0, $1
   '
   clang-13: error: clang frontend command failed with exit code 70 (use -v to see invocation)
   clang version 13.0.0 (git://gitmirror/llvm_project 8d69635ed9ecf36fd0ca85906bfde17949671cbe)
   Target: mipsel-unknown-linux-gnu
   Thread model: posix
   InstalledDir: /opt/cross/clang-8d69635ed9/bin
   clang-13: note: diagnostic msg:
   Makefile arch drivers include kernel mm scripts source usr


vim +/shared_count +253 drivers/dma-buf/dma-buf.c

   248	
   249	static __poll_t dma_buf_poll(struct file *file, poll_table *poll)
   250	{
   251		struct dma_buf *dmabuf;
   252		struct dma_resv *resv;
 > 253		unsigned shared_count;
   254		__poll_t events;
 > 255		int r, i;
   256	
   257		dmabuf = file->private_data;
   258		if (!dmabuf || !dmabuf->resv)
   259			return EPOLLERR;
   260	
   261		resv = dmabuf->resv;
   262	
   263		poll_wait(file, &dmabuf->poll, poll);
   264	
   265		events = poll_requested_events(poll) & (EPOLLIN | EPOLLOUT);
   266		if (!events)
   267			return 0;
   268	
   269		dma_resv_lock(resv, NULL);
   270	
   271		if (events & EPOLLOUT) {
   272			struct dma_buf_poll_cb_t *dcb = &dmabuf->cb_out;
   273	
   274			/* Check that callback isn't busy */
   275			spin_lock_irq(&dmabuf->poll.lock);
   276			if (dcb->active)
   277				events &= ~EPOLLOUT;
   278			else
   279				dcb->active = EPOLLOUT;
   280			spin_unlock_irq(&dmabuf->poll.lock);
   281	
   282			if (events & EPOLLOUT && !dma_buf_poll_shared(resv, dcb) &&
   283			    !dma_buf_poll_excl(resv, dcb))
   284				/* No callback queued, wake up any other waiters */
   285				dma_buf_poll_cb(NULL, &dcb->cb);
   286		}
   287	
   288		if (events & EPOLLIN) {
   289			struct dma_buf_poll_cb_t *dcb = &dmabuf->cb_in;
   290	
   291			/* Check that callback isn't busy */
   292			spin_lock_irq(&dmabuf->poll.lock);
   293			if (dcb->active)
   294				events &= ~EPOLLIN;
   295			else
   296				dcb->active = EPOLLIN;
   297			spin_unlock_irq(&dmabuf->poll.lock);
   298	
   299			if (events & EPOLLIN && !dma_buf_poll_excl(resv, dcb))
   300				/* No callback queued, wake up any other waiters */
   301				dma_buf_poll_cb(NULL, &dcb->cb);
   302		}
   303	
   304		dma_resv_unlock(resv);
   305		return events;
   306	}
   307	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 24620 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20210709/08ba73fc/attachment-0001.gz>


More information about the dri-devel mailing list