All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>,
	daniel@ffwll.ch, dri-devel@lists.freedesktop.org,
	sumit.semwal@linaro.org, jason@jlekstrand.net
Cc: clang-built-linux@googlegroups.com, kbuild-all@lists.01.org
Subject: Re: [PATCH] dma-buf: fix and rework dma_buf_poll
Date: Thu, 17 Jun 2021 17:38:03 +0800	[thread overview]
Message-ID: <202106171734.Lqiu3CQO-lkp@intel.com> (raw)
In-Reply-To: <20210615112117.32838-1-christian.koenig@amd.com>

[-- Attachment #1: Type: text/plain, Size: 4968 bytes --]

Hi "Christian,

I love your patch! Perhaps something to improve:

[auto build test WARNING on next-20210616]
[cannot apply to tegra-drm/drm/tegra/for-next linus/master v5.13-rc6 v5.13-rc5 v5.13-rc4 v5.13-rc6]
[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/20210617-103036
base:    c7d4c1fd91ab4a6d2620497921a9c6bf54650ab8
config: s390-randconfig-r022-20210617 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 64720f57bea6a6bf033feef4a5751ab9c0c3b401)
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 s390 cross compiling tool for clang build
        # apt-get install binutils-s390x-linux-gnu
        # https://github.com/0day-ci/linux/commit/dfa9f2ec4c082b73e644e2c565e58e2291f94463
        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/20210617-103036
        git checkout dfa9f2ec4c082b73e644e2c565e58e2291f94463
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390 

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

All warnings (new ones prefixed by >>):

>> drivers/dma-buf/dma-buf.c:284:17: warning: variable 'fence_excl' is uninitialized when used here [-Wuninitialized]
                   dma_fence_put(fence_excl);
                                 ^~~~~~~~~~
   drivers/dma-buf/dma-buf.c:213:30: note: initialize the variable 'fence_excl' to silence this warning
           struct dma_fence *fence_excl;
                                       ^
                                        = NULL
   1 warning generated.


vim +/fence_excl +284 drivers/dma-buf/dma-buf.c

   206	
   207	static __poll_t dma_buf_poll(struct file *file, poll_table *poll)
   208	{
   209		struct dma_buf_poll_cb_t *dcb;
   210		struct dma_buf *dmabuf;
   211		struct dma_resv *resv;
   212		struct dma_resv_list *fobj;
   213		struct dma_fence *fence_excl;
   214		unsigned shared_count, seq;
   215		struct dma_fence *fence;
   216		__poll_t events;
   217		int r, i;
   218	
   219		dmabuf = file->private_data;
   220		if (!dmabuf || !dmabuf->resv)
   221			return EPOLLERR;
   222	
   223		resv = dmabuf->resv;
   224	
   225		poll_wait(file, &dmabuf->poll, poll);
   226	
   227		events = poll_requested_events(poll) & (EPOLLIN | EPOLLOUT);
   228		if (!events)
   229			return 0;
   230	
   231		dcb = events & EPOLLOUT ? &dmabuf->cb_out : &dmabuf->cb_in;
   232	
   233		/* Only queue a new one if we are not still waiting for the old one */
   234		spin_lock_irq(&dmabuf->poll.lock);
   235		if (dcb->active)
   236			events = 0;
   237		else
   238			dcb->active = events;
   239		spin_unlock_irq(&dmabuf->poll.lock);
   240		if (!events)
   241			return 0;
   242	
   243	retry:
   244		seq = read_seqcount_begin(&resv->seq);
   245		rcu_read_lock();
   246	
   247		fobj = rcu_dereference(resv->fence);
   248		if (fobj && events & EPOLLOUT)
   249			shared_count = fobj->shared_count;
   250		else
   251			shared_count = 0;
   252	
   253		for (i = 0; i < shared_count; ++i) {
   254			fence = rcu_dereference(fobj->shared[i]);
   255			fence = dma_fence_get_rcu(fence);
   256			if (!fence || read_seqcount_retry(&resv->seq, seq)) {
   257				/* Concurrent modify detected, force re-check */
   258				dma_fence_put(fence);
   259				rcu_read_unlock();
   260				goto retry;
   261			}
   262	
   263			r = dma_fence_add_callback(fence, &dcb->cb, dma_buf_poll_cb);
   264			dma_fence_put(fence);
   265			if (!r) {
   266				/* Callback queued */
   267				events = 0;
   268				goto out;
   269			}
   270		}
   271	
   272		fence = dma_resv_excl_fence(resv);
   273		if (fence) {
   274			fence = dma_fence_get_rcu(fence);
   275			if (!fence || read_seqcount_retry(&resv->seq, seq)) {
   276				/* Concurrent modify detected, force re-check */
   277				dma_fence_put(fence);
   278				rcu_read_unlock();
   279				goto retry;
   280	
   281			}
   282	
   283			r = dma_fence_add_callback(fence, &dcb->cb, dma_buf_poll_cb);
 > 284			dma_fence_put(fence_excl);
   285			if (!r) {
   286				/* Callback queued */
   287				events = 0;
   288				goto out;
   289			}
   290		}
   291	
   292		/* No callback queued, wake up any additional waiters. */
   293		dma_buf_poll_cb(NULL, &dcb->cb);
   294	
   295	out:
   296		rcu_read_unlock();
   297		return events;
   298	}
   299	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33433 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH] dma-buf: fix and rework dma_buf_poll
Date: Thu, 17 Jun 2021 17:38:03 +0800	[thread overview]
Message-ID: <202106171734.Lqiu3CQO-lkp@intel.com> (raw)
In-Reply-To: <20210615112117.32838-1-christian.koenig@amd.com>

[-- Attachment #1: Type: text/plain, Size: 5111 bytes --]

Hi "Christian,

I love your patch! Perhaps something to improve:

[auto build test WARNING on next-20210616]
[cannot apply to tegra-drm/drm/tegra/for-next linus/master v5.13-rc6 v5.13-rc5 v5.13-rc4 v5.13-rc6]
[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/20210617-103036
base:    c7d4c1fd91ab4a6d2620497921a9c6bf54650ab8
config: s390-randconfig-r022-20210617 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 64720f57bea6a6bf033feef4a5751ab9c0c3b401)
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 s390 cross compiling tool for clang build
        # apt-get install binutils-s390x-linux-gnu
        # https://github.com/0day-ci/linux/commit/dfa9f2ec4c082b73e644e2c565e58e2291f94463
        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/20210617-103036
        git checkout dfa9f2ec4c082b73e644e2c565e58e2291f94463
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390 

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

All warnings (new ones prefixed by >>):

>> drivers/dma-buf/dma-buf.c:284:17: warning: variable 'fence_excl' is uninitialized when used here [-Wuninitialized]
                   dma_fence_put(fence_excl);
                                 ^~~~~~~~~~
   drivers/dma-buf/dma-buf.c:213:30: note: initialize the variable 'fence_excl' to silence this warning
           struct dma_fence *fence_excl;
                                       ^
                                        = NULL
   1 warning generated.


vim +/fence_excl +284 drivers/dma-buf/dma-buf.c

   206	
   207	static __poll_t dma_buf_poll(struct file *file, poll_table *poll)
   208	{
   209		struct dma_buf_poll_cb_t *dcb;
   210		struct dma_buf *dmabuf;
   211		struct dma_resv *resv;
   212		struct dma_resv_list *fobj;
   213		struct dma_fence *fence_excl;
   214		unsigned shared_count, seq;
   215		struct dma_fence *fence;
   216		__poll_t events;
   217		int r, i;
   218	
   219		dmabuf = file->private_data;
   220		if (!dmabuf || !dmabuf->resv)
   221			return EPOLLERR;
   222	
   223		resv = dmabuf->resv;
   224	
   225		poll_wait(file, &dmabuf->poll, poll);
   226	
   227		events = poll_requested_events(poll) & (EPOLLIN | EPOLLOUT);
   228		if (!events)
   229			return 0;
   230	
   231		dcb = events & EPOLLOUT ? &dmabuf->cb_out : &dmabuf->cb_in;
   232	
   233		/* Only queue a new one if we are not still waiting for the old one */
   234		spin_lock_irq(&dmabuf->poll.lock);
   235		if (dcb->active)
   236			events = 0;
   237		else
   238			dcb->active = events;
   239		spin_unlock_irq(&dmabuf->poll.lock);
   240		if (!events)
   241			return 0;
   242	
   243	retry:
   244		seq = read_seqcount_begin(&resv->seq);
   245		rcu_read_lock();
   246	
   247		fobj = rcu_dereference(resv->fence);
   248		if (fobj && events & EPOLLOUT)
   249			shared_count = fobj->shared_count;
   250		else
   251			shared_count = 0;
   252	
   253		for (i = 0; i < shared_count; ++i) {
   254			fence = rcu_dereference(fobj->shared[i]);
   255			fence = dma_fence_get_rcu(fence);
   256			if (!fence || read_seqcount_retry(&resv->seq, seq)) {
   257				/* Concurrent modify detected, force re-check */
   258				dma_fence_put(fence);
   259				rcu_read_unlock();
   260				goto retry;
   261			}
   262	
   263			r = dma_fence_add_callback(fence, &dcb->cb, dma_buf_poll_cb);
   264			dma_fence_put(fence);
   265			if (!r) {
   266				/* Callback queued */
   267				events = 0;
   268				goto out;
   269			}
   270		}
   271	
   272		fence = dma_resv_excl_fence(resv);
   273		if (fence) {
   274			fence = dma_fence_get_rcu(fence);
   275			if (!fence || read_seqcount_retry(&resv->seq, seq)) {
   276				/* Concurrent modify detected, force re-check */
   277				dma_fence_put(fence);
   278				rcu_read_unlock();
   279				goto retry;
   280	
   281			}
   282	
   283			r = dma_fence_add_callback(fence, &dcb->cb, dma_buf_poll_cb);
 > 284			dma_fence_put(fence_excl);
   285			if (!r) {
   286				/* Callback queued */
   287				events = 0;
   288				goto out;
   289			}
   290		}
   291	
   292		/* No callback queued, wake up any additional waiters. */
   293		dma_buf_poll_cb(NULL, &dcb->cb);
   294	
   295	out:
   296		rcu_read_unlock();
   297		return events;
   298	}
   299	

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33433 bytes --]

  parent reply	other threads:[~2021-06-17  9:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-15 11:21 [PATCH] dma-buf: fix and rework dma_buf_poll Christian König
2021-06-17  9:29 ` kernel test robot
2021-06-17  9:29   ` kernel test robot
2021-06-17  9:38 ` kernel test robot [this message]
2021-06-17  9:38   ` kernel test robot
2021-06-17 17:34 ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202106171734.Lqiu3CQO-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jason@jlekstrand.net \
    --cc=kbuild-all@lists.01.org \
    --cc=sumit.semwal@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.