All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: "Paul Cercueil" <paul@crapouillou.net>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Vinod Koul" <vkoul@kernel.org>,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	"Christian König" <christian.koenig@amd.com>
Cc: oe-kbuild-all@lists.linux.dev, Jonathan Corbet <corbet@lwn.net>,
	Nuno Sa <nuno.sa@analog.com>,
	linux-iio@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org,
	linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linaro-mm-sig@lists.linaro.org,
	Paul Cercueil <paul@crapouillou.net>
Subject: Re: [PATCH v11 3/7] iio: core: Add new DMABUF interface infrastructure
Date: Wed, 19 Jun 2024 11:15:53 +0800	[thread overview]
Message-ID: <202406191014.9JAzwRV6-lkp@intel.com> (raw)
In-Reply-To: <20240618100302.72886-4-paul@crapouillou.net>

Hi Paul,

kernel test robot noticed the following build errors:

[auto build test ERROR on jic23-iio/togreg]
[also build test ERROR on vkoul-dmaengine/next linus/master v6.10-rc4 next-20240618]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Paul-Cercueil/dmaengine-Add-API-function-dmaengine_prep_peripheral_dma_vec/20240618-180602
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link:    https://lore.kernel.org/r/20240618100302.72886-4-paul%40crapouillou.net
patch subject: [PATCH v11 3/7] iio: core: Add new DMABUF interface infrastructure
config: x86_64-randconfig-161-20240619 (https://download.01.org/0day-ci/archive/20240619/202406191014.9JAzwRV6-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240619/202406191014.9JAzwRV6-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406191014.9JAzwRV6-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/iio/industrialio-buffer.c:1715:3: error: cannot jump from this goto statement to its label
    1715 |                 goto err_dmabuf_unmap_attachment;
         |                 ^
   drivers/iio/industrialio-buffer.c:1720:2: note: jump bypasses initialization of variable with __attribute__((cleanup))
    1720 |         guard(mutex)(&buffer->dmabufs_mutex);
         |         ^
   include/linux/cleanup.h:164:15: note: expanded from macro 'guard'
     164 |         CLASS(_name, __UNIQUE_ID(guard))
         |                      ^
   include/linux/compiler.h:189:29: note: expanded from macro '__UNIQUE_ID'
     189 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
         |                             ^
   include/linux/compiler_types.h:84:22: note: expanded from macro '__PASTE'
      84 | #define __PASTE(a,b) ___PASTE(a,b)
         |                      ^
   include/linux/compiler_types.h:83:23: note: expanded from macro '___PASTE'
      83 | #define ___PASTE(a,b) a##b
         |                       ^
   <scratch space>:126:1: note: expanded from here
     126 | __UNIQUE_ID_guard696
         | ^
   drivers/iio/industrialio-buffer.c:1704:3: error: cannot jump from this goto statement to its label
    1704 |                 goto err_resv_unlock;
         |                 ^
   drivers/iio/industrialio-buffer.c:1720:2: note: jump bypasses initialization of variable with __attribute__((cleanup))
    1720 |         guard(mutex)(&buffer->dmabufs_mutex);
         |         ^
   include/linux/cleanup.h:164:15: note: expanded from macro 'guard'
     164 |         CLASS(_name, __UNIQUE_ID(guard))
         |                      ^
   include/linux/compiler.h:189:29: note: expanded from macro '__UNIQUE_ID'
     189 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
         |                             ^
   include/linux/compiler_types.h:84:22: note: expanded from macro '__PASTE'
      84 | #define __PASTE(a,b) ___PASTE(a,b)
         |                      ^
   include/linux/compiler_types.h:83:23: note: expanded from macro '___PASTE'
      83 | #define ___PASTE(a,b) a##b
         |                       ^
   <scratch space>:126:1: note: expanded from here
     126 | __UNIQUE_ID_guard696
         | ^
   drivers/iio/industrialio-buffer.c:1695:3: error: cannot jump from this goto statement to its label
    1695 |                 goto err_dmabuf_detach;
         |                 ^
   drivers/iio/industrialio-buffer.c:1720:2: note: jump bypasses initialization of variable with __attribute__((cleanup))
    1720 |         guard(mutex)(&buffer->dmabufs_mutex);
         |         ^
   include/linux/cleanup.h:164:15: note: expanded from macro 'guard'
     164 |         CLASS(_name, __UNIQUE_ID(guard))
         |                      ^
   include/linux/compiler.h:189:29: note: expanded from macro '__UNIQUE_ID'
     189 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
         |                             ^
   include/linux/compiler_types.h:84:22: note: expanded from macro '__PASTE'
      84 | #define __PASTE(a,b) ___PASTE(a,b)
         |                      ^
   include/linux/compiler_types.h:83:23: note: expanded from macro '___PASTE'
      83 | #define ___PASTE(a,b) a##b
         |                       ^
   <scratch space>:126:1: note: expanded from here
     126 | __UNIQUE_ID_guard696
         | ^
   drivers/iio/industrialio-buffer.c:1690:3: error: cannot jump from this goto statement to its label
    1690 |                 goto err_dmabuf_put;
         |                 ^
   drivers/iio/industrialio-buffer.c:1720:2: note: jump bypasses initialization of variable with __attribute__((cleanup))
    1720 |         guard(mutex)(&buffer->dmabufs_mutex);
         |         ^
   include/linux/cleanup.h:164:15: note: expanded from macro 'guard'
     164 |         CLASS(_name, __UNIQUE_ID(guard))
         |                      ^
   include/linux/compiler.h:189:29: note: expanded from macro '__UNIQUE_ID'
     189 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
         |                             ^
   include/linux/compiler_types.h:84:22: note: expanded from macro '__PASTE'
      84 | #define __PASTE(a,b) ___PASTE(a,b)
         |                      ^
   include/linux/compiler_types.h:83:23: note: expanded from macro '___PASTE'
      83 | #define ___PASTE(a,b) a##b
         |                       ^
   <scratch space>:126:1: note: expanded from here
     126 | __UNIQUE_ID_guard696
         | ^
   drivers/iio/industrialio-buffer.c:1684:3: error: cannot jump from this goto statement to its label
    1684 |                 goto err_free_priv;
         |                 ^
   drivers/iio/industrialio-buffer.c:1720:2: note: jump bypasses initialization of variable with __attribute__((cleanup))
    1720 |         guard(mutex)(&buffer->dmabufs_mutex);
         |         ^
   include/linux/cleanup.h:164:15: note: expanded from macro 'guard'
     164 |         CLASS(_name, __UNIQUE_ID(guard))
         |                      ^
   include/linux/compiler.h:189:29: note: expanded from macro '__UNIQUE_ID'
     189 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
         |                             ^
   include/linux/compiler_types.h:84:22: note: expanded from macro '__PASTE'
      84 | #define __PASTE(a,b) ___PASTE(a,b)
         |                      ^
   include/linux/compiler_types.h:83:23: note: expanded from macro '___PASTE'
      83 | #define ___PASTE(a,b) a##b


vim +1715 drivers/iio/industrialio-buffer.c

  1655	
  1656	static int iio_buffer_attach_dmabuf(struct iio_dev_buffer_pair *ib,
  1657					    int __user *user_fd, bool nonblock)
  1658	{
  1659		struct iio_dev *indio_dev = ib->indio_dev;
  1660		struct iio_buffer *buffer = ib->buffer;
  1661		struct dma_buf_attachment *attach;
  1662		struct iio_dmabuf_priv *priv, *each;
  1663		struct dma_buf *dmabuf;
  1664		int err, fd;
  1665	
  1666		if (!buffer->access->attach_dmabuf
  1667		    || !buffer->access->detach_dmabuf
  1668		    || !buffer->access->enqueue_dmabuf)
  1669			return -EPERM;
  1670	
  1671		if (copy_from_user(&fd, user_fd, sizeof(fd)))
  1672			return -EFAULT;
  1673	
  1674		priv = kzalloc(sizeof(*priv), GFP_KERNEL);
  1675		if (!priv)
  1676			return -ENOMEM;
  1677	
  1678		spin_lock_init(&priv->lock);
  1679		priv->context = dma_fence_context_alloc(1);
  1680	
  1681		dmabuf = dma_buf_get(fd);
  1682		if (IS_ERR(dmabuf)) {
  1683			err = PTR_ERR(dmabuf);
  1684			goto err_free_priv;
  1685		}
  1686	
  1687		attach = dma_buf_attach(dmabuf, indio_dev->dev.parent);
  1688		if (IS_ERR(attach)) {
  1689			err = PTR_ERR(attach);
  1690			goto err_dmabuf_put;
  1691		}
  1692	
  1693		err = iio_dma_resv_lock(dmabuf, nonblock);
  1694		if (err)
  1695			goto err_dmabuf_detach;
  1696	
  1697		priv->dir = buffer->direction == IIO_BUFFER_DIRECTION_IN
  1698			? DMA_FROM_DEVICE : DMA_TO_DEVICE;
  1699	
  1700		priv->sgt = dma_buf_map_attachment(attach, priv->dir);
  1701		if (IS_ERR(priv->sgt)) {
  1702			err = PTR_ERR(priv->sgt);
  1703			dev_err(&indio_dev->dev, "Unable to map attachment: %d\n", err);
  1704			goto err_resv_unlock;
  1705		}
  1706	
  1707		kref_init(&priv->ref);
  1708		priv->buffer = buffer;
  1709		priv->attach = attach;
  1710		attach->importer_priv = priv;
  1711	
  1712		priv->block = buffer->access->attach_dmabuf(buffer, attach);
  1713		if (IS_ERR(priv->block)) {
  1714			err = PTR_ERR(priv->block);
> 1715			goto err_dmabuf_unmap_attachment;
  1716		}
  1717	
  1718		dma_resv_unlock(dmabuf->resv);
  1719	
  1720		guard(mutex)(&buffer->dmabufs_mutex);
  1721	
  1722		/*
  1723		 * Check whether we already have an attachment for this driver/DMABUF
  1724		 * combo. If we do, refuse to attach.
  1725		 */
  1726		list_for_each_entry(each, &buffer->dmabufs, entry) {
  1727			if (each->attach->dev == indio_dev->dev.parent
  1728			    && each->attach->dmabuf == dmabuf) {
  1729				/*
  1730				 * We unlocked the reservation object, so going through
  1731				 * the cleanup code would mean re-locking it first.
  1732				 * At this stage it is simpler to free the attachment
  1733				 * using iio_buffer_dma_put().
  1734				 */
  1735				iio_buffer_dmabuf_put(attach);
  1736				return -EBUSY;
  1737			}
  1738		}
  1739	
  1740		/* Otherwise, add the new attachment to our dmabufs list. */
  1741		list_add(&priv->entry, &buffer->dmabufs);
  1742	
  1743		return 0;
  1744	
  1745	err_dmabuf_unmap_attachment:
  1746		dma_buf_unmap_attachment(attach, priv->sgt, priv->dir);
  1747	err_resv_unlock:
  1748		dma_resv_unlock(dmabuf->resv);
  1749	err_dmabuf_detach:
  1750		dma_buf_detach(dmabuf, attach);
  1751	err_dmabuf_put:
  1752		dma_buf_put(dmabuf);
  1753	err_free_priv:
  1754		kfree(priv);
  1755	
  1756		return err;
  1757	}
  1758	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

  reply	other threads:[~2024-06-19  3:16 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-18 10:02 [PATCH v11 0/7] iio: new DMABUF based API v11 Paul Cercueil
2024-06-18 10:02 ` [PATCH v11 1/7] dmaengine: Add API function dmaengine_prep_peripheral_dma_vec() Paul Cercueil
2024-06-18 10:02 ` [PATCH v11 2/7] dmaengine: dma-axi-dmac: Implement device_prep_peripheral_dma_vec Paul Cercueil
2024-06-18 10:02 ` [PATCH v11 3/7] iio: core: Add new DMABUF interface infrastructure Paul Cercueil
2024-06-19  3:15   ` kernel test robot [this message]
2024-06-19  5:57     ` Nuno Sá
2024-06-19 10:03     ` [v11 " Markus Elfring
2024-06-19 10:09       ` Paul Cercueil
2024-06-19 11:13         ` Markus Elfring
2024-06-19 11:30           ` Paul Cercueil
2024-06-19 11:56             ` Markus Elfring
2024-06-19 12:21               ` Paul Cercueil
2024-06-19 12:42                 ` Nuno Sá
2024-06-20 10:45     ` Markus Elfring
2024-06-20 16:09       ` Vinod Koul
2024-06-20 17:05         ` Lee Jones
2024-06-21  7:09           ` Vinod Koul
2024-06-21  7:18             ` Nuno Sá
2024-06-21  7:36               ` Markus Elfring
2024-06-21  7:44               ` Lee Jones
2024-06-21  7:27             ` Markus Elfring
2024-06-21  7:51               ` Lee Jones
2024-06-21  8:10                 ` [RFC] Patch review challenges Markus Elfring
2024-06-21  8:21                   ` Lee Jones
2024-06-19 11:43   ` [PATCH v11 3/7] iio: core: Add new DMABUF interface infrastructure Markus Elfring
2024-06-19 12:16     ` Paul Cercueil
2024-06-19 13:28       ` Markus Elfring
2024-06-18 10:02 ` [PATCH v11 4/7] iio: buffer-dma: Enable support for DMABUFs Paul Cercueil
2024-06-18 10:03 ` [PATCH v11 5/7] iio: buffer-dmaengine: Support new DMABUF based userspace API Paul Cercueil
2024-06-18 10:03 ` [PATCH v11 6/7] Documentation: iio: Document high-speed DMABUF based API Paul Cercueil
2024-06-19 12:22   ` Bagas Sanjaya
2024-06-18 10:03 ` [PATCH v11 7/7] Documentation: dmaengine: Document new dma_vec API Paul Cercueil
2024-06-19 12:34   ` Bagas Sanjaya

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=202406191014.9JAzwRV6-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=christian.koenig@amd.com \
    --cc=corbet@lwn.net \
    --cc=dmaengine@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=paul@crapouillou.net \
    --cc=sumit.semwal@linaro.org \
    --cc=vkoul@kernel.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.