intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [Intel-gfx] [CI] drm/i915/gem: Avoid iterating an empty list
@ 2020-05-22 13:27 Chris Wilson
  2020-05-22 14:27 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/gem: Avoid iterating an empty list (rev2) Patchwork
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Wilson @ 2020-05-22 13:27 UTC (permalink / raw)
  To: intel-gfx

Our __sgt_iter assumes that the scattergather list has at least one
element. But during construction we may fail in allocating the first
page, and so mark the first element as the terminator. This is
unexpected!

[22555.524752] RIP: 0010:shmem_get_pages+0x506/0x710 [i915]
[22555.524759] Code: 49 8b 2c 24 31 c0 66 89 44 24 40 48 85 ed 0f 84 62 01 00 00 4c 8b 75 00 8b 5d 08 44 8b 7d 0c 48 8b 0d 7e 34 07 e2 49 83 e6 fc <49> 8b 16 41 01 df 48 89 cf 48 89 d0 48 c1 e8 2d 48 85 c9 0f 84 c8
[22555.524765] RSP: 0018:ffffc9000053f9d0 EFLAGS: 00010246
[22555.524770] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffff8881ffffa000
[22555.524774] RDX: fffffffffffffff4 RSI: ffffffffffffffff RDI: ffffffff821efe00
[22555.524778] RBP: ffff8881b099ab00 R08: 0000000000000000 R09: 00000000fffffff4
[22555.524782] R10: 0000000000000002 R11: 00000000ffec0a02 R12: ffff8881cd3c8d60
[22555.524786] R13: 00000000fffffff4 R14: 0000000000000000 R15: 0000000000000000
[22555.524790] FS:  00007f4fbeb9b9c0(0000) GS:ffff8881f8580000(0000) knlGS:0000000000000000
[22555.524795] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[22555.524799] CR2: 0000000000000000 CR3: 00000001ec7f0004 CR4: 00000000001606e0
[22555.524803] Call Trace:
[22555.524919]  __i915_gem_object_get_pages+0x4f/0x60 [i915]

Fixes: 85d1225ec066 ("drm/i915: Introduce & use new lightweight SGL iterators")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: <stable@vger.kernel.org> # v4.8+
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 15 +++++++++------
 drivers/gpu/drm/i915/i915_scatterlist.h   |  2 ++
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
index 5d5d7eef3f43..7aff3514d97a 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
@@ -39,7 +39,6 @@ static int shmem_get_pages(struct drm_i915_gem_object *obj)
 	unsigned long last_pfn = 0;	/* suppress gcc warning */
 	unsigned int max_segment = i915_sg_segment_size();
 	unsigned int sg_page_sizes;
-	struct pagevec pvec;
 	gfp_t noreclaim;
 	int ret;
 
@@ -192,13 +191,17 @@ static int shmem_get_pages(struct drm_i915_gem_object *obj)
 	sg_mark_end(sg);
 err_pages:
 	mapping_clear_unevictable(mapping);
-	pagevec_init(&pvec);
-	for_each_sgt_page(page, sgt_iter, st) {
-		if (!pagevec_add(&pvec, page))
+	if (sg != st->sgl) {
+		struct pagevec pvec;
+
+		pagevec_init(&pvec);
+		for_each_sgt_page(page, sgt_iter, st) {
+			if (!pagevec_add(&pvec, page))
+				check_release_pagevec(&pvec);
+		}
+		if (pagevec_count(&pvec))
 			check_release_pagevec(&pvec);
 	}
-	if (pagevec_count(&pvec))
-		check_release_pagevec(&pvec);
 	sg_free_table(st);
 	kfree(st);
 
diff --git a/drivers/gpu/drm/i915/i915_scatterlist.h b/drivers/gpu/drm/i915/i915_scatterlist.h
index b7b59328cb76..5041c268f450 100644
--- a/drivers/gpu/drm/i915/i915_scatterlist.h
+++ b/drivers/gpu/drm/i915/i915_scatterlist.h
@@ -27,6 +27,8 @@ static __always_inline struct sgt_iter {
 } __sgt_iter(struct scatterlist *sgl, bool dma) {
 	struct sgt_iter s = { .sgp = sgl };
 
+	GEM_BUG_ON(sg_is_chain(s.sgp) || sg_is_last(s.sgp));
+
 	if (s.sgp) {
 		s.max = s.curr = s.sgp->offset;
 		s.max += s.sgp->length;
-- 
2.20.1

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

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

* [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/gem: Avoid iterating an empty list (rev2)
  2020-05-22 13:27 [Intel-gfx] [CI] drm/i915/gem: Avoid iterating an empty list Chris Wilson
@ 2020-05-22 14:27 ` Patchwork
  0 siblings, 0 replies; 2+ messages in thread
From: Patchwork @ 2020-05-22 14:27 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/gem: Avoid iterating an empty list (rev2)
URL   : https://patchwork.freedesktop.org/series/77553/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_8525 -> Patchwork_17760
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with Patchwork_17760 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_17760, 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_17760/index.html

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

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

### CI changes ###

#### Possible regressions ####

  * boot:
    - fi-kbl-8809g:       [PASS][1] -> [FAIL][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-kbl-8809g/boot.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-kbl-8809g/boot.html
    - fi-icl-y:           [PASS][3] -> [FAIL][4]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-icl-y/boot.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-icl-y/boot.html
    - fi-snb-2520m:       [PASS][5] -> [FAIL][6]
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-snb-2520m/boot.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-snb-2520m/boot.html
    - fi-icl-u2:          [PASS][7] -> [FAIL][8]
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-icl-u2/boot.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-icl-u2/boot.html
    - fi-cfl-8109u:       [PASS][9] -> [FAIL][10]
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-cfl-8109u/boot.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-cfl-8109u/boot.html
    - fi-skl-6600u:       [PASS][11] -> [FAIL][12]
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-skl-6600u/boot.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-skl-6600u/boot.html
    - fi-byt-j1900:       [PASS][13] -> [FAIL][14]
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-byt-j1900/boot.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-byt-j1900/boot.html
    - fi-cfl-8700k:       [PASS][15] -> [FAIL][16]
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-cfl-8700k/boot.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-cfl-8700k/boot.html
    - fi-icl-dsi:         [PASS][17] -> [FAIL][18]
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-icl-dsi/boot.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-icl-dsi/boot.html
    - fi-whl-u:           [PASS][19] -> [FAIL][20]
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-whl-u/boot.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-whl-u/boot.html
    - fi-ilk-650:         [PASS][21] -> [FAIL][22]
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-ilk-650/boot.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-ilk-650/boot.html
    - fi-skl-6700k2:      [PASS][23] -> [FAIL][24]
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-skl-6700k2/boot.html
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-skl-6700k2/boot.html
    - fi-icl-guc:         [PASS][25] -> [FAIL][26]
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-icl-guc/boot.html
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-icl-guc/boot.html
    - fi-cml-s:           [PASS][27] -> [FAIL][28]
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-cml-s/boot.html
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-cml-s/boot.html
    - fi-byt-n2820:       [PASS][29] -> [FAIL][30]
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-byt-n2820/boot.html
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-byt-n2820/boot.html
    - fi-elk-e7500:       [PASS][31] -> [FAIL][32]
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-elk-e7500/boot.html
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-elk-e7500/boot.html
    - fi-skl-lmem:        [PASS][33] -> [FAIL][34]
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-skl-lmem/boot.html
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-skl-lmem/boot.html
    - fi-glk-dsi:         [PASS][35] -> [FAIL][36]
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-glk-dsi/boot.html
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-glk-dsi/boot.html
    - fi-ivb-3770:        [PASS][37] -> [FAIL][38]
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-ivb-3770/boot.html
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-ivb-3770/boot.html
    - fi-snb-2600:        [PASS][39] -> [FAIL][40]
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-snb-2600/boot.html
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-snb-2600/boot.html
    - fi-kbl-guc:         [PASS][41] -> [FAIL][42]
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-kbl-guc/boot.html
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-kbl-guc/boot.html
    - fi-kbl-x1275:       [PASS][43] -> [FAIL][44]
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-kbl-x1275/boot.html
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-kbl-x1275/boot.html
    - fi-bdw-gvtdvm:      [PASS][45] -> [FAIL][46]
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-bdw-gvtdvm/boot.html
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-bdw-gvtdvm/boot.html
    - fi-kbl-7500u:       [PASS][47] -> [FAIL][48]
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-kbl-7500u/boot.html
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-kbl-7500u/boot.html
    - fi-bwr-2160:        [PASS][49] -> [FAIL][50]
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-bwr-2160/boot.html
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-bwr-2160/boot.html
    - fi-bdw-5557u:       [PASS][51] -> [FAIL][52]
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-bdw-5557u/boot.html
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-bdw-5557u/boot.html
    - fi-skl-guc:         [PASS][53] -> [FAIL][54]
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-skl-guc/boot.html
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-skl-guc/boot.html
    - fi-kbl-r:           [PASS][55] -> [FAIL][56]
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-kbl-r/boot.html
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-kbl-r/boot.html

  
#### Suppressed ####

  The following results come from untrusted machines, tests, or statuses.
  They do not affect the overall result.

  * boot:
    - {fi-tgl-dsi}:       [PASS][57] -> [FAIL][58]
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-tgl-dsi/boot.html
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-tgl-dsi/boot.html
    - {fi-tgl-u}:         [PASS][59] -> [FAIL][60]
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-tgl-u/boot.html
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-tgl-u/boot.html
    - {fi-kbl-7560u}:     [PASS][61] -> [FAIL][62]
   [61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-kbl-7560u/boot.html
   [62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-kbl-7560u/boot.html
    - {fi-ehl-1}:         [PASS][63] -> [FAIL][64]
   [63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-ehl-1/boot.html
   [64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-ehl-1/boot.html

  

### IGT changes ###

#### Possible regressions ####

  * igt@runner@aborted:
    - fi-gdg-551:         NOTRUN -> [FAIL][65]
   [65]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-gdg-551/igt@runner@aborted.html
    - fi-blb-e6850:       NOTRUN -> [FAIL][66]
   [66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-blb-e6850/igt@runner@aborted.html

  
#### Suppressed ####

  The following results come from untrusted machines, tests, or statuses.
  They do not affect the overall result.

  * {igt@gem_busy@busy@all}:
    - fi-blb-e6850:       [PASS][67] -> [INCOMPLETE][68]
   [67]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-blb-e6850/igt@gem_busy@busy@all.html
   [68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-blb-e6850/igt@gem_busy@busy@all.html

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

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

### CI changes ###

#### Issues hit ####

  * boot:
    - fi-bxt-dsi:         [PASS][69] -> [FAIL][70] ([i915#1529])
   [69]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8525/fi-bxt-dsi/boot.html
   [70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17760/fi-bxt-dsi/boot.html

  

### IGT changes ###

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

  [i915#1529]: https://gitlab.freedesktop.org/drm/intel/issues/1529
  [i915#172]: https://gitlab.freedesktop.org/drm/intel/issues/172
  [i915#299]: https://gitlab.freedesktop.org/drm/intel/issues/299


Participating hosts (46 -> 36)
------------------------------

  Missing    (10): fi-cml-u2 fi-hsw-4200u fi-bsw-n3050 fi-byt-squawks fi-bsw-cyan fi-apl-guc fi-bsw-kefka fi-byt-clapper fi-bsw-nick fi-bdw-samus 


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

  * Linux: CI_DRM_8525 -> Patchwork_17760

  CI-20190529: 20190529
  CI_DRM_8525: 56110c7afae3bbeb681960494b92b745c6802e1f @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5675: 74f7488fe4f8acf901b18fc9c6c4d45a972dcad5 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_17760: 68726d4faa0697bf958ef1f0c6c3fec111099d51 @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

68726d4faa06 drm/i915/gem: Avoid iterating an empty list

== Logs ==

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

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

end of thread, other threads:[~2020-05-22 14:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-22 13:27 [Intel-gfx] [CI] drm/i915/gem: Avoid iterating an empty list Chris Wilson
2020-05-22 14:27 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/gem: Avoid iterating an empty list (rev2) Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).