[renesas-drivers:master 12/38] drivers/gpu//drm/i915/i915_gem.c:2562:19: error: called object 'totalram_pages' is not a function or function pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git master
head:   bb4f21f1ae06af0da93077b493a550d472bf18ac
commit: e4da156335d4cc6a6da53aa74409fbfe12c9d684 [12/38] Merge remote-tracking branch 'drm/drm-next' into renesas-drivers
config: i386-defconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        git checkout e4da156335d4cc6a6da53aa74409fbfe12c9d684
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/gpu//drm/i915/i915_gem.c: In function 'i915_gem_object_get_pages_gtt':
>> drivers/gpu//drm/i915/i915_gem.c:2562:19: error: called object 'totalram_pages' is not a function or function pointer
     if (page_count > totalram_pages())
                      ^~~~~~~~~~~~~~
   In file included from include/linux/shmem_fs.h:6:0,
                    from drivers/gpu//drm/i915/i915_drv.h:47,
                    from drivers/gpu//drm/i915/i915_gem.c:31:
   include/linux/swap.h:313:22: note: declared here
    extern unsigned long totalram_pages;
                         ^~~~~~~~~~~~~~

vim +/totalram_pages +2562 drivers/gpu//drm/i915/i915_gem.c

  2532	
  2533	static int i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj)
  2534	{
  2535		struct drm_i915_private *dev_priv = to_i915(obj->base.dev);
  2536		const unsigned long page_count = obj->base.size / PAGE_SIZE;
  2537		unsigned long i;
  2538		struct address_space *mapping;
  2539		struct sg_table *st;
  2540		struct scatterlist *sg;
  2541		struct sgt_iter sgt_iter;
  2542		struct page *page;
  2543		unsigned long last_pfn = 0;	/* suppress gcc warning */
  2544		unsigned int max_segment = i915_sg_segment_size();
  2545		unsigned int sg_page_sizes;
  2546		struct pagevec pvec;
  2547		gfp_t noreclaim;
  2548		int ret;
  2549	
  2550		/*
  2551		 * Assert that the object is not currently in any GPU domain. As it
  2552		 * wasn't in the GTT, there shouldn't be any way it could have been in
  2553		 * a GPU cache
  2554		 */
  2555		GEM_BUG_ON(obj->read_domains & I915_GEM_GPU_DOMAINS);
  2556		GEM_BUG_ON(obj->write_domain & I915_GEM_GPU_DOMAINS);
  2557	
  2558		/*
  2559		 * If there's no chance of allocating enough pages for the whole
  2560		 * object, bail early.
  2561		 */
> 2562		if (page_count > totalram_pages())
  2563			return -ENOMEM;
  2564	
  2565		st = kmalloc(sizeof(*st), GFP_KERNEL);
  2566		if (st == NULL)
  2567			return -ENOMEM;
  2568	
  2569	rebuild_st:
  2570		if (sg_alloc_table(st, page_count, GFP_KERNEL)) {
  2571			kfree(st);
  2572			return -ENOMEM;
  2573		}
  2574	
  2575		/*
  2576		 * Get the list of pages out of our struct file.  They'll be pinned
  2577		 * at this point until we release them.
  2578		 *
  2579		 * Fail silently without starting the shrinker
  2580		 */
  2581		mapping = obj->base.filp->f_mapping;
  2582		mapping_set_unevictable(mapping);
  2583		noreclaim = mapping_gfp_constraint(mapping, ~__GFP_RECLAIM);
  2584		noreclaim |= __GFP_NORETRY | __GFP_NOWARN;
  2585	
  2586		sg = st->sgl;
  2587		st->nents = 0;
  2588		sg_page_sizes = 0;
  2589		for (i = 0; i < page_count; i++) {
  2590			const unsigned int shrink[] = {
  2591				I915_SHRINK_BOUND | I915_SHRINK_UNBOUND | I915_SHRINK_PURGEABLE,
  2592				0,
  2593			}, *s = shrink;
  2594			gfp_t gfp = noreclaim;
  2595	
  2596			do {
  2597				cond_resched();
  2598				page = shmem_read_mapping_page_gfp(mapping, i, gfp);
  2599				if (likely(!IS_ERR(page)))
  2600					break;
  2601	
  2602				if (!*s) {
  2603					ret = PTR_ERR(page);
  2604					goto err_sg;
  2605				}
  2606	
  2607				i915_gem_shrink(dev_priv, 2 * page_count, NULL, *s++);
  2608	
  2609				/*
  2610				 * We've tried hard to allocate the memory by reaping
  2611				 * our own buffer, now let the real VM do its job and
  2612				 * go down in flames if truly OOM.
  2613				 *
  2614				 * However, since graphics tend to be disposable,
  2615				 * defer the oom here by reporting the ENOMEM back
  2616				 * to userspace.
  2617				 */
  2618				if (!*s) {
  2619					/* reclaim and warn, but no oom */
  2620					gfp = mapping_gfp_mask(mapping);
  2621	
  2622					/*
  2623					 * Our bo are always dirty and so we require
  2624					 * kswapd to reclaim our pages (direct reclaim
  2625					 * does not effectively begin pageout of our
  2626					 * buffers on its own). However, direct reclaim
  2627					 * only waits for kswapd when under allocation
  2628					 * congestion. So as a result __GFP_RECLAIM is
  2629					 * unreliable and fails to actually reclaim our
  2630					 * dirty pages -- unless you try over and over
  2631					 * again with !__GFP_NORETRY. However, we still
  2632					 * want to fail this allocation rather than
  2633					 * trigger the out-of-memory killer and for
  2634					 * this we want __GFP_RETRY_MAYFAIL.
  2635					 */
  2636					gfp |= __GFP_RETRY_MAYFAIL;
  2637				}
  2638			} while (1);
  2639	
  2640			if (!i ||
  2641			    sg->length >= max_segment ||
  2642			    page_to_pfn(page) != last_pfn + 1) {
  2643				if (i) {
  2644					sg_page_sizes |= sg->length;
  2645					sg = sg_next(sg);
  2646				}
  2647				st->nents++;
  2648				sg_set_page(sg, page, PAGE_SIZE, 0);
  2649			} else {
  2650				sg->length += PAGE_SIZE;
  2651			}
  2652			last_pfn = page_to_pfn(page);
  2653	
  2654			/* Check that the i965g/gm workaround works. */
  2655			WARN_ON((gfp & __GFP_DMA32) && (last_pfn >= 0x00100000UL));
  2656		}
  2657		if (sg) { /* loop terminated early; short sg table */
  2658			sg_page_sizes |= sg->length;
  2659			sg_mark_end(sg);
  2660		}
  2661	
  2662		/* Trim unused sg entries to avoid wasting memory. */
  2663		i915_sg_trim(st);
  2664	
  2665		ret = i915_gem_gtt_prepare_pages(obj, st);
  2666		if (ret) {
  2667			/*
  2668			 * DMA remapping failed? One possible cause is that
  2669			 * it could not reserve enough large entries, asking
  2670			 * for PAGE_SIZE chunks instead may be helpful.
  2671			 */
  2672			if (max_segment > PAGE_SIZE) {
  2673				for_each_sgt_page(page, sgt_iter, st)
  2674					put_page(page);
  2675				sg_free_table(st);
  2676	
  2677				max_segment = PAGE_SIZE;
  2678				goto rebuild_st;
  2679			} else {
  2680				dev_warn(&dev_priv->drm.pdev->dev,
  2681					 "Failed to DMA remap %lu pages\n",
  2682					 page_count);
  2683				goto err_pages;
  2684			}
  2685		}
  2686	
  2687		if (i915_gem_object_needs_bit17_swizzle(obj))
  2688			i915_gem_object_do_bit_17_swizzle(obj, st);
  2689	
  2690		__i915_gem_object_set_pages(obj, st, sg_page_sizes);
  2691	
  2692		return 0;
  2693	
  2694	err_sg:
  2695		sg_mark_end(sg);
  2696	err_pages:
  2697		mapping_clear_unevictable(mapping);
  2698		pagevec_init(&pvec);
  2699		for_each_sgt_page(page, sgt_iter, st) {
  2700			if (!pagevec_add(&pvec, page))
  2701				check_release_pagevec(&pvec);
  2702		}
  2703		if (pagevec_count(&pvec))
  2704			check_release_pagevec(&pvec);
  2705		sg_free_table(st);
  2706		kfree(st);
  2707	
  2708		/*
  2709		 * shmemfs first checks if there is enough memory to allocate the page
  2710		 * and reports ENOSPC should there be insufficient, along with the usual
  2711		 * ENOMEM for a genuine allocation failure.
  2712		 *
  2713		 * We use ENOSPC in our driver to mean that we have run out of aperture
  2714		 * space and so want to translate the error from shmemfs back to our
  2715		 * usual understanding of ENOMEM.
  2716		 */
  2717		if (ret == -ENOSPC)
  2718			ret = -ENOMEM;
  2719	
  2720		return ret;
  2721	}
  2722	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux