All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 1693/1734] drivers/gpu/drm/i915/gem/i915_gem_mman.c:369:11: error: implicit declaration of function 'i915_gem_evict_vm'; did you mean 'i915_gem_to_ttm'?
@ 2022-01-26 17:10 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-01-26 17:10 UTC (permalink / raw)
  To: Matt Roper; +Cc: kbuild-all, Linux Memory Management List

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   d25ee88530253138d0b20d43511ca5acbda4e9f7
commit: e4217080a60313b0f0e5df5bb169b9f79ceb4694 [1693/1734] Merge branch 'for-linux-next-gt' of git://anongit.freedesktop.org/drm-intel
config: x86_64-rhel-8.3-func (https://download.01.org/0day-ci/archive/20220127/202201270113.DdzBtOf8-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=e4217080a60313b0f0e5df5bb169b9f79ceb4694
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout e4217080a60313b0f0e5df5bb169b9f79ceb4694
        # save the config file to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/gpu/drm/i915/

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

Note: the linux-next/master HEAD d25ee88530253138d0b20d43511ca5acbda4e9f7 builds fine.
      It may have been fixed somewhere.

All errors (new ones prefixed by >>):

   drivers/gpu/drm/i915/gem/i915_gem_mman.c: In function 'vm_fault_gtt':
>> drivers/gpu/drm/i915/gem/i915_gem_mman.c:369:11: error: implicit declaration of function 'i915_gem_evict_vm'; did you mean 'i915_gem_to_ttm'? [-Werror=implicit-function-declaration]
     369 |     ret = i915_gem_evict_vm(&ggtt->vm, &ww);
         |           ^~~~~~~~~~~~~~~~~
         |           i915_gem_to_ttm
   cc1: some warnings being treated as errors


vim +369 drivers/gpu/drm/i915/gem/i915_gem_mman.c

cc662126b4134e Abdiel Janulgue        2019-12-04  288  
cc662126b4134e Abdiel Janulgue        2019-12-04  289  static vm_fault_t vm_fault_gtt(struct vm_fault *vmf)
b414fcd5be0b00 Chris Wilson           2019-05-28  290  {
b414fcd5be0b00 Chris Wilson           2019-05-28  291  #define MIN_CHUNK_PAGES (SZ_1M >> PAGE_SHIFT)
b414fcd5be0b00 Chris Wilson           2019-05-28  292  	struct vm_area_struct *area = vmf->vma;
cc662126b4134e Abdiel Janulgue        2019-12-04  293  	struct i915_mmap_offset *mmo = area->vm_private_data;
cc662126b4134e Abdiel Janulgue        2019-12-04  294  	struct drm_i915_gem_object *obj = mmo->obj;
b414fcd5be0b00 Chris Wilson           2019-05-28  295  	struct drm_device *dev = obj->base.dev;
b414fcd5be0b00 Chris Wilson           2019-05-28  296  	struct drm_i915_private *i915 = to_i915(dev);
d858d5695f3897 Daniele Ceraolo Spurio 2019-06-13  297  	struct intel_runtime_pm *rpm = &i915->runtime_pm;
5c24c9d227e9bb Michał Winiarski       2021-12-19  298  	struct i915_ggtt *ggtt = to_gt(i915)->ggtt;
b414fcd5be0b00 Chris Wilson           2019-05-28  299  	bool write = area->vm_flags & VM_WRITE;
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  300  	struct i915_gem_ww_ctx ww;
b414fcd5be0b00 Chris Wilson           2019-05-28  301  	intel_wakeref_t wakeref;
b414fcd5be0b00 Chris Wilson           2019-05-28  302  	struct i915_vma *vma;
b414fcd5be0b00 Chris Wilson           2019-05-28  303  	pgoff_t page_offset;
b414fcd5be0b00 Chris Wilson           2019-05-28  304  	int srcu;
b414fcd5be0b00 Chris Wilson           2019-05-28  305  	int ret;
b414fcd5be0b00 Chris Wilson           2019-05-28  306  
b414fcd5be0b00 Chris Wilson           2019-05-28  307  	/* We don't use vmf->pgoff since that has the fake offset */
b414fcd5be0b00 Chris Wilson           2019-05-28  308  	page_offset = (vmf->address - area->vm_start) >> PAGE_SHIFT;
b414fcd5be0b00 Chris Wilson           2019-05-28  309  
b414fcd5be0b00 Chris Wilson           2019-05-28  310  	trace_i915_gem_object_fault(obj, page_offset, true, write);
b414fcd5be0b00 Chris Wilson           2019-05-28  311  
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  312  	wakeref = intel_runtime_pm_get(rpm);
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  313  
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  314  	i915_gem_ww_ctx_init(&ww, true);
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  315  retry:
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  316  	ret = i915_gem_object_lock(obj, &ww);
b414fcd5be0b00 Chris Wilson           2019-05-28  317  	if (ret)
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  318  		goto err_rpm;
b414fcd5be0b00 Chris Wilson           2019-05-28  319  
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  320  	/* Sanity check that we allow writing into this object */
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  321  	if (i915_gem_object_is_readonly(obj) && write) {
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  322  		ret = -EFAULT;
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  323  		goto err_rpm;
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  324  	}
b414fcd5be0b00 Chris Wilson           2019-05-28  325  
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  326  	ret = i915_gem_object_pin_pages(obj);
eebab60f224fcf Chris Wilson           2019-09-12  327  	if (ret)
b414fcd5be0b00 Chris Wilson           2019-05-28  328  		goto err_rpm;
b414fcd5be0b00 Chris Wilson           2019-05-28  329  
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  330  	ret = intel_gt_reset_trylock(ggtt->vm.gt, &srcu);
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  331  	if (ret)
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  332  		goto err_pages;
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  333  
b414fcd5be0b00 Chris Wilson           2019-05-28  334  	/* Now pin it into the GTT as needed */
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  335  	vma = i915_gem_object_ggtt_pin_ww(obj, &ww, NULL, 0, 0,
b414fcd5be0b00 Chris Wilson           2019-05-28  336  					  PIN_MAPPABLE |
6846895fde0555 Chris Wilson           2019-08-21  337  					  PIN_NONBLOCK /* NOWARN */ |
ebfdf5cd806b3b Chris Wilson           2019-08-26  338  					  PIN_NOEVICT);
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  339  	if (IS_ERR(vma) && vma != ERR_PTR(-EDEADLK)) {
b414fcd5be0b00 Chris Wilson           2019-05-28  340  		/* Use a partial view if it is bigger than available space */
b414fcd5be0b00 Chris Wilson           2019-05-28  341  		struct i915_ggtt_view view =
b414fcd5be0b00 Chris Wilson           2019-05-28  342  			compute_partial_view(obj, page_offset, MIN_CHUNK_PAGES);
b414fcd5be0b00 Chris Wilson           2019-05-28  343  		unsigned int flags;
b414fcd5be0b00 Chris Wilson           2019-05-28  344  
6846895fde0555 Chris Wilson           2019-08-21  345  		flags = PIN_MAPPABLE | PIN_NOSEARCH;
b414fcd5be0b00 Chris Wilson           2019-05-28  346  		if (view.type == I915_GGTT_VIEW_NORMAL)
b414fcd5be0b00 Chris Wilson           2019-05-28  347  			flags |= PIN_NONBLOCK; /* avoid warnings for pinned */
b414fcd5be0b00 Chris Wilson           2019-05-28  348  
b414fcd5be0b00 Chris Wilson           2019-05-28  349  		/*
b414fcd5be0b00 Chris Wilson           2019-05-28  350  		 * Userspace is now writing through an untracked VMA, abandon
b414fcd5be0b00 Chris Wilson           2019-05-28  351  		 * all hope that the hardware is able to track future writes.
b414fcd5be0b00 Chris Wilson           2019-05-28  352  		 */
b414fcd5be0b00 Chris Wilson           2019-05-28  353  
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  354  		vma = i915_gem_object_ggtt_pin_ww(obj, &ww, &view, 0, 0, flags);
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  355  		if (IS_ERR(vma) && vma != ERR_PTR(-EDEADLK)) {
b414fcd5be0b00 Chris Wilson           2019-05-28  356  			flags = PIN_MAPPABLE;
b414fcd5be0b00 Chris Wilson           2019-05-28  357  			view.type = I915_GGTT_VIEW_PARTIAL;
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  358  			vma = i915_gem_object_ggtt_pin_ww(obj, &ww, &view, 0, 0, flags);
b414fcd5be0b00 Chris Wilson           2019-05-28  359  		}
8f9fb61caed13e Chris Wilson           2019-09-02  360  
e849f7e708600a Maarten Lankhorst      2022-01-14  361  		/*
e849f7e708600a Maarten Lankhorst      2022-01-14  362  		 * The entire mappable GGTT is pinned? Unexpected!
e849f7e708600a Maarten Lankhorst      2022-01-14  363  		 * Try to evict the object we locked too, as normally we skip it
e849f7e708600a Maarten Lankhorst      2022-01-14  364  		 * due to lack of short term pinning inside execbuf.
e849f7e708600a Maarten Lankhorst      2022-01-14  365  		 */
e849f7e708600a Maarten Lankhorst      2022-01-14  366  		if (vma == ERR_PTR(-ENOSPC)) {
e849f7e708600a Maarten Lankhorst      2022-01-14  367  			ret = mutex_lock_interruptible(&ggtt->vm.mutex);
e849f7e708600a Maarten Lankhorst      2022-01-14  368  			if (!ret) {
6945c53bc712cf Maarten Lankhorst      2022-01-17 @369  				ret = i915_gem_evict_vm(&ggtt->vm, &ww);
e849f7e708600a Maarten Lankhorst      2022-01-14  370  				mutex_unlock(&ggtt->vm.mutex);
e849f7e708600a Maarten Lankhorst      2022-01-14  371  			}
e849f7e708600a Maarten Lankhorst      2022-01-14  372  			if (ret)
e849f7e708600a Maarten Lankhorst      2022-01-14  373  				goto err_reset;
e849f7e708600a Maarten Lankhorst      2022-01-14  374  			vma = i915_gem_object_ggtt_pin_ww(obj, &ww, &view, 0, 0, flags);
e849f7e708600a Maarten Lankhorst      2022-01-14  375  		}
b414fcd5be0b00 Chris Wilson           2019-05-28  376  	}
b414fcd5be0b00 Chris Wilson           2019-05-28  377  	if (IS_ERR(vma)) {
b414fcd5be0b00 Chris Wilson           2019-05-28  378  		ret = PTR_ERR(vma);
2850748ef8763a Chris Wilson           2019-10-04  379  		goto err_reset;
2850748ef8763a Chris Wilson           2019-10-04  380  	}
2850748ef8763a Chris Wilson           2019-10-04  381  
2850748ef8763a Chris Wilson           2019-10-04  382  	/* Access to snoopable pages through the GTT is incoherent. */
2850748ef8763a Chris Wilson           2019-10-04  383  	if (obj->cache_level != I915_CACHE_NONE && !HAS_LLC(i915)) {
2850748ef8763a Chris Wilson           2019-10-04  384  		ret = -EFAULT;
2850748ef8763a Chris Wilson           2019-10-04  385  		goto err_unpin;
b414fcd5be0b00 Chris Wilson           2019-05-28  386  	}
b414fcd5be0b00 Chris Wilson           2019-05-28  387  
b414fcd5be0b00 Chris Wilson           2019-05-28  388  	ret = i915_vma_pin_fence(vma);
b414fcd5be0b00 Chris Wilson           2019-05-28  389  	if (ret)
b414fcd5be0b00 Chris Wilson           2019-05-28  390  		goto err_unpin;
b414fcd5be0b00 Chris Wilson           2019-05-28  391  
b414fcd5be0b00 Chris Wilson           2019-05-28  392  	/* Finally, remap it using the new GTT offset */
0e4fe0c9f2f981 Matthew Auld           2021-05-27  393  	ret = remap_io_mapping(area,
0e4fe0c9f2f981 Matthew Auld           2021-05-27  394  			       area->vm_start + (vma->ggtt_view.partial.offset << PAGE_SHIFT),
b414fcd5be0b00 Chris Wilson           2019-05-28  395  			       (ggtt->gmadr.start + vma->node.start) >> PAGE_SHIFT,
0e4fe0c9f2f981 Matthew Auld           2021-05-27  396  			       min_t(u64, vma->size, area->vm_end - area->vm_start),
0e4fe0c9f2f981 Matthew Auld           2021-05-27  397  			       &ggtt->iomap);
b414fcd5be0b00 Chris Wilson           2019-05-28  398  	if (ret)
b414fcd5be0b00 Chris Wilson           2019-05-28  399  		goto err_fence;
b414fcd5be0b00 Chris Wilson           2019-05-28  400  
d858d5695f3897 Daniele Ceraolo Spurio 2019-06-13  401  	assert_rpm_wakelock_held(rpm);
b7d151ba4b295a Chris Wilson           2019-08-22  402  
b7d151ba4b295a Chris Wilson           2019-08-22  403  	/* Mark as being mmapped into userspace for later revocation */
5c24c9d227e9bb Michał Winiarski       2021-12-19  404  	mutex_lock(&to_gt(i915)->ggtt->vm.mutex);
b414fcd5be0b00 Chris Wilson           2019-05-28  405  	if (!i915_vma_set_userfault(vma) && !obj->userfault_count++)
5c24c9d227e9bb Michał Winiarski       2021-12-19  406  		list_add(&obj->userfault_link, &to_gt(i915)->ggtt->userfault_list);
5c24c9d227e9bb Michał Winiarski       2021-12-19  407  	mutex_unlock(&to_gt(i915)->ggtt->vm.mutex);
b7d151ba4b295a Chris Wilson           2019-08-22  408  
cc662126b4134e Abdiel Janulgue        2019-12-04  409  	/* Track the mmo associated with the fenced vma */
cc662126b4134e Abdiel Janulgue        2019-12-04  410  	vma->mmo = mmo;
cc662126b4134e Abdiel Janulgue        2019-12-04  411  
1a839e016e4964 Lucas De Marchi        2021-10-05  412  	if (CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND)
5c24c9d227e9bb Michał Winiarski       2021-12-19  413  		intel_wakeref_auto(&to_gt(i915)->ggtt->userfault_wakeref,
b414fcd5be0b00 Chris Wilson           2019-05-28  414  				   msecs_to_jiffies_timeout(CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND));
b414fcd5be0b00 Chris Wilson           2019-05-28  415  
5028851cdfdf78 Chris Wilson           2019-09-20  416  	if (write) {
5028851cdfdf78 Chris Wilson           2019-09-20  417  		GEM_BUG_ON(!i915_gem_object_has_pinned_pages(obj));
b414fcd5be0b00 Chris Wilson           2019-05-28  418  		i915_vma_set_ggtt_write(vma);
5028851cdfdf78 Chris Wilson           2019-09-20  419  		obj->mm.dirty = true;
5028851cdfdf78 Chris Wilson           2019-09-20  420  	}
b414fcd5be0b00 Chris Wilson           2019-05-28  421  
b414fcd5be0b00 Chris Wilson           2019-05-28  422  err_fence:
b414fcd5be0b00 Chris Wilson           2019-05-28  423  	i915_vma_unpin_fence(vma);
b414fcd5be0b00 Chris Wilson           2019-05-28  424  err_unpin:
b414fcd5be0b00 Chris Wilson           2019-05-28  425  	__i915_vma_unpin(vma);
b414fcd5be0b00 Chris Wilson           2019-05-28  426  err_reset:
cb823ed9915b0d Chris Wilson           2019-07-12  427  	intel_gt_reset_unlock(ggtt->vm.gt, srcu);
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  428  err_pages:
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  429  	i915_gem_object_unpin_pages(obj);
b414fcd5be0b00 Chris Wilson           2019-05-28  430  err_rpm:
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  431  	if (ret == -EDEADLK) {
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  432  		ret = i915_gem_ww_ctx_backoff(&ww);
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  433  		if (!ret)
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  434  			goto retry;
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  435  	}
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  436  	i915_gem_ww_ctx_fini(&ww);
d858d5695f3897 Daniele Ceraolo Spurio 2019-06-13  437  	intel_runtime_pm_put(rpm, wakeref);
cc662126b4134e Abdiel Janulgue        2019-12-04  438  	return i915_error_to_vmf_fault(ret);
b414fcd5be0b00 Chris Wilson           2019-05-28  439  }
b414fcd5be0b00 Chris Wilson           2019-05-28  440  

:::::: The code at line 369 was first introduced by commit
:::::: 6945c53bc712cf4a28a46fe46c2bd8526ea261d1 drm/i915: Add locking to i915_gem_evict_vm(), v3.

:::::: TO: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
:::::: CC: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


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

* [linux-next:master 1693/1734] drivers/gpu/drm/i915/gem/i915_gem_mman.c:369:11: error: implicit declaration of function 'i915_gem_evict_vm'; did you mean 'i915_gem_to_ttm'?
@ 2022-01-26 17:10 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-01-26 17:10 UTC (permalink / raw)
  To: kbuild-all

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   d25ee88530253138d0b20d43511ca5acbda4e9f7
commit: e4217080a60313b0f0e5df5bb169b9f79ceb4694 [1693/1734] Merge branch 'for-linux-next-gt' of git://anongit.freedesktop.org/drm-intel
config: x86_64-rhel-8.3-func (https://download.01.org/0day-ci/archive/20220127/202201270113.DdzBtOf8-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=e4217080a60313b0f0e5df5bb169b9f79ceb4694
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout e4217080a60313b0f0e5df5bb169b9f79ceb4694
        # save the config file to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/gpu/drm/i915/

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

Note: the linux-next/master HEAD d25ee88530253138d0b20d43511ca5acbda4e9f7 builds fine.
      It may have been fixed somewhere.

All errors (new ones prefixed by >>):

   drivers/gpu/drm/i915/gem/i915_gem_mman.c: In function 'vm_fault_gtt':
>> drivers/gpu/drm/i915/gem/i915_gem_mman.c:369:11: error: implicit declaration of function 'i915_gem_evict_vm'; did you mean 'i915_gem_to_ttm'? [-Werror=implicit-function-declaration]
     369 |     ret = i915_gem_evict_vm(&ggtt->vm, &ww);
         |           ^~~~~~~~~~~~~~~~~
         |           i915_gem_to_ttm
   cc1: some warnings being treated as errors


vim +369 drivers/gpu/drm/i915/gem/i915_gem_mman.c

cc662126b4134e Abdiel Janulgue        2019-12-04  288  
cc662126b4134e Abdiel Janulgue        2019-12-04  289  static vm_fault_t vm_fault_gtt(struct vm_fault *vmf)
b414fcd5be0b00 Chris Wilson           2019-05-28  290  {
b414fcd5be0b00 Chris Wilson           2019-05-28  291  #define MIN_CHUNK_PAGES (SZ_1M >> PAGE_SHIFT)
b414fcd5be0b00 Chris Wilson           2019-05-28  292  	struct vm_area_struct *area = vmf->vma;
cc662126b4134e Abdiel Janulgue        2019-12-04  293  	struct i915_mmap_offset *mmo = area->vm_private_data;
cc662126b4134e Abdiel Janulgue        2019-12-04  294  	struct drm_i915_gem_object *obj = mmo->obj;
b414fcd5be0b00 Chris Wilson           2019-05-28  295  	struct drm_device *dev = obj->base.dev;
b414fcd5be0b00 Chris Wilson           2019-05-28  296  	struct drm_i915_private *i915 = to_i915(dev);
d858d5695f3897 Daniele Ceraolo Spurio 2019-06-13  297  	struct intel_runtime_pm *rpm = &i915->runtime_pm;
5c24c9d227e9bb Michał Winiarski       2021-12-19  298  	struct i915_ggtt *ggtt = to_gt(i915)->ggtt;
b414fcd5be0b00 Chris Wilson           2019-05-28  299  	bool write = area->vm_flags & VM_WRITE;
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  300  	struct i915_gem_ww_ctx ww;
b414fcd5be0b00 Chris Wilson           2019-05-28  301  	intel_wakeref_t wakeref;
b414fcd5be0b00 Chris Wilson           2019-05-28  302  	struct i915_vma *vma;
b414fcd5be0b00 Chris Wilson           2019-05-28  303  	pgoff_t page_offset;
b414fcd5be0b00 Chris Wilson           2019-05-28  304  	int srcu;
b414fcd5be0b00 Chris Wilson           2019-05-28  305  	int ret;
b414fcd5be0b00 Chris Wilson           2019-05-28  306  
b414fcd5be0b00 Chris Wilson           2019-05-28  307  	/* We don't use vmf->pgoff since that has the fake offset */
b414fcd5be0b00 Chris Wilson           2019-05-28  308  	page_offset = (vmf->address - area->vm_start) >> PAGE_SHIFT;
b414fcd5be0b00 Chris Wilson           2019-05-28  309  
b414fcd5be0b00 Chris Wilson           2019-05-28  310  	trace_i915_gem_object_fault(obj, page_offset, true, write);
b414fcd5be0b00 Chris Wilson           2019-05-28  311  
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  312  	wakeref = intel_runtime_pm_get(rpm);
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  313  
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  314  	i915_gem_ww_ctx_init(&ww, true);
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  315  retry:
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  316  	ret = i915_gem_object_lock(obj, &ww);
b414fcd5be0b00 Chris Wilson           2019-05-28  317  	if (ret)
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  318  		goto err_rpm;
b414fcd5be0b00 Chris Wilson           2019-05-28  319  
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  320  	/* Sanity check that we allow writing into this object */
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  321  	if (i915_gem_object_is_readonly(obj) && write) {
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  322  		ret = -EFAULT;
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  323  		goto err_rpm;
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  324  	}
b414fcd5be0b00 Chris Wilson           2019-05-28  325  
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  326  	ret = i915_gem_object_pin_pages(obj);
eebab60f224fcf Chris Wilson           2019-09-12  327  	if (ret)
b414fcd5be0b00 Chris Wilson           2019-05-28  328  		goto err_rpm;
b414fcd5be0b00 Chris Wilson           2019-05-28  329  
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  330  	ret = intel_gt_reset_trylock(ggtt->vm.gt, &srcu);
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  331  	if (ret)
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  332  		goto err_pages;
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  333  
b414fcd5be0b00 Chris Wilson           2019-05-28  334  	/* Now pin it into the GTT as needed */
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  335  	vma = i915_gem_object_ggtt_pin_ww(obj, &ww, NULL, 0, 0,
b414fcd5be0b00 Chris Wilson           2019-05-28  336  					  PIN_MAPPABLE |
6846895fde0555 Chris Wilson           2019-08-21  337  					  PIN_NONBLOCK /* NOWARN */ |
ebfdf5cd806b3b Chris Wilson           2019-08-26  338  					  PIN_NOEVICT);
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  339  	if (IS_ERR(vma) && vma != ERR_PTR(-EDEADLK)) {
b414fcd5be0b00 Chris Wilson           2019-05-28  340  		/* Use a partial view if it is bigger than available space */
b414fcd5be0b00 Chris Wilson           2019-05-28  341  		struct i915_ggtt_view view =
b414fcd5be0b00 Chris Wilson           2019-05-28  342  			compute_partial_view(obj, page_offset, MIN_CHUNK_PAGES);
b414fcd5be0b00 Chris Wilson           2019-05-28  343  		unsigned int flags;
b414fcd5be0b00 Chris Wilson           2019-05-28  344  
6846895fde0555 Chris Wilson           2019-08-21  345  		flags = PIN_MAPPABLE | PIN_NOSEARCH;
b414fcd5be0b00 Chris Wilson           2019-05-28  346  		if (view.type == I915_GGTT_VIEW_NORMAL)
b414fcd5be0b00 Chris Wilson           2019-05-28  347  			flags |= PIN_NONBLOCK; /* avoid warnings for pinned */
b414fcd5be0b00 Chris Wilson           2019-05-28  348  
b414fcd5be0b00 Chris Wilson           2019-05-28  349  		/*
b414fcd5be0b00 Chris Wilson           2019-05-28  350  		 * Userspace is now writing through an untracked VMA, abandon
b414fcd5be0b00 Chris Wilson           2019-05-28  351  		 * all hope that the hardware is able to track future writes.
b414fcd5be0b00 Chris Wilson           2019-05-28  352  		 */
b414fcd5be0b00 Chris Wilson           2019-05-28  353  
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  354  		vma = i915_gem_object_ggtt_pin_ww(obj, &ww, &view, 0, 0, flags);
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  355  		if (IS_ERR(vma) && vma != ERR_PTR(-EDEADLK)) {
b414fcd5be0b00 Chris Wilson           2019-05-28  356  			flags = PIN_MAPPABLE;
b414fcd5be0b00 Chris Wilson           2019-05-28  357  			view.type = I915_GGTT_VIEW_PARTIAL;
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  358  			vma = i915_gem_object_ggtt_pin_ww(obj, &ww, &view, 0, 0, flags);
b414fcd5be0b00 Chris Wilson           2019-05-28  359  		}
8f9fb61caed13e Chris Wilson           2019-09-02  360  
e849f7e708600a Maarten Lankhorst      2022-01-14  361  		/*
e849f7e708600a Maarten Lankhorst      2022-01-14  362  		 * The entire mappable GGTT is pinned? Unexpected!
e849f7e708600a Maarten Lankhorst      2022-01-14  363  		 * Try to evict the object we locked too, as normally we skip it
e849f7e708600a Maarten Lankhorst      2022-01-14  364  		 * due to lack of short term pinning inside execbuf.
e849f7e708600a Maarten Lankhorst      2022-01-14  365  		 */
e849f7e708600a Maarten Lankhorst      2022-01-14  366  		if (vma == ERR_PTR(-ENOSPC)) {
e849f7e708600a Maarten Lankhorst      2022-01-14  367  			ret = mutex_lock_interruptible(&ggtt->vm.mutex);
e849f7e708600a Maarten Lankhorst      2022-01-14  368  			if (!ret) {
6945c53bc712cf Maarten Lankhorst      2022-01-17 @369  				ret = i915_gem_evict_vm(&ggtt->vm, &ww);
e849f7e708600a Maarten Lankhorst      2022-01-14  370  				mutex_unlock(&ggtt->vm.mutex);
e849f7e708600a Maarten Lankhorst      2022-01-14  371  			}
e849f7e708600a Maarten Lankhorst      2022-01-14  372  			if (ret)
e849f7e708600a Maarten Lankhorst      2022-01-14  373  				goto err_reset;
e849f7e708600a Maarten Lankhorst      2022-01-14  374  			vma = i915_gem_object_ggtt_pin_ww(obj, &ww, &view, 0, 0, flags);
e849f7e708600a Maarten Lankhorst      2022-01-14  375  		}
b414fcd5be0b00 Chris Wilson           2019-05-28  376  	}
b414fcd5be0b00 Chris Wilson           2019-05-28  377  	if (IS_ERR(vma)) {
b414fcd5be0b00 Chris Wilson           2019-05-28  378  		ret = PTR_ERR(vma);
2850748ef8763a Chris Wilson           2019-10-04  379  		goto err_reset;
2850748ef8763a Chris Wilson           2019-10-04  380  	}
2850748ef8763a Chris Wilson           2019-10-04  381  
2850748ef8763a Chris Wilson           2019-10-04  382  	/* Access to snoopable pages through the GTT is incoherent. */
2850748ef8763a Chris Wilson           2019-10-04  383  	if (obj->cache_level != I915_CACHE_NONE && !HAS_LLC(i915)) {
2850748ef8763a Chris Wilson           2019-10-04  384  		ret = -EFAULT;
2850748ef8763a Chris Wilson           2019-10-04  385  		goto err_unpin;
b414fcd5be0b00 Chris Wilson           2019-05-28  386  	}
b414fcd5be0b00 Chris Wilson           2019-05-28  387  
b414fcd5be0b00 Chris Wilson           2019-05-28  388  	ret = i915_vma_pin_fence(vma);
b414fcd5be0b00 Chris Wilson           2019-05-28  389  	if (ret)
b414fcd5be0b00 Chris Wilson           2019-05-28  390  		goto err_unpin;
b414fcd5be0b00 Chris Wilson           2019-05-28  391  
b414fcd5be0b00 Chris Wilson           2019-05-28  392  	/* Finally, remap it using the new GTT offset */
0e4fe0c9f2f981 Matthew Auld           2021-05-27  393  	ret = remap_io_mapping(area,
0e4fe0c9f2f981 Matthew Auld           2021-05-27  394  			       area->vm_start + (vma->ggtt_view.partial.offset << PAGE_SHIFT),
b414fcd5be0b00 Chris Wilson           2019-05-28  395  			       (ggtt->gmadr.start + vma->node.start) >> PAGE_SHIFT,
0e4fe0c9f2f981 Matthew Auld           2021-05-27  396  			       min_t(u64, vma->size, area->vm_end - area->vm_start),
0e4fe0c9f2f981 Matthew Auld           2021-05-27  397  			       &ggtt->iomap);
b414fcd5be0b00 Chris Wilson           2019-05-28  398  	if (ret)
b414fcd5be0b00 Chris Wilson           2019-05-28  399  		goto err_fence;
b414fcd5be0b00 Chris Wilson           2019-05-28  400  
d858d5695f3897 Daniele Ceraolo Spurio 2019-06-13  401  	assert_rpm_wakelock_held(rpm);
b7d151ba4b295a Chris Wilson           2019-08-22  402  
b7d151ba4b295a Chris Wilson           2019-08-22  403  	/* Mark as being mmapped into userspace for later revocation */
5c24c9d227e9bb Michał Winiarski       2021-12-19  404  	mutex_lock(&to_gt(i915)->ggtt->vm.mutex);
b414fcd5be0b00 Chris Wilson           2019-05-28  405  	if (!i915_vma_set_userfault(vma) && !obj->userfault_count++)
5c24c9d227e9bb Michał Winiarski       2021-12-19  406  		list_add(&obj->userfault_link, &to_gt(i915)->ggtt->userfault_list);
5c24c9d227e9bb Michał Winiarski       2021-12-19  407  	mutex_unlock(&to_gt(i915)->ggtt->vm.mutex);
b7d151ba4b295a Chris Wilson           2019-08-22  408  
cc662126b4134e Abdiel Janulgue        2019-12-04  409  	/* Track the mmo associated with the fenced vma */
cc662126b4134e Abdiel Janulgue        2019-12-04  410  	vma->mmo = mmo;
cc662126b4134e Abdiel Janulgue        2019-12-04  411  
1a839e016e4964 Lucas De Marchi        2021-10-05  412  	if (CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND)
5c24c9d227e9bb Michał Winiarski       2021-12-19  413  		intel_wakeref_auto(&to_gt(i915)->ggtt->userfault_wakeref,
b414fcd5be0b00 Chris Wilson           2019-05-28  414  				   msecs_to_jiffies_timeout(CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND));
b414fcd5be0b00 Chris Wilson           2019-05-28  415  
5028851cdfdf78 Chris Wilson           2019-09-20  416  	if (write) {
5028851cdfdf78 Chris Wilson           2019-09-20  417  		GEM_BUG_ON(!i915_gem_object_has_pinned_pages(obj));
b414fcd5be0b00 Chris Wilson           2019-05-28  418  		i915_vma_set_ggtt_write(vma);
5028851cdfdf78 Chris Wilson           2019-09-20  419  		obj->mm.dirty = true;
5028851cdfdf78 Chris Wilson           2019-09-20  420  	}
b414fcd5be0b00 Chris Wilson           2019-05-28  421  
b414fcd5be0b00 Chris Wilson           2019-05-28  422  err_fence:
b414fcd5be0b00 Chris Wilson           2019-05-28  423  	i915_vma_unpin_fence(vma);
b414fcd5be0b00 Chris Wilson           2019-05-28  424  err_unpin:
b414fcd5be0b00 Chris Wilson           2019-05-28  425  	__i915_vma_unpin(vma);
b414fcd5be0b00 Chris Wilson           2019-05-28  426  err_reset:
cb823ed9915b0d Chris Wilson           2019-07-12  427  	intel_gt_reset_unlock(ggtt->vm.gt, srcu);
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  428  err_pages:
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  429  	i915_gem_object_unpin_pages(obj);
b414fcd5be0b00 Chris Wilson           2019-05-28  430  err_rpm:
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  431  	if (ret == -EDEADLK) {
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  432  		ret = i915_gem_ww_ctx_backoff(&ww);
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  433  		if (!ret)
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  434  			goto retry;
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  435  	}
3c0ffa277ef6fb Maarten Lankhorst      2020-08-19  436  	i915_gem_ww_ctx_fini(&ww);
d858d5695f3897 Daniele Ceraolo Spurio 2019-06-13  437  	intel_runtime_pm_put(rpm, wakeref);
cc662126b4134e Abdiel Janulgue        2019-12-04  438  	return i915_error_to_vmf_fault(ret);
b414fcd5be0b00 Chris Wilson           2019-05-28  439  }
b414fcd5be0b00 Chris Wilson           2019-05-28  440  

:::::: The code at line 369 was first introduced by commit
:::::: 6945c53bc712cf4a28a46fe46c2bd8526ea261d1 drm/i915: Add locking to i915_gem_evict_vm(), v3.

:::::: TO: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
:::::: CC: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

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

end of thread, other threads:[~2022-01-26 17:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26 17:10 [linux-next:master 1693/1734] drivers/gpu/drm/i915/gem/i915_gem_mman.c:369:11: error: implicit declaration of function 'i915_gem_evict_vm'; did you mean 'i915_gem_to_ttm'? kernel test robot
2022-01-26 17:10 ` 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.