All of lore.kernel.org
 help / color / mirror / Atom feed
* [mlankhorst:locking-rework 30/30] drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:94:1: error: conflicting types for 'i915_gem_shrink'
@ 2020-07-11  5:49 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2020-07-11  5:49 UTC (permalink / raw)
  To: kbuild-all

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

tree:   git://people.freedesktop.org/~mlankhorst/linux locking-rework
head:   df835d9d9fee30c2d4584242c64c8b32eae0d0a4
commit: df835d9d9fee30c2d4584242c64c8b32eae0d0a4 [30/30] how to implement eviction
config: x86_64-fedora-25 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
reproduce (this is a W=1 build):
        git checkout df835d9d9fee30c2d4584242c64c8b32eae0d0a4
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

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

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:94:1: error: conflicting types for 'i915_gem_shrink'
      94 | i915_gem_shrink(struct i915_gem_ww_ctx *ww,
         | ^~~~~~~~~~~~~~~
   In file included from drivers/gpu/drm/i915/i915_drv.h:77,
                    from drivers/gpu/drm/i915/display/intel_display_types.h:45,
                    from drivers/gpu/drm/i915/i915_trace.h:11,
                    from drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:16:
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.h:15:15: note: previous declaration of 'i915_gem_shrink' was here
      15 | unsigned long i915_gem_shrink(struct drm_i915_private *i915,
         |               ^~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c: In function 'i915_gem_shrink':
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:213:27: error: 'struct <anonymous>' has no member named 'lock'; did you mean 'blocks'?
     213 |     mutex_unlock(&obj->mm.lock);
         |                           ^~~~
         |                           blocks
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c: In function 'i915_gem_shrinker_scan':
>> drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:304:26: error: passing argument 1 of 'i915_gem_shrink' from incompatible pointer type [-Werror=incompatible-pointer-types]
     304 |  freed = i915_gem_shrink(i915,
         |                          ^~~~
         |                          |
         |                          struct drm_i915_private *
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:94:41: note: expected 'struct i915_gem_ww_ctx *' but argument is of type 'struct drm_i915_private *'
      94 | i915_gem_shrink(struct i915_gem_ww_ctx *ww,
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~^~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:305:7: warning: passing argument 2 of 'i915_gem_shrink' makes pointer from integer without a cast [-Wint-conversion]
     305 |     sc->nr_to_scan,
         |     ~~^~~~~~~~~~~~
         |       |
         |       long unsigned int
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:95:28: note: expected 'struct drm_i915_private *' but argument is of type 'long unsigned int'
      95 |   struct drm_i915_private *i915,
         |   ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:306:5: warning: passing argument 3 of 'i915_gem_shrink' makes integer from pointer without a cast [-Wint-conversion]
     306 |     &sc->nr_scanned,
         |     ^~~~~~~~~~~~~~~
         |     |
         |     long unsigned int *
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:96:17: note: expected 'long unsigned int' but argument is of type 'long unsigned int *'
      96 |   unsigned long target,
         |   ~~~~~~~~~~~~~~^~~~~~
   In file included from include/linux/bits.h:6,
                    from include/linux/bitops.h:5,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/rculist.h:10,
                    from include/linux/sched/signal.h:5,
                    from include/linux/oom.h:6,
                    from drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:7:
   include/vdso/bits.h:7:19: warning: passing argument 4 of 'i915_gem_shrink' makes pointer from integer without a cast [-Wint-conversion]
       7 | #define BIT(nr)   (UL(1) << (nr))
         |                   ^
         |                   |
         |                   long unsigned int
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.h:20:27: note: in expansion of macro 'BIT'
      20 | #define I915_SHRINK_BOUND BIT(1)
         |                           ^~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:307:5: note: in expansion of macro 'I915_SHRINK_BOUND'
     307 |     I915_SHRINK_BOUND |
         |     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:97:18: note: expected 'long unsigned int *' but argument is of type 'long unsigned int'
      97 |   unsigned long *nr_scanned,
         |   ~~~~~~~~~~~~~~~^~~~~~~~~~
>> drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:304:10: error: too few arguments to function 'i915_gem_shrink'
     304 |  freed = i915_gem_shrink(i915,
         |          ^~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:94:1: note: declared here
      94 | i915_gem_shrink(struct i915_gem_ww_ctx *ww,
         | ^~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:313:29: error: passing argument 1 of 'i915_gem_shrink' from incompatible pointer type [-Werror=incompatible-pointer-types]
     313 |    freed += i915_gem_shrink(i915,
         |                             ^~~~
         |                             |
         |                             struct drm_i915_private *
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:94:41: note: expected 'struct i915_gem_ww_ctx *' but argument is of type 'struct drm_i915_private *'
      94 | i915_gem_shrink(struct i915_gem_ww_ctx *ww,
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~^~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:314:23: warning: passing argument 2 of 'i915_gem_shrink' makes pointer from integer without a cast [-Wint-conversion]
     314 |        sc->nr_to_scan - sc->nr_scanned,
         |        ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
         |                       |
         |                       long unsigned int
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:95:28: note: expected 'struct drm_i915_private *' but argument is of type 'long unsigned int'
      95 |   struct drm_i915_private *i915,
         |   ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:315:8: warning: passing argument 3 of 'i915_gem_shrink' makes integer from pointer without a cast [-Wint-conversion]
     315 |        &sc->nr_scanned,
         |        ^~~~~~~~~~~~~~~
         |        |
         |        long unsigned int *
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:96:17: note: expected 'long unsigned int' but argument is of type 'long unsigned int *'
      96 |   unsigned long target,
         |   ~~~~~~~~~~~~~~^~~~~~
   In file included from include/linux/bits.h:6,
                    from include/linux/bitops.h:5,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/rculist.h:10,
                    from include/linux/sched/signal.h:5,
                    from include/linux/oom.h:6,
                    from drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:7:
   include/vdso/bits.h:7:19: warning: passing argument 4 of 'i915_gem_shrink' makes pointer from integer without a cast [-Wint-conversion]
       7 | #define BIT(nr)   (UL(1) << (nr))
         |                   ^
         |                   |
         |                   long unsigned int
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.h:21:28: note: in expansion of macro 'BIT'
      21 | #define I915_SHRINK_ACTIVE BIT(2)
         |                            ^~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:316:8: note: in expansion of macro 'I915_SHRINK_ACTIVE'
     316 |        I915_SHRINK_ACTIVE |
         |        ^~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:97:18: note: expected 'long unsigned int *' but argument is of type 'long unsigned int'
      97 |   unsigned long *nr_scanned,
         |   ~~~~~~~~~~~~~~~^~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:313:13: error: too few arguments to function 'i915_gem_shrink'
     313 |    freed += i915_gem_shrink(i915,
         |             ^~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:94:1: note: declared here
      94 | i915_gem_shrink(struct i915_gem_ww_ctx *ww,
         | ^~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c: In function 'i915_gem_shrinker_oom':
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:338:34: error: passing argument 1 of 'i915_gem_shrink' from incompatible pointer type [-Werror=incompatible-pointer-types]
     338 |   freed_pages += i915_gem_shrink(i915, -1UL, NULL,
         |                                  ^~~~
         |                                  |
         |                                  struct drm_i915_private *
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:94:41: note: expected 'struct i915_gem_ww_ctx *' but argument is of type 'struct drm_i915_private *'
      94 | i915_gem_shrink(struct i915_gem_ww_ctx *ww,
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~^~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:338:40: warning: passing argument 2 of 'i915_gem_shrink' makes pointer from integer without a cast [-Wint-conversion]
     338 |   freed_pages += i915_gem_shrink(i915, -1UL, NULL,
         |                                        ^~~~
         |                                        |
         |                                        long unsigned int
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:95:28: note: expected 'struct drm_i915_private *' but argument is of type 'long unsigned int'
      95 |   struct drm_i915_private *i915,
         |   ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
   In file included from include/uapi/linux/posix_types.h:5,
                    from include/uapi/linux/types.h:14,
                    from include/linux/types.h:6,
                    from include/linux/list.h:5,
                    from include/linux/rculist.h:10,
                    from include/linux/sched/signal.h:5,
                    from include/linux/oom.h:6,
                    from drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:7:
   include/linux/stddef.h:8:14: warning: passing argument 3 of 'i915_gem_shrink' makes integer from pointer without a cast [-Wint-conversion]
       8 | #define NULL ((void *)0)
         |              ^~~~~~~~~~~
         |              |
         |              void *
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:338:46: note: in expansion of macro 'NULL'
     338 |   freed_pages += i915_gem_shrink(i915, -1UL, NULL,
         |                                              ^~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:96:17: note: expected 'long unsigned int' but argument is of type 'void *'
      96 |   unsigned long target,
         |   ~~~~~~~~~~~~~~^~~~~~
   In file included from include/linux/bits.h:6,
                    from include/linux/bitops.h:5,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/rculist.h:10,
                    from include/linux/sched/signal.h:5,
                    from include/linux/oom.h:6,

vim +/i915_gem_shrink +94 drivers/gpu/drm/i915/gem/i915_gem_shrinker.c

    67	
    68	/**
    69	 * i915_gem_shrink - Shrink buffer object caches
    70	 * @i915: i915 device
    71	 * @target: amount of memory to make available, in pages
    72	 * @nr_scanned: optional output for number of pages scanned (incremental)
    73	 * @shrink: control flags for selecting cache types
    74	 *
    75	 * This function is the main interface to the shrinker. It will try to release
    76	 * up to @target pages of main memory backing storage from buffer objects.
    77	 * Selection of the specific caches can be done with @flags. This is e.g. useful
    78	 * when purgeable objects should be removed from caches preferentially.
    79	 *
    80	 * Note that it's not guaranteed that released amount is actually available as
    81	 * free system memory - the pages might still be in-used to due to other reasons
    82	 * (like cpu mmaps) or the mm core has reused them before we could grab them.
    83	 * Therefore code that needs to explicitly shrink buffer objects caches (e.g. to
    84	 * avoid deadlocks in memory reclaim) must fall back to i915_gem_shrink_all().
    85	 *
    86	 * Also note that any kind of pinning (both per-vma address space pins and
    87	 * backing storage pins@the buffer object level) result in the shrinker code
    88	 * having to skip the object.
    89	 *
    90	 * Returns:
    91	 * The number of pages of backing storage actually released.
    92	 */
    93	unsigned long
  > 94	i915_gem_shrink(struct i915_gem_ww_ctx *ww,
    95			struct drm_i915_private *i915,
    96			unsigned long target,
    97			unsigned long *nr_scanned,
    98			unsigned int shrink)
    99	{
   100		const struct {
   101			struct list_head *list;
   102			unsigned int bit;
   103		} phases[] = {
   104			{ &i915->mm.purge_list, ~0u },
   105			{
   106				&i915->mm.shrink_list,
   107				I915_SHRINK_BOUND | I915_SHRINK_UNBOUND
   108			},
   109			{ NULL, 0 },
   110		}, *phase;
   111		intel_wakeref_t wakeref = 0;
   112		unsigned long count = 0;
   113		unsigned long scanned = 0;
   114		int err;
   115	
   116		/*
   117		 * When shrinking the active list, we should also consider active
   118		 * contexts. Active contexts are pinned until they are retired, and
   119		 * so can not be simply unbound to retire and unpin their pages. To
   120		 * shrink the contexts, we must wait until the gpu is idle and
   121		 * completed its switch to the kernel context. In short, we do
   122		 * not have a good mechanism for idling a specific context.
   123		 */
   124	
   125		trace_i915_gem_shrink(i915, target, shrink);
   126	
   127		/*
   128		 * Unbinding of objects will require HW access; Let us not wake the
   129		 * device just to recover a little memory. If absolutely necessary,
   130		 * we will force the wake during oom-notifier.
   131		 */
   132		if (shrink & I915_SHRINK_BOUND) {
   133			wakeref = intel_runtime_pm_get_if_in_use(&i915->runtime_pm);
   134			if (!wakeref)
   135				shrink &= ~I915_SHRINK_BOUND;
   136		}
   137	
   138		/*
   139		 * As we may completely rewrite the (un)bound list whilst unbinding
   140		 * (due to retiring requests) we have to strictly process only
   141		 * one element of the list at the time, and recheck the list
   142		 * on every iteration.
   143		 *
   144		 * In particular, we must hold a reference whilst removing the
   145		 * object as we may end up waiting for and/or retiring the objects.
   146		 * This might release the final reference (held by the active list)
   147		 * and result in the object being freed from under us. This is
   148		 * similar to the precautions the eviction code must take whilst
   149		 * removing objects.
   150		 *
   151		 * Also note that although these lists do not hold a reference to
   152		 * the object we can safely grab one here: The final object
   153		 * unreferencing and the bound_list are both protected by the
   154		 * dev->struct_mutex and so we won't ever be able to observe an
   155		 * object on the bound_list with a reference count equals 0.
   156		 */
   157		for (phase = phases; phase->list; phase++) {
   158			struct list_head still_in_list;
   159			struct drm_i915_gem_object *obj;
   160			unsigned long flags;
   161	
   162			if ((shrink & phase->bit) == 0)
   163				continue;
   164	
   165			INIT_LIST_HEAD(&still_in_list);
   166	
   167			/*
   168			 * We serialize our access to unreferenced objects through
   169			 * the use of the struct_mutex. While the objects are not
   170			 * yet freed (due to RCU then a workqueue) we still want
   171			 * to be able to shrink their pages, so they remain on
   172			 * the unbound/bound list until actually freed.
   173			 */
   174			spin_lock_irqsave(&i915->mm.obj_lock, flags);
   175			while (count < target &&
   176			       (obj = list_first_entry_or_null(phase->list,
   177							       typeof(*obj),
   178							       mm.link))) {
   179				list_move_tail(&obj->mm.link, &still_in_list);
   180	
   181				if (shrink & I915_SHRINK_VMAPS &&
   182				    !is_vmalloc_addr(obj->mm.mapping))
   183					continue;
   184	
   185				if (!(shrink & I915_SHRINK_ACTIVE) &&
   186				    i915_gem_object_is_framebuffer(obj))
   187					continue;
   188	
   189				if (!can_release_pages(obj))
   190					continue;
   191	
   192				if (!kref_get_unless_zero(&obj->base.refcount))
   193					continue;
   194	
   195				spin_unlock_irqrestore(&i915->mm.obj_lock, flags);
   196	
   197				err = 0;
   198				if (unsafe_drop_pages(obj, shrink)) {
   199					/* May arrive from get_pages on another bo */
   200					if (!ww) {
   201						if (!i915_gem_object_trylock(obj))
   202							goto skip;
   203					} else {
   204						err = i915_gem_object_lock(obj, ww);
   205						if (err)
   206							goto skip;
   207					}
   208	
   209					if (!i915_gem_object_has_pages(obj)) {
   210						try_to_writeback(obj, shrink);
   211						count += obj->base.size >> PAGE_SHIFT;
   212					}
 > 213					mutex_unlock(&obj->mm.lock);
   214				}
   215	
   216				scanned += obj->base.size >> PAGE_SHIFT;
   217	skip:
   218				i915_gem_object_put(obj);
   219	
   220				spin_lock_irqsave(&i915->mm.obj_lock, flags);
   221				if (err)
   222					break;
   223			}
   224			list_splice_tail(&still_in_list, phase->list);
   225			spin_unlock_irqrestore(&i915->mm.obj_lock, flags);
   226			if (err)
   227				return err;
   228		}
   229	
   230		if (shrink & I915_SHRINK_BOUND)
   231			intel_runtime_pm_put(&i915->runtime_pm, wakeref);
   232	
   233		if (nr_scanned)
   234			*nr_scanned += scanned;
   235		return count;
   236	}
   237	

---
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: 52126 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [mlankhorst:locking-rework 30/30] drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:94:1: error: conflicting types for 'i915_gem_shrink'
@ 2020-07-13  1:53 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2020-07-13  1:53 UTC (permalink / raw)
  To: kbuild-all

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

tree:   git://people.freedesktop.org/~mlankhorst/linux locking-rework
head:   df835d9d9fee30c2d4584242c64c8b32eae0d0a4
commit: df835d9d9fee30c2d4584242c64c8b32eae0d0a4 [30/30] how to implement eviction
config: x86_64-randconfig-c002-20200710 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0

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

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

   drivers/gpu/drm/i915/gem/i915_gem_lmem.c: In function 'i915_gem_object_get_pages_phys':
>> drivers/gpu/drm/i915/gem/i915_gem_lmem.c:23:1: warning: no return statement in function returning non-void [-Wreturn-type]
      23 | }
         | ^
   At top level:
   drivers/gpu/drm/i915/gem/i915_gem_lmem.c:12:12: warning: 'i915_gem_object_get_pages_phys' defined but not used [-Wunused-function]
      12 | static int i915_gem_object_get_pages_phys(struct drm_i915_gem_object *obj,
         |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
>> drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:94:1: error: conflicting types for 'i915_gem_shrink'
      94 | i915_gem_shrink(struct i915_gem_ww_ctx *ww,
         | ^~~~~~~~~~~~~~~
   In file included from drivers/gpu/drm/i915/i915_drv.h:77,
                    from drivers/gpu/drm/i915/display/intel_display_types.h:45,
                    from drivers/gpu/drm/i915/i915_trace.h:11,
                    from drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:16:
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.h:15:15: note: previous declaration of 'i915_gem_shrink' was here
      15 | unsigned long i915_gem_shrink(struct drm_i915_private *i915,
         |               ^~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c: In function 'i915_gem_shrink':
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:213:27: error: 'struct <anonymous>' has no member named 'lock'; did you mean 'blocks'?
     213 |     mutex_unlock(&obj->mm.lock);
         |                           ^~~~
         |                           blocks
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c: In function 'i915_gem_shrinker_scan':
>> drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:304:26: error: passing argument 1 of 'i915_gem_shrink' from incompatible pointer type [-Werror=incompatible-pointer-types]
     304 |  freed = i915_gem_shrink(i915,
         |                          ^~~~
         |                          |
         |                          struct drm_i915_private *
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:94:41: note: expected 'struct i915_gem_ww_ctx *' but argument is of type 'struct drm_i915_private *'
      94 | i915_gem_shrink(struct i915_gem_ww_ctx *ww,
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~^~
>> drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:305:7: warning: passing argument 2 of 'i915_gem_shrink' makes pointer from integer without a cast [-Wint-conversion]
     305 |     sc->nr_to_scan,
         |     ~~^~~~~~~~~~~~
         |       |
         |       long unsigned int
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:95:28: note: expected 'struct drm_i915_private *' but argument is of type 'long unsigned int'
      95 |   struct drm_i915_private *i915,
         |   ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
>> drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:306:5: warning: passing argument 3 of 'i915_gem_shrink' makes integer from pointer without a cast [-Wint-conversion]
     306 |     &sc->nr_scanned,
         |     ^~~~~~~~~~~~~~~
         |     |
         |     long unsigned int *
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:96:17: note: expected 'long unsigned int' but argument is of type 'long unsigned int *'
      96 |   unsigned long target,
         |   ~~~~~~~~~~~~~~^~~~~~
   In file included from include/linux/bits.h:6,
                    from include/linux/bitops.h:5,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/rculist.h:10,
                    from include/linux/sched/signal.h:5,
                    from include/linux/oom.h:6,
                    from drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:7:
>> include/vdso/bits.h:7:19: warning: passing argument 4 of 'i915_gem_shrink' makes pointer from integer without a cast [-Wint-conversion]
       7 | #define BIT(nr)   (UL(1) << (nr))
         |                   ^
         |                   |
         |                   long unsigned int
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.h:20:27: note: in expansion of macro 'BIT'
      20 | #define I915_SHRINK_BOUND BIT(1)
         |                           ^~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:307:5: note: in expansion of macro 'I915_SHRINK_BOUND'
     307 |     I915_SHRINK_BOUND |
         |     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:97:18: note: expected 'long unsigned int *' but argument is of type 'long unsigned int'
      97 |   unsigned long *nr_scanned,
         |   ~~~~~~~~~~~~~~~^~~~~~~~~~
>> drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:304:10: error: too few arguments to function 'i915_gem_shrink'
     304 |  freed = i915_gem_shrink(i915,
         |          ^~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:94:1: note: declared here
      94 | i915_gem_shrink(struct i915_gem_ww_ctx *ww,
         | ^~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:313:29: error: passing argument 1 of 'i915_gem_shrink' from incompatible pointer type [-Werror=incompatible-pointer-types]
     313 |    freed += i915_gem_shrink(i915,
         |                             ^~~~
         |                             |
         |                             struct drm_i915_private *
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:94:41: note: expected 'struct i915_gem_ww_ctx *' but argument is of type 'struct drm_i915_private *'
      94 | i915_gem_shrink(struct i915_gem_ww_ctx *ww,
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~^~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:314:23: warning: passing argument 2 of 'i915_gem_shrink' makes pointer from integer without a cast [-Wint-conversion]
     314 |        sc->nr_to_scan - sc->nr_scanned,
         |        ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
         |                       |
         |                       long unsigned int
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:95:28: note: expected 'struct drm_i915_private *' but argument is of type 'long unsigned int'
      95 |   struct drm_i915_private *i915,
         |   ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:315:8: warning: passing argument 3 of 'i915_gem_shrink' makes integer from pointer without a cast [-Wint-conversion]
     315 |        &sc->nr_scanned,
         |        ^~~~~~~~~~~~~~~
         |        |
         |        long unsigned int *
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:96:17: note: expected 'long unsigned int' but argument is of type 'long unsigned int *'
      96 |   unsigned long target,
         |   ~~~~~~~~~~~~~~^~~~~~
   In file included from include/linux/bits.h:6,
                    from include/linux/bitops.h:5,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/rculist.h:10,
                    from include/linux/sched/signal.h:5,
                    from include/linux/oom.h:6,
                    from drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:7:
>> include/vdso/bits.h:7:19: warning: passing argument 4 of 'i915_gem_shrink' makes pointer from integer without a cast [-Wint-conversion]
       7 | #define BIT(nr)   (UL(1) << (nr))
         |                   ^
         |                   |
         |                   long unsigned int
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.h:21:28: note: in expansion of macro 'BIT'
      21 | #define I915_SHRINK_ACTIVE BIT(2)
         |                            ^~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:316:8: note: in expansion of macro 'I915_SHRINK_ACTIVE'
     316 |        I915_SHRINK_ACTIVE |
         |        ^~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:97:18: note: expected 'long unsigned int *' but argument is of type 'long unsigned int'
      97 |   unsigned long *nr_scanned,
         |   ~~~~~~~~~~~~~~~^~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:313:13: error: too few arguments to function 'i915_gem_shrink'
     313 |    freed += i915_gem_shrink(i915,
         |             ^~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:94:1: note: declared here
      94 | i915_gem_shrink(struct i915_gem_ww_ctx *ww,
         | ^~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c: In function 'i915_gem_shrinker_oom':
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:338:34: error: passing argument 1 of 'i915_gem_shrink' from incompatible pointer type [-Werror=incompatible-pointer-types]
     338 |   freed_pages += i915_gem_shrink(i915, -1UL, NULL,
         |                                  ^~~~
         |                                  |
         |                                  struct drm_i915_private *
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:94:41: note: expected 'struct i915_gem_ww_ctx *' but argument is of type 'struct drm_i915_private *'
      94 | i915_gem_shrink(struct i915_gem_ww_ctx *ww,
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~^~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:338:40: warning: passing argument 2 of 'i915_gem_shrink' makes pointer from integer without a cast [-Wint-conversion]
     338 |   freed_pages += i915_gem_shrink(i915, -1UL, NULL,
         |                                        ^~~~
         |                                        |
         |                                        long unsigned int
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:95:28: note: expected 'struct drm_i915_private *' but argument is of type 'long unsigned int'
      95 |   struct drm_i915_private *i915,
         |   ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
   In file included from include/uapi/linux/posix_types.h:5,
                    from include/uapi/linux/types.h:14,
                    from include/linux/types.h:6,
                    from include/linux/list.h:5,
                    from include/linux/rculist.h:10,
                    from include/linux/sched/signal.h:5,
                    from include/linux/oom.h:6,
                    from drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:7:
>> include/linux/stddef.h:8:14: warning: passing argument 3 of 'i915_gem_shrink' makes integer from pointer without a cast [-Wint-conversion]
       8 | #define NULL ((void *)0)
         |              ^~~~~~~~~~~
         |              |
         |              void *
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:338:46: note: in expansion of macro 'NULL'
     338 |   freed_pages += i915_gem_shrink(i915, -1UL, NULL,
         |                                              ^~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:96:17: note: expected 'long unsigned int' but argument is of type 'void *'
      96 |   unsigned long target,
         |   ~~~~~~~~~~~~~~^~~~~~
   In file included from include/linux/bits.h:6,
                    from include/linux/bitops.h:5,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/rculist.h:10,
                    from include/linux/sched/signal.h:5,
                    from include/linux/oom.h:6,
                    from drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:7:
>> include/vdso/bits.h:7:19: warning: passing argument 4 of 'i915_gem_shrink' makes pointer from integer without a cast [-Wint-conversion]
       7 | #define BIT(nr)   (UL(1) << (nr))
         |                   ^
         |                   |
         |                   long unsigned int
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.h:20:27: note: in expansion of macro 'BIT'
      20 | #define I915_SHRINK_BOUND BIT(1)
         |                           ^~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:339:13: note: in expansion of macro 'I915_SHRINK_BOUND'
     339 |             I915_SHRINK_BOUND |
         |             ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:97:18: note: expected 'long unsigned int *' but argument is of type 'long unsigned int'
      97 |   unsigned long *nr_scanned,
         |   ~~~~~~~~~~~~~~~^~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:338:18: error: too few arguments to function 'i915_gem_shrink'
     338 |   freed_pages += i915_gem_shrink(i915, -1UL, NULL,
         |                  ^~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:94:1: note: declared here
      94 | i915_gem_shrink(struct i915_gem_ww_ctx *ww,
         | ^~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c: In function 'i915_gem_shrinker_vmap':
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:376:34: error: passing argument 1 of 'i915_gem_shrink' from incompatible pointer type [-Werror=incompatible-pointer-types]
     376 |   freed_pages += i915_gem_shrink(i915, -1UL, NULL,
         |                                  ^~~~
         |                                  |
         |                                  struct drm_i915_private *
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:94:41: note: expected 'struct i915_gem_ww_ctx *' but argument is of type 'struct drm_i915_private *'
      94 | i915_gem_shrink(struct i915_gem_ww_ctx *ww,
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~^~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:376:40: warning: passing argument 2 of 'i915_gem_shrink' makes pointer from integer without a cast [-Wint-conversion]
     376 |   freed_pages += i915_gem_shrink(i915, -1UL, NULL,
         |                                        ^~~~
         |                                        |
         |                                        long unsigned int
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:95:28: note: expected 'struct drm_i915_private *' but argument is of type 'long unsigned int'
      95 |   struct drm_i915_private *i915,
         |   ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
   In file included from include/uapi/linux/posix_types.h:5,
                    from include/uapi/linux/types.h:14,
                    from include/linux/types.h:6,
                    from include/linux/list.h:5,
                    from include/linux/rculist.h:10,
                    from include/linux/sched/signal.h:5,
                    from include/linux/oom.h:6,
                    from drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:7:
>> include/linux/stddef.h:8:14: warning: passing argument 3 of 'i915_gem_shrink' makes integer from pointer without a cast [-Wint-conversion]
       8 | #define NULL ((void *)0)
         |              ^~~~~~~~~~~
         |              |
         |              void *
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:376:46: note: in expansion of macro 'NULL'
     376 |   freed_pages += i915_gem_shrink(i915, -1UL, NULL,
         |                                              ^~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:96:17: note: expected 'long unsigned int' but argument is of type 'void *'
      96 |   unsigned long target,
         |   ~~~~~~~~~~~~~~^~~~~~
   In file included from include/linux/bits.h:6,
                    from include/linux/bitops.h:5,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/rculist.h:10,
                    from include/linux/sched/signal.h:5,
                    from include/linux/oom.h:6,
                    from drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:7:
>> include/vdso/bits.h:7:19: warning: passing argument 4 of 'i915_gem_shrink' makes pointer from integer without a cast [-Wint-conversion]
       7 | #define BIT(nr)   (UL(1) << (nr))
         |                   ^
         |                   |
         |                   long unsigned int
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.h:20:27: note: in expansion of macro 'BIT'
      20 | #define I915_SHRINK_BOUND BIT(1)
         |                           ^~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:377:13: note: in expansion of macro 'I915_SHRINK_BOUND'
     377 |             I915_SHRINK_BOUND |
         |             ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:97:18: note: expected 'long unsigned int *' but argument is of type 'long unsigned int'
      97 |   unsigned long *nr_scanned,
         |   ~~~~~~~~~~~~~~~^~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:376:18: error: too few arguments to function 'i915_gem_shrink'
     376 |   freed_pages += i915_gem_shrink(i915, -1UL, NULL,
         |                  ^~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:94:1: note: declared here
      94 | i915_gem_shrink(struct i915_gem_ww_ctx *ww,
         | ^~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/i915_gem_shrink +94 drivers/gpu/drm/i915/gem/i915_gem_shrinker.c

    67	
    68	/**
    69	 * i915_gem_shrink - Shrink buffer object caches
    70	 * @i915: i915 device
    71	 * @target: amount of memory to make available, in pages
    72	 * @nr_scanned: optional output for number of pages scanned (incremental)
    73	 * @shrink: control flags for selecting cache types
    74	 *
    75	 * This function is the main interface to the shrinker. It will try to release
    76	 * up to @target pages of main memory backing storage from buffer objects.
    77	 * Selection of the specific caches can be done with @flags. This is e.g. useful
    78	 * when purgeable objects should be removed from caches preferentially.
    79	 *
    80	 * Note that it's not guaranteed that released amount is actually available as
    81	 * free system memory - the pages might still be in-used to due to other reasons
    82	 * (like cpu mmaps) or the mm core has reused them before we could grab them.
    83	 * Therefore code that needs to explicitly shrink buffer objects caches (e.g. to
    84	 * avoid deadlocks in memory reclaim) must fall back to i915_gem_shrink_all().
    85	 *
    86	 * Also note that any kind of pinning (both per-vma address space pins and
    87	 * backing storage pins@the buffer object level) result in the shrinker code
    88	 * having to skip the object.
    89	 *
    90	 * Returns:
    91	 * The number of pages of backing storage actually released.
    92	 */
    93	unsigned long
  > 94	i915_gem_shrink(struct i915_gem_ww_ctx *ww,
    95			struct drm_i915_private *i915,
    96			unsigned long target,
    97			unsigned long *nr_scanned,
    98			unsigned int shrink)
    99	{
   100		const struct {
   101			struct list_head *list;
   102			unsigned int bit;
   103		} phases[] = {
   104			{ &i915->mm.purge_list, ~0u },
   105			{
   106				&i915->mm.shrink_list,
   107				I915_SHRINK_BOUND | I915_SHRINK_UNBOUND
   108			},
   109			{ NULL, 0 },
   110		}, *phase;
   111		intel_wakeref_t wakeref = 0;
   112		unsigned long count = 0;
   113		unsigned long scanned = 0;
   114		int err;
   115	
   116		/*
   117		 * When shrinking the active list, we should also consider active
   118		 * contexts. Active contexts are pinned until they are retired, and
   119		 * so can not be simply unbound to retire and unpin their pages. To
   120		 * shrink the contexts, we must wait until the gpu is idle and
   121		 * completed its switch to the kernel context. In short, we do
   122		 * not have a good mechanism for idling a specific context.
   123		 */
   124	
   125		trace_i915_gem_shrink(i915, target, shrink);
   126	
   127		/*
   128		 * Unbinding of objects will require HW access; Let us not wake the
   129		 * device just to recover a little memory. If absolutely necessary,
   130		 * we will force the wake during oom-notifier.
   131		 */
   132		if (shrink & I915_SHRINK_BOUND) {
   133			wakeref = intel_runtime_pm_get_if_in_use(&i915->runtime_pm);
   134			if (!wakeref)
   135				shrink &= ~I915_SHRINK_BOUND;
   136		}
   137	
   138		/*
   139		 * As we may completely rewrite the (un)bound list whilst unbinding
   140		 * (due to retiring requests) we have to strictly process only
   141		 * one element of the list at the time, and recheck the list
   142		 * on every iteration.
   143		 *
   144		 * In particular, we must hold a reference whilst removing the
   145		 * object as we may end up waiting for and/or retiring the objects.
   146		 * This might release the final reference (held by the active list)
   147		 * and result in the object being freed from under us. This is
   148		 * similar to the precautions the eviction code must take whilst
   149		 * removing objects.
   150		 *
   151		 * Also note that although these lists do not hold a reference to
   152		 * the object we can safely grab one here: The final object
   153		 * unreferencing and the bound_list are both protected by the
   154		 * dev->struct_mutex and so we won't ever be able to observe an
   155		 * object on the bound_list with a reference count equals 0.
   156		 */
   157		for (phase = phases; phase->list; phase++) {
   158			struct list_head still_in_list;
   159			struct drm_i915_gem_object *obj;
   160			unsigned long flags;
   161	
   162			if ((shrink & phase->bit) == 0)
   163				continue;
   164	
   165			INIT_LIST_HEAD(&still_in_list);
   166	
   167			/*
   168			 * We serialize our access to unreferenced objects through
   169			 * the use of the struct_mutex. While the objects are not
   170			 * yet freed (due to RCU then a workqueue) we still want
   171			 * to be able to shrink their pages, so they remain on
   172			 * the unbound/bound list until actually freed.
   173			 */
   174			spin_lock_irqsave(&i915->mm.obj_lock, flags);
   175			while (count < target &&
   176			       (obj = list_first_entry_or_null(phase->list,
   177							       typeof(*obj),
   178							       mm.link))) {
   179				list_move_tail(&obj->mm.link, &still_in_list);
   180	
   181				if (shrink & I915_SHRINK_VMAPS &&
   182				    !is_vmalloc_addr(obj->mm.mapping))
   183					continue;
   184	
   185				if (!(shrink & I915_SHRINK_ACTIVE) &&
   186				    i915_gem_object_is_framebuffer(obj))
   187					continue;
   188	
   189				if (!can_release_pages(obj))
   190					continue;
   191	
   192				if (!kref_get_unless_zero(&obj->base.refcount))
   193					continue;
   194	
   195				spin_unlock_irqrestore(&i915->mm.obj_lock, flags);
   196	
   197				err = 0;
   198				if (unsafe_drop_pages(obj, shrink)) {
   199					/* May arrive from get_pages on another bo */
   200					if (!ww) {
   201						if (!i915_gem_object_trylock(obj))
   202							goto skip;
   203					} else {
   204						err = i915_gem_object_lock(obj, ww);
   205						if (err)
   206							goto skip;
   207					}
   208	
   209					if (!i915_gem_object_has_pages(obj)) {
   210						try_to_writeback(obj, shrink);
   211						count += obj->base.size >> PAGE_SHIFT;
   212					}
 > 213					mutex_unlock(&obj->mm.lock);
   214				}
   215	
   216				scanned += obj->base.size >> PAGE_SHIFT;
   217	skip:
   218				i915_gem_object_put(obj);
   219	
   220				spin_lock_irqsave(&i915->mm.obj_lock, flags);
   221				if (err)
   222					break;
   223			}
   224			list_splice_tail(&still_in_list, phase->list);
   225			spin_unlock_irqrestore(&i915->mm.obj_lock, flags);
   226			if (err)
   227				return err;
   228		}
   229	
   230		if (shrink & I915_SHRINK_BOUND)
   231			intel_runtime_pm_put(&i915->runtime_pm, wakeref);
   232	
   233		if (nr_scanned)
   234			*nr_scanned += scanned;
   235		return count;
   236	}
   237	

---
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: 38780 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-13  1:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-13  1:53 [mlankhorst:locking-rework 30/30] drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:94:1: error: conflicting types for 'i915_gem_shrink' kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2020-07-11  5:49 kernel test robot

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.