Skip to contentSkip to conversation

drm/i915/selftests: prefer the create_user helper

PATCH Superseded Matthew Auld 3 participants 4 messages Jul 28, 2021 – Jul 29, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915/selftests: prefer the create_user helper

No need to hand roll the set_placements stuff, now that that we have a helper for this. Also no need to handle the -ENODEV case here, since NULL mr implies missing device support, where the for_each_memory_region helper will always skip over such regions.

Cc Jason Ekstrand <[email protected]>
---
 .../drm/i915/gem/selftests/i915_gem_mman.c    | 46 ++-----------------
 1 file changed, 4 insertions(+), 42 deletions(-)
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c +4 -42
index 0b2b73d8a364..eed1c2c64e75 100644
@@ -860,24 +860,6 @@ static bool can_mmap(struct drm_i915_gem_object *obj, enum i915_mmap_type type)
 	return !no_map;
 }
 
-static void object_set_placements(struct drm_i915_gem_object *obj,
-				  struct intel_memory_region **placements,
-				  unsigned int n_placements)
-{
-	GEM_BUG_ON(!n_placements);
-
-	if (n_placements == 1) {
-		struct drm_i915_private *i915 = to_i915(obj->base.dev);
-		struct intel_memory_region *mr = placements[0];
-
-		obj->mm.placements = &i915->mm.regions[mr->id];
-		obj->mm.n_placements = 1;
-	} else {
-		obj->mm.placements = placements;
-		obj->mm.n_placements = n_placements;
-	}
-}
-
 #define expand32(x) (((x) << 0) | ((x) << 8) | ((x) << 16) | ((x) << 24))
 static int __igt_mmap(struct drm_i915_private *i915,
 		      struct drm_i915_gem_object *obj,
@@ -972,15 +954,10 @@ static int igt_mmap(void *arg)
 			struct drm_i915_gem_object *obj;
 			int err;
 
-			obj = i915_gem_object_create_region(mr, sizes[i], 0, I915_BO_ALLOC_USER);
-			if (obj == ERR_PTR(-ENODEV))
-				continue;
-
+			obj = __i915_gem_object_create_user(i915, sizes[i], &mr, 1);
 			if (IS_ERR(obj))
 				return PTR_ERR(obj);
 
-			object_set_placements(obj, &mr, 1);
-
 			err = __igt_mmap(i915, obj, I915_MMAP_TYPE_GTT);
 			if (err == 0)
 				err = __igt_mmap(i915, obj, I915_MMAP_TYPE_WC);
@@ -1101,15 +1078,10 @@ static int igt_mmap_access(void *arg)
 		struct drm_i915_gem_object *obj;
 		int err;
 
-		obj = i915_gem_object_create_region(mr, PAGE_SIZE, 0, I915_BO_ALLOC_USER);
-		if (obj == ERR_PTR(-ENODEV))
-			continue;
-
+		obj = __i915_gem_object_create_user(i915, PAGE_SIZE, &mr, 1);
 		if (IS_ERR(obj))
 			return PTR_ERR(obj);
 
-		object_set_placements(obj, &mr, 1);
-
 		err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_GTT);
 		if (err == 0)
 			err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_WB);
@@ -1248,15 +1220,10 @@ static int igt_mmap_gpu(void *arg)
 		struct drm_i915_gem_object *obj;
 		int err;
 
-		obj = i915_gem_object_create_region(mr, PAGE_SIZE, 0, I915_BO_ALLOC_USER);
-		if (obj == ERR_PTR(-ENODEV))
-			continue;
-
+		obj = __i915_gem_object_create_user(i915, PAGE_SIZE, &mr, 1);
 		if (IS_ERR(obj))
 			return PTR_ERR(obj);
 
-		object_set_placements(obj, &mr, 1);
-
 		err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_GTT);
 		if (err == 0)
 			err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_WC);
@@ -1405,15 +1372,10 @@ static int igt_mmap_revoke(void *arg)
 		struct drm_i915_gem_object *obj;
 		int err;
 
-		obj = i915_gem_object_create_region(mr, PAGE_SIZE, 0, I915_BO_ALLOC_USER);
-		if (obj == ERR_PTR(-ENODEV))
-			continue;
-
+		obj = __i915_gem_object_create_user(i915, PAGE_SIZE, &mr, 1);
 		if (IS_ERR(obj))
 			return PTR_ERR(obj);
 
-		object_set_placements(obj, &mr, 1);
-
 		err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_GTT);
 		if (err == 0)
 			err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_WC);
Signature · 1 line
2.26.3
#1 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/selftests: prefer the create_user helper

== Series Details ==

== Series Details ==

Series: drm/i915/selftests: prefer the create_user helper
URL : https://patchwork.freedesktop.org/series/93131/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
28a3c3987659 drm/i915/selftests: prefer the create_user helper
-:6: WARNING:REPEATED_WORD: Possible repeated word: 'that'
#6: 
No need to hand roll the set_placements stuff, now that that we have a

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

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/selftests: prefer the create_user helper

In reply to Matthew Auld
== Series Details ==

== Series Details ==

Series: drm/i915/selftests: prefer the create_user helper
URL : https://patchwork.freedesktop.org/series/93131/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_10413 -> Patchwork_20726
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_20726 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_20726, 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_20726/index.html

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

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

### IGT changes ###

#### Possible regressions ####

* igt@i915_selftest@live@mman:
- fi-kbl-8809g: [PASS][1] -> [DMESG-FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10413/fi-kbl-8809g/igt@i915_selftest@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20726/fi-kbl-8809g/igt@i915_selftest@[email protected]
- fi-ivb-3770: [PASS][3] -> [DMESG-FAIL][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10413/fi-ivb-3770/igt@i915_selftest@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20726/fi-ivb-3770/igt@i915_selftest@[email protected]

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_suspend@basic-s3:
- fi-tgl-1115g4: [PASS][5] -> [FAIL][6] ([i915#1888])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10413/fi-tgl-1115g4/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20726/fi-tgl-1115g4/igt@[email protected]

* igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-c:
- fi-tgl-1115g4: [PASS][7] -> [DMESG-WARN][8] ([i915#1887])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10413/fi-tgl-1115g4/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20726/fi-tgl-1115g4/igt@[email protected]

* igt@runner@aborted:
- fi-tgl-1115g4: NOTRUN -> [FAIL][9] ([i915#1602])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20726/fi-tgl-1115g4/igt@[email protected]

[i915#1602]: https://gitlab.freedesktop.org/drm/intel/issues/1602
[i915#1887]: https://gitlab.freedesktop.org/drm/intel/issues/1887
[i915#1888]: https://gitlab.freedesktop.org/drm/intel/issues/1888

Participating hosts (42 -> 36)
------------------------------

Missing (6): fi-ilk-m540 fi-hsw-4200u fi-bsw-cyan fi-ctg-p8600 fi-bdw-samus bat-jsl-1

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

* Linux: CI_DRM_10413 -> Patchwork_20726

CI-20190529: 20190529
CI_DRM_10413: 33ace46253ab0ea580c1ff117e8ec2c6096d3297 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6155: 4b51398dcd7559012b85776e7353d516ff1e6ce6 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_20726: 28a3c39876598c0ea3a09e8fe98c100614c9b759 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

28a3c3987659 drm/i915/selftests: prefer the create_user helper

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20726/index.html

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 1/1
#3 lore raw
In reply to Matthew Auld
Quoted 7 lines · On July 28, 2021 10:57:23 Matthew Auld <[email protected]> wrote:

No need to hand roll the set_placements stuff, now that that we have a helper for this. Also no need to handle the -ENODEV case here, since NULL mr implies missing device support, where the for_each_memory_region helper will always skip over such regions.

Cc Jason Ekstrand <[email protected]>
Quoted 103 lines

---
.../drm/i915/gem/selftests/i915_gem_mman.c | 46 ++-----------------

1 file changed, 4 insertions(+), 42 deletions(-)
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c +0 -18
index 0b2b73d8a364..eed1c2c64e75 100644
@@ -860,24 +860,6 @@ static bool can_mmap(struct drm_i915_gem_object *obj, 
 enum i915_mmap_type type)
 return !no_map;
 }
 
-static void object_set_placements(struct drm_i915_gem_object *obj,
-  struct intel_memory_region **placements,
-  unsigned int n_placements)
-{
- GEM_BUG_ON(!n_placements);
-
- if (n_placements == 1) {
- struct drm_i915_private *i915 = to_i915(obj->base.dev);
- struct intel_memory_region *mr = placements[0];
-
- obj->mm.placements = &i915->mm.regions[mr->id];
- obj->mm.n_placements = 1;
- } else {
- obj->mm.placements = placements;
- obj->mm.n_placements = n_placements;
- }
-}
-
 #define expand32(x) (((x) << 0) | ((x) << 8) | ((x) << 16) | ((x) << 24))
 static int __igt_mmap(struct drm_i915_private *i915,

struct drm_i915_gem_object *obj,

drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c +4 -25
@@ -972,15 +954,10 @@ static int igt_mmap(void *arg)
 struct drm_i915_gem_object *obj;
 int err;
 
- obj = i915_gem_object_create_region(mr, sizes[i], 0, I915_BO_ALLOC_USER);
- if (obj == ERR_PTR(-ENODEV))
- continue;
-
+ obj = __i915_gem_object_create_user(i915, sizes[i], &mr, 1);
 if (IS_ERR(obj))
 return PTR_ERR(obj);
 
- object_set_placements(obj, &mr, 1);
-
 err = __igt_mmap(i915, obj, I915_MMAP_TYPE_GTT);
 if (err == 0)
 err = __igt_mmap(i915, obj, I915_MMAP_TYPE_WC);
@@ -1101,15 +1078,10 @@ static int igt_mmap_access(void *arg)
 struct drm_i915_gem_object *obj;
 int err;
 
- obj = i915_gem_object_create_region(mr, PAGE_SIZE, 0, I915_BO_ALLOC_USER);
- if (obj == ERR_PTR(-ENODEV))
- continue;
-
+ obj = __i915_gem_object_create_user(i915, PAGE_SIZE, &mr, 1);
 if (IS_ERR(obj))
 return PTR_ERR(obj);
 
- object_set_placements(obj, &mr, 1);
-
 err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_GTT);
 if (err == 0)
 err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_WB);
@@ -1248,15 +1220,10 @@ static int igt_mmap_gpu(void *arg)
 struct drm_i915_gem_object *obj;
 int err;
 
- obj = i915_gem_object_create_region(mr, PAGE_SIZE, 0, I915_BO_ALLOC_USER);
- if (obj == ERR_PTR(-ENODEV))
- continue;
-
+ obj = __i915_gem_object_create_user(i915, PAGE_SIZE, &mr, 1);
 if (IS_ERR(obj))
 return PTR_ERR(obj);
 
- object_set_placements(obj, &mr, 1);
-
 err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_GTT);
 if (err == 0)
 err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_WC);
@@ -1405,15 +1372,10 @@ static int igt_mmap_revoke(void *arg)
 struct drm_i915_gem_object *obj;
 int err;
 
- obj = i915_gem_object_create_region(mr, PAGE_SIZE, 0, I915_BO_ALLOC_USER);
- if (obj == ERR_PTR(-ENODEV))
- continue;
-
+ obj = __i915_gem_object_create_user(i915, PAGE_SIZE, &mr, 1);
 if (IS_ERR(obj))
 return PTR_ERR(obj);
 
- object_set_placements(obj, &mr, 1);
-
 err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_GTT);
 if (err == 0)
 err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_WC);
--
Quoted 1 line

2.26.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx