All of lore.kernel.org
 help / color / mirror / Atom feed
* [CI] drm/i915/gtt: Make sure the gen6 ppgtt is bound before first use
@ 2019-09-11 19:49 Chris Wilson
  2019-09-12  6:04 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/gtt: Make sure the gen6 ppgtt is bound before first use (rev2) Patchwork
  2019-09-12  6:33 ` ✗ Fi.CI.BAT: failure " Patchwork
  0 siblings, 2 replies; 3+ messages in thread
From: Chris Wilson @ 2019-09-11 19:49 UTC (permalink / raw)
  To: intel-gfx

As we remove the struct_mutex protection from around the vma pinning,
counters need to be atomic and aware that there may be multiple threads
simultaneously active.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 39 ++++++++++++++++-------------
 drivers/gpu/drm/i915/i915_gem_gtt.h |  4 ++-
 2 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index a09a9b62afbe..8883bb8e5ca2 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -1790,6 +1790,8 @@ static void gen6_ppgtt_cleanup(struct i915_address_space *vm)
 
 	gen6_ppgtt_free_pd(ppgtt);
 	free_scratch(vm);
+
+	mutex_destroy(&ppgtt->pin_mutex);
 	kfree(ppgtt->base.pd);
 }
 
@@ -1895,7 +1897,7 @@ static struct i915_vma *pd_vma_create(struct gen6_ppgtt *ppgtt, int size)
 int gen6_ppgtt_pin(struct i915_ppgtt *base)
 {
 	struct gen6_ppgtt *ppgtt = to_gen6_ppgtt(base);
-	int err;
+	int err = 0;
 
 	GEM_BUG_ON(ppgtt->base.vm.closed);
 
@@ -1905,24 +1907,26 @@ int gen6_ppgtt_pin(struct i915_ppgtt *base)
 	 * (When vma->pin_count becomes atomic, I expect we will naturally
 	 * need a larger, unpacked, type and kill this redundancy.)
 	 */
-	if (ppgtt->pin_count++)
+	if (atomic_add_unless(&ppgtt->pin_count, 1, 0))
 		return 0;
 
+	if (mutex_lock_interruptible(&ppgtt->pin_mutex))
+		return -EINTR;
+
 	/*
 	 * PPGTT PDEs reside in the GGTT and consists of 512 entries. The
 	 * allocator works in address space sizes, so it's multiplied by page
 	 * size. We allocate at the top of the GTT to avoid fragmentation.
 	 */
-	err = i915_vma_pin(ppgtt->vma,
-			   0, GEN6_PD_ALIGN,
-			   PIN_GLOBAL | PIN_HIGH);
-	if (err)
-		goto unpin;
-
-	return 0;
+	if (!atomic_read(&ppgtt->pin_count)) {
+		err = i915_vma_pin(ppgtt->vma,
+				   0, GEN6_PD_ALIGN,
+				   PIN_GLOBAL | PIN_HIGH);
+	}
+	if (!err)
+		atomic_inc(&ppgtt->pin_count);
+	mutex_unlock(&ppgtt->pin_mutex);
 
-unpin:
-	ppgtt->pin_count = 0;
 	return err;
 }
 
@@ -1930,22 +1934,19 @@ void gen6_ppgtt_unpin(struct i915_ppgtt *base)
 {
 	struct gen6_ppgtt *ppgtt = to_gen6_ppgtt(base);
 
-	GEM_BUG_ON(!ppgtt->pin_count);
-	if (--ppgtt->pin_count)
-		return;
-
-	i915_vma_unpin(ppgtt->vma);
+	GEM_BUG_ON(!atomic_read(&ppgtt->pin_count));
+	atomic_dec(&ppgtt->pin_count);
 }
 
 void gen6_ppgtt_unpin_all(struct i915_ppgtt *base)
 {
 	struct gen6_ppgtt *ppgtt = to_gen6_ppgtt(base);
 
-	if (!ppgtt->pin_count)
+	if (!atomic_read(&ppgtt->pin_count))
 		return;
 
-	ppgtt->pin_count = 0;
 	i915_vma_unpin(ppgtt->vma);
+	atomic_set(&ppgtt->pin_count, 0);
 }
 
 static struct i915_ppgtt *gen6_ppgtt_create(struct drm_i915_private *i915)
@@ -1958,6 +1959,8 @@ static struct i915_ppgtt *gen6_ppgtt_create(struct drm_i915_private *i915)
 	if (!ppgtt)
 		return ERR_PTR(-ENOMEM);
 
+	mutex_init(&ppgtt->pin_mutex);
+
 	ppgtt_init(&ppgtt->base, &i915->gt);
 	ppgtt->base.vm.top = 1;
 
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h
index 201788126a89..8fd2234ba0bf 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.h
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
@@ -437,7 +437,9 @@ struct gen6_ppgtt {
 	struct i915_vma *vma;
 	gen6_pte_t __iomem *pd_addr;
 
-	unsigned int pin_count;
+	atomic_t pin_count;
+	struct mutex pin_mutex;
+
 	bool scan_for_unused_pt;
 };
 
-- 
2.23.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✗ Fi.CI.CHECKPATCH: warning for drm/i915/gtt: Make sure the gen6 ppgtt is bound before first use (rev2)
  2019-09-11 19:49 [CI] drm/i915/gtt: Make sure the gen6 ppgtt is bound before first use Chris Wilson
@ 2019-09-12  6:04 ` Patchwork
  2019-09-12  6:33 ` ✗ Fi.CI.BAT: failure " Patchwork
  1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2019-09-12  6:04 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/gtt: Make sure the gen6 ppgtt is bound before first use (rev2)
URL   : https://patchwork.freedesktop.org/series/66551/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
2989952e76ad drm/i915/gtt: Make sure the gen6 ppgtt is bound before first use
-:119: CHECK:UNCOMMENTED_DEFINITION: struct mutex definition without comment
#119: FILE: drivers/gpu/drm/i915/i915_gem_gtt.h:441:
+	struct mutex pin_mutex;

total: 0 errors, 0 warnings, 1 checks, 96 lines checked

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✗ Fi.CI.BAT: failure for drm/i915/gtt: Make sure the gen6 ppgtt is bound before first use (rev2)
  2019-09-11 19:49 [CI] drm/i915/gtt: Make sure the gen6 ppgtt is bound before first use Chris Wilson
  2019-09-12  6:04 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/gtt: Make sure the gen6 ppgtt is bound before first use (rev2) Patchwork
@ 2019-09-12  6:33 ` Patchwork
  1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2019-09-12  6:33 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/gtt: Make sure the gen6 ppgtt is bound before first use (rev2)
URL   : https://patchwork.freedesktop.org/series/66551/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_6874 -> Patchwork_14367
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with Patchwork_14367 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_14367, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14367/

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in Patchwork_14367:

### IGT changes ###

#### Possible regressions ####

  * igt@i915_module_load@reload:
    - fi-hsw-4770r:       [PASS][1] -> [INCOMPLETE][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6874/fi-hsw-4770r/igt@i915_module_load@reload.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14367/fi-hsw-4770r/igt@i915_module_load@reload.html
    - fi-snb-2520m:       [PASS][3] -> [INCOMPLETE][4]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6874/fi-snb-2520m/igt@i915_module_load@reload.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14367/fi-snb-2520m/igt@i915_module_load@reload.html
    - fi-hsw-4770:        [PASS][5] -> [INCOMPLETE][6]
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6874/fi-hsw-4770/igt@i915_module_load@reload.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14367/fi-hsw-4770/igt@i915_module_load@reload.html
    - fi-ivb-3770:        [PASS][7] -> [INCOMPLETE][8]
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6874/fi-ivb-3770/igt@i915_module_load@reload.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14367/fi-ivb-3770/igt@i915_module_load@reload.html
    - fi-hsw-peppy:       [PASS][9] -> [INCOMPLETE][10]
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6874/fi-hsw-peppy/igt@i915_module_load@reload.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14367/fi-hsw-peppy/igt@i915_module_load@reload.html

  
Known issues
------------

  Here are the changes found in Patchwork_14367 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@i915_module_load@reload:
    - fi-byt-j1900:       [PASS][11] -> [INCOMPLETE][12] ([fdo#102657])
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6874/fi-byt-j1900/igt@i915_module_load@reload.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14367/fi-byt-j1900/igt@i915_module_load@reload.html
    - fi-byt-n2820:       [PASS][13] -> [INCOMPLETE][14] ([fdo#102657])
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6874/fi-byt-n2820/igt@i915_module_load@reload.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14367/fi-byt-n2820/igt@i915_module_load@reload.html
    - fi-snb-2600:        [PASS][15] -> [INCOMPLETE][16] ([fdo#105411])
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6874/fi-snb-2600/igt@i915_module_load@reload.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14367/fi-snb-2600/igt@i915_module_load@reload.html

  * igt@kms_chamelium@dp-crc-fast:
    - fi-kbl-7500u:       [PASS][17] -> [FAIL][18] ([fdo#109483] / [fdo#109635 ])
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6874/fi-kbl-7500u/igt@kms_chamelium@dp-crc-fast.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14367/fi-kbl-7500u/igt@kms_chamelium@dp-crc-fast.html

  * igt@vgem_basic@dmabuf-export:
    - fi-icl-u3:          [PASS][19] -> [DMESG-WARN][20] ([fdo#107724])
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6874/fi-icl-u3/igt@vgem_basic@dmabuf-export.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14367/fi-icl-u3/igt@vgem_basic@dmabuf-export.html

  
#### Possible fixes ####

  * igt@gem_ctx_switch@legacy-render:
    - fi-bxt-dsi:         [INCOMPLETE][21] ([fdo#103927] / [fdo#111381]) -> [PASS][22]
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6874/fi-bxt-dsi/igt@gem_ctx_switch@legacy-render.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14367/fi-bxt-dsi/igt@gem_ctx_switch@legacy-render.html

  * igt@gem_exec_suspend@basic-s4-devices:
    - fi-kbl-7500u:       [DMESG-WARN][23] ([fdo#105128] / [fdo#107139]) -> [PASS][24]
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6874/fi-kbl-7500u/igt@gem_exec_suspend@basic-s4-devices.html
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14367/fi-kbl-7500u/igt@gem_exec_suspend@basic-s4-devices.html

  * igt@gem_mmap_gtt@basic-short:
    - fi-icl-u3:          [DMESG-WARN][25] ([fdo#107724]) -> [PASS][26] +1 similar issue
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6874/fi-icl-u3/igt@gem_mmap_gtt@basic-short.html
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14367/fi-icl-u3/igt@gem_mmap_gtt@basic-short.html

  * igt@i915_selftest@live_execlists:
    - fi-skl-gvtdvm:      [DMESG-FAIL][27] ([fdo#111108]) -> [PASS][28]
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6874/fi-skl-gvtdvm/igt@i915_selftest@live_execlists.html
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14367/fi-skl-gvtdvm/igt@i915_selftest@live_execlists.html

  * igt@i915_selftest@live_gem_contexts:
    - fi-cfl-guc:         [INCOMPLETE][29] ([fdo#111514]) -> [PASS][30]
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6874/fi-cfl-guc/igt@i915_selftest@live_gem_contexts.html
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14367/fi-cfl-guc/igt@i915_selftest@live_gem_contexts.html

  * igt@i915_selftest@live_hangcheck:
    - {fi-icl-dsi}:       [INCOMPLETE][31] ([fdo#107713] / [fdo#108569]) -> [PASS][32]
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6874/fi-icl-dsi/igt@i915_selftest@live_hangcheck.html
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14367/fi-icl-dsi/igt@i915_selftest@live_hangcheck.html

  
#### Warnings ####

  * igt@gem_exec_gttfill@basic:
    - fi-apl-guc:         [DMESG-WARN][33] ([fdo#111652 ]) -> [DMESG-WARN][34] ([fdo#109385] / [fdo#111652 ])
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6874/fi-apl-guc/igt@gem_exec_gttfill@basic.html
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14367/fi-apl-guc/igt@gem_exec_gttfill@basic.html

  * igt@kms_chamelium@hdmi-hpd-fast:
    - fi-kbl-7500u:       [FAIL][35] ([fdo#111407]) -> [FAIL][36] ([fdo#111096])
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6874/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14367/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#102657]: https://bugs.freedesktop.org/show_bug.cgi?id=102657
  [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
  [fdo#105128]: https://bugs.freedesktop.org/show_bug.cgi?id=105128
  [fdo#105411]: https://bugs.freedesktop.org/show_bug.cgi?id=105411
  [fdo#107139]: https://bugs.freedesktop.org/show_bug.cgi?id=107139
  [fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
  [fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
  [fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
  [fdo#109385]: https://bugs.freedesktop.org/show_bug.cgi?id=109385
  [fdo#109483]: https://bugs.freedesktop.org/show_bug.cgi?id=109483
  [fdo#109635 ]: https://bugs.freedesktop.org/show_bug.cgi?id=109635 
  [fdo#111096]: https://bugs.freedesktop.org/show_bug.cgi?id=111096
  [fdo#111108]: https://bugs.freedesktop.org/show_bug.cgi?id=111108
  [fdo#111381]: https://bugs.freedesktop.org/show_bug.cgi?id=111381
  [fdo#111407]: https://bugs.freedesktop.org/show_bug.cgi?id=111407
  [fdo#111514]: https://bugs.freedesktop.org/show_bug.cgi?id=111514
  [fdo#111652 ]: https://bugs.freedesktop.org/show_bug.cgi?id=111652 


Participating hosts (54 -> 47)
------------------------------

  Missing    (7): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-icl-y fi-byt-clapper fi-bdw-samus 


Build changes
-------------

  * CI: CI-20190529 -> None
  * Linux: CI_DRM_6874 -> Patchwork_14367

  CI-20190529: 20190529
  CI_DRM_6874: f9ee689ff55489da8db3cd5ddad533967c07561f @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5178: efb4539494d94f03374874d3b61bd04ef3802aaa @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_14367: 2989952e76ad6a56c1f3fb309c4a7d36c8b5db5f @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

2989952e76ad drm/i915/gtt: Make sure the gen6 ppgtt is bound before first use

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14367/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2019-09-12  6:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-11 19:49 [CI] drm/i915/gtt: Make sure the gen6 ppgtt is bound before first use Chris Wilson
2019-09-12  6:04 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/gtt: Make sure the gen6 ppgtt is bound before first use (rev2) Patchwork
2019-09-12  6:33 ` ✗ Fi.CI.BAT: failure " Patchwork

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.