linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Shuah Khan <shuahkh@osg.samsung.com>
Cc: kbuild-all@01.org, linux@armlinux.org.uk,
	gregkh@linuxfoundation.org, pawel@osciak.com,
	m.szyprowski@samsung.com, kyungmin.park@samsung.com,
	mchehab@kernel.org, Shuah Khan <shuahkh@osg.samsung.com>,
	will.deacon@arm.com, Robin.Murphy@arm.com, jroedel@suse.de,
	bart.vanassche@sandisk.com, gregory.clement@free-electrons.com,
	acourbot@nvidia.com, festevam@gmail.com, krzk@kernel.org,
	niklas.soderlund+renesas@ragnatech.se, sricharan@codeaurora.org,
	dledford@redhat.com, vinod.koul@intel.com,
	andrew.smirnov@gmail.com, mauricfo@linux.vnet.ibm.com,
	alexander.h.duyck@intel.com, sagi@grimberg.me,
	ming.l@ssi.samsung.com, martin.petersen@oracle.com,
	javier@dowhile0.org, javier@osg.samsung.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org
Subject: Re: [PATCH] arm: dma: fix sharing of coherent DMA memory without struct page
Date: Thu, 6 Apr 2017 12:11:30 +0800	[thread overview]
Message-ID: <201704061246.KPIrU4rl%fengguang.wu@intel.com> (raw)
In-Reply-To: <20170405160242.14195-1-shuahkh@osg.samsung.com>

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

Hi Shuah,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.11-rc5]
[cannot apply to next-20170405]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Shuah-Khan/arm-dma-fix-sharing-of-coherent-DMA-memory-without-struct-page/20170406-114717
config: x86_64-randconfig-x009-201714 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/file.h:8:0,
                    from include/linux/dma-buf.h:27,
                    from drivers/media/v4l2-core/videobuf2-dma-contig.c:13:
   drivers/media/v4l2-core/videobuf2-dma-contig.c: In function 'vb2_dc_alloc':
>> drivers/media/v4l2-core/videobuf2-dma-contig.c:164:6: error: implicit declaration of function 'dma_check_dev_coherent' [-Werror=implicit-function-declaration]
     if (dma_check_dev_coherent(dev, buf->dma_addr, buf->cookie))
         ^
   include/linux/compiler.h:160:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> drivers/media/v4l2-core/videobuf2-dma-contig.c:164:2: note: in expansion of macro 'if'
     if (dma_check_dev_coherent(dev, buf->dma_addr, buf->cookie))
     ^~
   cc1: some warnings being treated as errors

vim +/dma_check_dev_coherent +164 drivers/media/v4l2-core/videobuf2-dma-contig.c

     7	 *
     8	 * This program is free software; you can redistribute it and/or modify
     9	 * it under the terms of the GNU General Public License as published by
    10	 * the Free Software Foundation.
    11	 */
    12	
  > 13	#include <linux/dma-buf.h>
    14	#include <linux/module.h>
    15	#include <linux/scatterlist.h>
    16	#include <linux/sched.h>
    17	#include <linux/slab.h>
    18	#include <linux/dma-mapping.h>
    19	
    20	#include <media/videobuf2-v4l2.h>
    21	#include <media/videobuf2-dma-contig.h>
    22	#include <media/videobuf2-memops.h>
    23	
    24	struct vb2_dc_buf {
    25		struct device			*dev;
    26		void				*vaddr;
    27		unsigned long			size;
    28		void				*cookie;
    29		dma_addr_t			dma_addr;
    30		unsigned long			attrs;
    31		enum dma_data_direction		dma_dir;
    32		struct sg_table			*dma_sgt;
    33		struct frame_vector		*vec;
    34	
    35		/* MMAP related */
    36		struct vb2_vmarea_handler	handler;
    37		atomic_t			refcount;
    38		struct sg_table			*sgt_base;
    39	
    40		/* DMABUF related */
    41		struct dma_buf_attachment	*db_attach;
    42	};
    43	
    44	/*********************************************/
    45	/*        scatterlist table functions        */
    46	/*********************************************/
    47	
    48	static unsigned long vb2_dc_get_contiguous_size(struct sg_table *sgt)
    49	{
    50		struct scatterlist *s;
    51		dma_addr_t expected = sg_dma_address(sgt->sgl);
    52		unsigned int i;
    53		unsigned long size = 0;
    54	
    55		for_each_sg(sgt->sgl, s, sgt->nents, i) {
    56			if (sg_dma_address(s) != expected)
    57				break;
    58			expected = sg_dma_address(s) + sg_dma_len(s);
    59			size += sg_dma_len(s);
    60		}
    61		return size;
    62	}
    63	
    64	/*********************************************/
    65	/*         callbacks for all buffers         */
    66	/*********************************************/
    67	
    68	static void *vb2_dc_cookie(void *buf_priv)
    69	{
    70		struct vb2_dc_buf *buf = buf_priv;
    71	
    72		return &buf->dma_addr;
    73	}
    74	
    75	static void *vb2_dc_vaddr(void *buf_priv)
    76	{
    77		struct vb2_dc_buf *buf = buf_priv;
    78	
    79		if (!buf->vaddr && buf->db_attach)
    80			buf->vaddr = dma_buf_vmap(buf->db_attach->dmabuf);
    81	
    82		return buf->vaddr;
    83	}
    84	
    85	static unsigned int vb2_dc_num_users(void *buf_priv)
    86	{
    87		struct vb2_dc_buf *buf = buf_priv;
    88	
    89		return atomic_read(&buf->refcount);
    90	}
    91	
    92	static void vb2_dc_prepare(void *buf_priv)
    93	{
    94		struct vb2_dc_buf *buf = buf_priv;
    95		struct sg_table *sgt = buf->dma_sgt;
    96	
    97		/* DMABUF exporter will flush the cache for us */
    98		if (!sgt || buf->db_attach)
    99			return;
   100	
   101		dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->orig_nents,
   102				       buf->dma_dir);
   103	}
   104	
   105	static void vb2_dc_finish(void *buf_priv)
   106	{
   107		struct vb2_dc_buf *buf = buf_priv;
   108		struct sg_table *sgt = buf->dma_sgt;
   109	
   110		/* DMABUF exporter will flush the cache for us */
   111		if (!sgt || buf->db_attach)
   112			return;
   113	
   114		dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir);
   115	}
   116	
   117	/*********************************************/
   118	/*        callbacks for MMAP buffers         */
   119	/*********************************************/
   120	
   121	static void vb2_dc_put(void *buf_priv)
   122	{
   123		struct vb2_dc_buf *buf = buf_priv;
   124	
   125		if (!atomic_dec_and_test(&buf->refcount))
   126			return;
   127	
   128		if (buf->sgt_base) {
   129			sg_free_table(buf->sgt_base);
   130			kfree(buf->sgt_base);
   131		}
   132		dma_free_attrs(buf->dev, buf->size, buf->cookie, buf->dma_addr,
   133			       buf->attrs);
   134		put_device(buf->dev);
   135		kfree(buf);
   136	}
   137	
   138	static void *vb2_dc_alloc(struct device *dev, unsigned long attrs,
   139				  unsigned long size, enum dma_data_direction dma_dir,
   140				  gfp_t gfp_flags)
   141	{
   142		struct vb2_dc_buf *buf;
   143	
   144		if (WARN_ON(!dev))
   145			return ERR_PTR(-EINVAL);
   146	
   147		buf = kzalloc(sizeof *buf, GFP_KERNEL);
   148		if (!buf)
   149			return ERR_PTR(-ENOMEM);
   150	
   151		if (attrs)
   152			buf->attrs = attrs;
   153		buf->cookie = dma_alloc_attrs(dev, size, &buf->dma_addr,
   154						GFP_KERNEL | gfp_flags, buf->attrs);
   155		if (!buf->cookie) {
   156			dev_err(dev, "dma_alloc_coherent of size %ld failed\n", size);
   157			kfree(buf);
   158			return ERR_PTR(-ENOMEM);
   159		}
   160	
   161		if ((buf->attrs & DMA_ATTR_NO_KERNEL_MAPPING) == 0)
   162			buf->vaddr = buf->cookie;
   163	
 > 164		if (dma_check_dev_coherent(dev, buf->dma_addr, buf->cookie))
   165			buf->attrs |= DMA_ATTR_DEV_COHERENT_NOPAGE;
   166	
   167		/* Prevent the device from being released while the buffer is used */

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

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

  parent reply	other threads:[~2017-04-06  4:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170405160251epcas4p14cc5d5f6064c84b133b9e280ac987a93@epcas4p1.samsung.com>
2017-04-05 16:02 ` [PATCH] arm: dma: fix sharing of coherent DMA memory without struct page Shuah Khan
2017-04-05 23:14   ` Russell King - ARM Linux
2017-04-10 14:52     ` Shuah Khan
2017-04-06  4:11   ` kbuild test robot [this message]
2017-04-06 12:01   ` Marek Szyprowski
2017-04-10 22:50     ` Shuah Khan
2017-04-14  7:56       ` Marek Szyprowski
2017-04-14  9:46         ` Russell King - ARM Linux
2017-04-17  1:10           ` Shuah Khan
2017-04-17 10:22             ` Russell King - ARM Linux
2017-04-19 23:38           ` Shuah Khan

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=201704061246.KPIrU4rl%fengguang.wu@intel.com \
    --to=lkp@intel.com \
    --cc=Robin.Murphy@arm.com \
    --cc=acourbot@nvidia.com \
    --cc=alexander.h.duyck@intel.com \
    --cc=andrew.smirnov@gmail.com \
    --cc=bart.vanassche@sandisk.com \
    --cc=dledford@redhat.com \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gregory.clement@free-electrons.com \
    --cc=javier@dowhile0.org \
    --cc=javier@osg.samsung.com \
    --cc=jroedel@suse.de \
    --cc=kbuild-all@01.org \
    --cc=krzk@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=m.szyprowski@samsung.com \
    --cc=martin.petersen@oracle.com \
    --cc=mauricfo@linux.vnet.ibm.com \
    --cc=mchehab@kernel.org \
    --cc=ming.l@ssi.samsung.com \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=pawel@osciak.com \
    --cc=sagi@grimberg.me \
    --cc=shuahkh@osg.samsung.com \
    --cc=sricharan@codeaurora.org \
    --cc=vinod.koul@intel.com \
    --cc=will.deacon@arm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).