[PATCH 3/3] drm/ttm: add transparent huge page support for DMA allocations

kbuild test robot lkp at intel.com
Fri Jul 14 00:32:49 UTC 2017


Hi Christian,

[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.12 next-20170713]
[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/Christian-K-nig/drm-ttm-add-support-for-different-pool-sizes/20170714-075329
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: i386-randconfig-x013-201728 (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=i386 

All warnings (new ones prefixed by >>):

   drivers/gpu//drm/ttm/ttm_page_alloc_dma.c: In function 'ttm_dma_pool_init':
>> drivers/gpu//drm/ttm/ttm_page_alloc_dma.c:636:5: warning: "CONFIG_TRANSPARENT_HUGEPAGE" is not defined [-Wundef]
    #if CONFIG_TRANSPARENT_HUGEPAGE
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu//drm/ttm/ttm_page_alloc_dma.c: In function 'ttm_dma_populate':
   drivers/gpu//drm/ttm/ttm_page_alloc_dma.c:943:5: warning: "CONFIG_TRANSPARENT_HUGEPAGE" is not defined [-Wundef]
    #if CONFIG_TRANSPARENT_HUGEPAGE
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu//drm/ttm/ttm_page_alloc_dma.c: In function 'ttm_dma_unpopulate':
   drivers/gpu//drm/ttm/ttm_page_alloc_dma.c:1036:5: warning: "CONFIG_TRANSPARENT_HUGEPAGE" is not defined [-Wundef]
    #if CONFIG_TRANSPARENT_HUGEPAGE
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/CONFIG_TRANSPARENT_HUGEPAGE +636 drivers/gpu//drm/ttm/ttm_page_alloc_dma.c

   593	
   594	static struct dma_pool *ttm_dma_pool_init(struct device *dev, gfp_t flags,
   595						  enum pool_type type)
   596	{
   597		const char *n[] = {"wc", "uc", "cached", " dma32", "huge"};
   598		enum pool_type t[] = {IS_WC, IS_UC, IS_CACHED, IS_DMA32, IS_HUGE};
   599		struct device_pools *sec_pool = NULL;
   600		struct dma_pool *pool = NULL, **ptr;
   601		unsigned i;
   602		int ret = -ENODEV;
   603		char *p;
   604	
   605		if (!dev)
   606			return NULL;
   607	
   608		ptr = devres_alloc(ttm_dma_pool_release, sizeof(*ptr), GFP_KERNEL);
   609		if (!ptr)
   610			return NULL;
   611	
   612		ret = -ENOMEM;
   613	
   614		pool = kmalloc_node(sizeof(struct dma_pool), GFP_KERNEL,
   615				    dev_to_node(dev));
   616		if (!pool)
   617			goto err_mem;
   618	
   619		sec_pool = kmalloc_node(sizeof(struct device_pools), GFP_KERNEL,
   620					dev_to_node(dev));
   621		if (!sec_pool)
   622			goto err_mem;
   623	
   624		INIT_LIST_HEAD(&sec_pool->pools);
   625		sec_pool->dev = dev;
   626		sec_pool->pool =  pool;
   627	
   628		INIT_LIST_HEAD(&pool->free_list);
   629		INIT_LIST_HEAD(&pool->pools);
   630		spin_lock_init(&pool->lock);
   631		pool->dev = dev;
   632		pool->npages_free = pool->npages_in_use = 0;
   633		pool->nfrees = 0;
   634		pool->gfp_flags = flags;
   635		if (type & IS_HUGE)
 > 636	#if CONFIG_TRANSPARENT_HUGEPAGE
   637			pool->size = HPAGE_PMD_SIZE;
   638	#else
   639			BUG();
   640	#endif
   641		else
   642			pool->size = PAGE_SIZE;
   643		pool->type = type;
   644		pool->nrefills = 0;
   645		p = pool->name;
   646		for (i = 0; i < ARRAY_SIZE(t); i++) {
   647			if (type & t[i]) {
   648				p += snprintf(p, sizeof(pool->name) - (p - pool->name),
   649					      "%s", n[i]);
   650			}
   651		}
   652		*p = 0;
   653		/* We copy the name for pr_ calls b/c when dma_pool_destroy is called
   654		 * - the kobj->name has already been deallocated.*/
   655		snprintf(pool->dev_name, sizeof(pool->dev_name), "%s %s",
   656			 dev_driver_string(dev), dev_name(dev));
   657		mutex_lock(&_manager->lock);
   658		/* You can get the dma_pool from either the global: */
   659		list_add(&sec_pool->pools, &_manager->pools);
   660		_manager->npools++;
   661		/* or from 'struct device': */
   662		list_add(&pool->pools, &dev->dma_pools);
   663		mutex_unlock(&_manager->lock);
   664	
   665		*ptr = pool;
   666		devres_add(dev, ptr);
   667	
   668		return pool;
   669	err_mem:
   670		devres_free(ptr);
   671		kfree(sec_pool);
   672		kfree(pool);
   673		return ERR_PTR(ret);
   674	}
   675	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 24243 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20170714/9d564b53/attachment-0001.gz>


More information about the dri-devel mailing list