diff mbox series

[v2] drm/i915/gem: Fix the mman selftest

Message ID 20210831122931.157536-1-thomas.hellstrom@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [v2] drm/i915/gem: Fix the mman selftest | expand

Commit Message

Thomas Hellstrom Aug. 31, 2021, 12:29 p.m. UTC
Using the I915_MMAP_TYPE_FIXED mmap type requires the TTM backend, so
for that mmap type, use __i915_gem_object_create_user() instead of
i915_gem_object_create_internal(), as we really want to tests objects
mmap-able by user-space.

This also means that the out-of-space error happens at object creation
and returns -ENXIO rather than -ENOSPC, so fix the code up to expect
that on out-of-offset-space errors.

Finally only use I915_MMAP_TYPE_FIXED for LMEM and SMEM for now if
testing on LMEM-capable devices. For stolen LMEM, we still take the
same path as for integrated, as that haven't been moved over to TTM yet,
and user-space should not be able to create out of stolen LMEM anyway.

v2:
 - Check the presence of the obj->ops->mmap_offset callback rather than
   hardcoding the supported mmap regions in can_mmap() (Maarten Lankhorst)

Fixes: 7961c5b60f23 ("drm/i915: Add TTM offset argument to mmap.")
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 .../drm/i915/gem/selftests/i915_gem_mman.c    | 26 ++++++++++++++-----
 1 file changed, 20 insertions(+), 6 deletions(-)

Comments

Thomas Hellstrom Aug. 31, 2021, 1:29 p.m. UTC | #1
On 8/31/21 3:19 PM, Patchwork wrote:
> Project List - Patchwork *Patch Details*
> *Series:* 	drm/i915/gem: Fix the mman selftest (rev2)
> *URL:* 	https://patchwork.freedesktop.org/series/94062/ 
> <https://patchwork.freedesktop.org/series/94062/>
> *State:* 	failure
> *Details:* 
> https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20928/index.html 
> <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20928/index.html>
>
>
>   CI Bug Log - changes from CI_DRM_10539 -> Patchwork_20928
>
>
>     Summary
>
> *FAILURE*
>
> Serious unknown changes coming with Patchwork_20928 absolutely need to be
> verified manually.
>
> If you think the reported changes have nothing to do with the changes
> introduced in Patchwork_20928, 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_20928/index.html
>
>
>     Possible new issues
>
> Here are the unknown changes that may have been introduced in 
> Patchwork_20928:
>
>
>       IGT changes
>
>
>         Possible regressions
>
>   * igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-b:
>       o fi-rkl-guc: PASS
>         <https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10539/fi-rkl-guc/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-b.html>
>         -> SKIP
>         <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20928/fi-rkl-guc/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-b.html>
>
>
Lakshmi, this failure is unrelated.

Thanks,

Thomas
Vudum, Lakshminarayana Aug. 31, 2021, 4:03 p.m. UTC | #2
Re-reported.

From: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Sent: Tuesday, August 31, 2021 6:29 AM
To: intel-gfx@lists.freedesktop.org; Vudum, Lakshminarayana <lakshminarayana.vudum@intel.com>
Subject: Re: ✗ Fi.CI.BAT: failure for drm/i915/gem: Fix the mman selftest (rev2)



On 8/31/21 3:19 PM, Patchwork wrote:
Patch Details
Series:

drm/i915/gem: Fix the mman selftest (rev2)

URL:

https://patchwork.freedesktop.org/series/94062/

State:

failure

Details:

https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20928/index.html

CI Bug Log - changes from CI_DRM_10539 -> Patchwork_20928
Summary

FAILURE

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

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

Possible new issues

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

IGT changes
Possible regressions

  *   igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-b:

     *   fi-rkl-guc: PASS<https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10539/fi-rkl-guc/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-b.html> -> SKIP<https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20928/fi-rkl-guc/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-b.html>


Lakshmi, this failure is unrelated.

Thanks,

Thomas
Thomas Hellstrom Sept. 1, 2021, 8:33 a.m. UTC | #3
On 8/31/21 8:51 PM, Patchwork wrote:
> Project List - Patchwork *Patch Details*
> *Series:* 	drm/i915/gem: Fix the mman selftest (rev2)
> *URL:* 	https://patchwork.freedesktop.org/series/94062/ 
> <https://patchwork.freedesktop.org/series/94062/>
> *State:* 	failure
> *Details:* 
> https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20928/index.html 
> <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20928/index.html>
>
>
>   CI Bug Log - changes from CI_DRM_10539_full -> Patchwork_20928_full
>
>
>     Summary
>
> *FAILURE*
>
> Serious unknown changes coming with Patchwork_20928_full absolutely 
> need to be
> verified manually.
>
> If you think the reported changes have nothing to do with the changes
> introduced in Patchwork_20928_full, please notify your bug team to 
> allow them
> to document this new failure mode, which will reduce false positives 
> in CI.
>
>
>     Possible new issues
>
> Here are the unknown changes that may have been introduced in 
> Patchwork_20928_full:
>
>
>       IGT changes
>
>
>         Possible regressions
>
>   * igt@sysfs_heartbeat_interval@mixed@vcs0:
>       o shard-skl: PASS
>         <https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10539/shard-skl9/igt@sysfs_heartbeat_interval@mixed@vcs0.html>
>         -> WARN
>         <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20928/shard-skl6/igt@sysfs_heartbeat_interval@mixed@vcs0.html>
>
>
Lakshmi, this failure is unrelated.

Thanks,

Thomas
Thomas Hellstrom Sept. 1, 2021, 9:33 a.m. UTC | #4
+ jaswanthx.kattamanchi@intel.com

On 9/1/21 10:33 AM, Thomas Hellström wrote:
>
>
> On 8/31/21 8:51 PM, Patchwork wrote:
>> Project List - Patchwork *Patch Details*
>> *Series:* 	drm/i915/gem: Fix the mman selftest (rev2)
>> *URL:* 	https://patchwork.freedesktop.org/series/94062/ 
>> <https://patchwork.freedesktop.org/series/94062/>
>> *State:* 	failure
>> *Details:* 
>> https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20928/index.html 
>> <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20928/index.html>
>>
>>
>>   CI Bug Log - changes from CI_DRM_10539_full -> Patchwork_20928_full
>>
>>
>>     Summary
>>
>> *FAILURE*
>>
>> Serious unknown changes coming with Patchwork_20928_full absolutely 
>> need to be
>> verified manually.
>>
>> If you think the reported changes have nothing to do with the changes
>> introduced in Patchwork_20928_full, please notify your bug team to 
>> allow them
>> to document this new failure mode, which will reduce false positives 
>> in CI.
>>
>>
>>     Possible new issues
>>
>> Here are the unknown changes that may have been introduced in 
>> Patchwork_20928_full:
>>
>>
>>       IGT changes
>>
>>
>>         Possible regressions
>>
>>   * igt@sysfs_heartbeat_interval@mixed@vcs0:
>>       o shard-skl: PASS
>>         <https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10539/shard-skl9/igt@sysfs_heartbeat_interval@mixed@vcs0.html>
>>         -> WARN
>>         <https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20928/shard-skl6/igt@sysfs_heartbeat_interval@mixed@vcs0.html>
>>
>>
> Lakshmi, this failure is unrelated.
>
> Thanks,
>
> Thomas
>
>
Kattamanchi, JaswanthX Sept. 1, 2021, 12:12 p.m. UTC | #5
Hi Thomas,

Re reported

Patch : https://patchwork.freedesktop.org/series/94062/

Regards,
Jaswanth Kattamanchi

From: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Sent: Wednesday, September 1, 2021 3:04 PM
To: intel-gfx@lists.freedesktop.org; Vudum, Lakshminarayana <lakshminarayana.vudum@intel.com>; Kattamanchi, JaswanthX <jaswanthx.kattamanchi@intel.com>
Subject: Re: [Intel-gfx] ✗ Fi.CI.IGT: failure for drm/i915/gem: Fix the mman selftest (rev2)


+ jaswanthx.kattamanchi@intel.com<mailto:jaswanthx.kattamanchi@intel.com>
On 9/1/21 10:33 AM, Thomas Hellström wrote:


On 8/31/21 8:51 PM, Patchwork wrote:
Patch Details
Series:
drm/i915/gem: Fix the mman selftest (rev2)
URL:
https://patchwork.freedesktop.org/series/94062/
State:
failure
Details:
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20928/index.html
CI Bug Log - changes from CI_DRM_10539_full -> Patchwork_20928_full
Summary

FAILURE

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

If you think the reported changes have nothing to do with the changes
introduced in Patchwork_20928_full, please notify your bug team to allow them
to document this new failure mode, which will reduce false positives in CI.

Possible new issues

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

IGT changes
Possible regressions

  *   igt@sysfs_heartbeat_interval@mixed@vcs0:

     *   shard-skl: PASS<https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10539/shard-skl9/igt@sysfs_heartbeat_interval@mixed@vcs0.html> -> WARN<https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20928/shard-skl6/igt@sysfs_heartbeat_interval@mixed@vcs0.html>


Lakshmi, this failure is unrelated.

Thanks,

Thomas
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
index b20f5621f62b..a2c34e5a1c54 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
@@ -581,6 +581,20 @@  static enum i915_mmap_type default_mapping(struct drm_i915_private *i915)
 	return I915_MMAP_TYPE_GTT;
 }
 
+static struct drm_i915_gem_object *
+create_sys_or_internal(struct drm_i915_private *i915,
+		       unsigned long size)
+{
+	if (HAS_LMEM(i915)) {
+		struct intel_memory_region *sys_region =
+			i915->mm.regions[INTEL_REGION_SMEM];
+
+		return __i915_gem_object_create_user(i915, size, &sys_region, 1);
+	}
+
+	return i915_gem_object_create_internal(i915, size);
+}
+
 static bool assert_mmap_offset(struct drm_i915_private *i915,
 			       unsigned long size,
 			       int expected)
@@ -589,7 +603,7 @@  static bool assert_mmap_offset(struct drm_i915_private *i915,
 	u64 offset;
 	int ret;
 
-	obj = i915_gem_object_create_internal(i915, size);
+	obj = create_sys_or_internal(i915, size);
 	if (IS_ERR(obj))
 		return expected && expected == PTR_ERR(obj);
 
@@ -633,6 +647,7 @@  static int igt_mmap_offset_exhaustion(void *arg)
 	struct drm_mm_node *hole, *next;
 	int loop, err = 0;
 	u64 offset;
+	int enospc = HAS_LMEM(i915) ? -ENXIO : -ENOSPC;
 
 	/* Disable background reaper */
 	disable_retire_worker(i915);
@@ -683,14 +698,14 @@  static int igt_mmap_offset_exhaustion(void *arg)
 	}
 
 	/* Too large */
-	if (!assert_mmap_offset(i915, 2 * PAGE_SIZE, -ENOSPC)) {
+	if (!assert_mmap_offset(i915, 2 * PAGE_SIZE, enospc)) {
 		pr_err("Unexpectedly succeeded in inserting too large object into single page hole\n");
 		err = -EINVAL;
 		goto out;
 	}
 
 	/* Fill the hole, further allocation attempts should then fail */
-	obj = i915_gem_object_create_internal(i915, PAGE_SIZE);
+	obj = create_sys_or_internal(i915, PAGE_SIZE);
 	if (IS_ERR(obj)) {
 		err = PTR_ERR(obj);
 		pr_err("Unable to create object for reclaimed hole\n");
@@ -703,7 +718,7 @@  static int igt_mmap_offset_exhaustion(void *arg)
 		goto err_obj;
 	}
 
-	if (!assert_mmap_offset(i915, PAGE_SIZE, -ENOSPC)) {
+	if (!assert_mmap_offset(i915, PAGE_SIZE, enospc)) {
 		pr_err("Unexpectedly succeeded in inserting object into no holes!\n");
 		err = -EINVAL;
 		goto err_obj;
@@ -839,10 +854,9 @@  static int wc_check(struct drm_i915_gem_object *obj)
 
 static bool can_mmap(struct drm_i915_gem_object *obj, enum i915_mmap_type type)
 {
-	struct drm_i915_private *i915 = to_i915(obj->base.dev);
 	bool no_map;
 
-	if (HAS_LMEM(i915))
+	if (obj->ops->mmap_offset)
 		return type == I915_MMAP_TYPE_FIXED;
 	else if (type == I915_MMAP_TYPE_FIXED)
 		return false;