Skip to contentSkip to conversation

drm/i915/gem: Explicitly return error value from eb_relocate helpers

PATCH Superseded Jonathan Cavitt 3 participants 5 messages Feb 4 – Feb 24

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915/gem: Explicitly return error value from eb_relocate helpers

Static analysis issue:

The current implementations of the eb_relocate_vma and eb_relocate_vma_slow functions cast the return value of eb_relocate_entry to a signed long in order to determine if an error has occurred. This is because the return value of eb_relocate_entry is a u64 offset value on a success and a negative error value on a failure.

While not mechanically incorrect, it is improper to perform a cast like this. So, just have eb_relocate_entry (and, by extension, its helper function relocate_entry) return the error value, storing the offset separately in a passed u64 pointer.

Interestingly, this value is only used for non-error-checking purposes in the eb_relocate_vma case. We can simplify the eb_relocate_vma_slow case by allowing the passed u64 pointer to be NULL because of this.

---
 .../gpu/drm/i915/gem/i915_gem_execbuffer.c    | 43 ++++++++++---------
 1 file changed, 22 insertions(+), 21 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +22 -21
index d49e96f9be51..450482837604 100644
@@ -1373,11 +1373,12 @@ static void clflush_write32(u32 *addr, u32 value, unsigned int flushes)
 	}
 }
 
-static u64
+static int
 relocate_entry(struct i915_vma *vma,
 	       const struct drm_i915_gem_relocation_entry *reloc,
 	       struct i915_execbuffer *eb,
-	       const struct i915_vma *target)
+	       const struct i915_vma *target,
+	       u64 *pin_offset)
 {
 	u64 target_addr = relocation_target(reloc, target);
 	u64 offset = reloc->offset;
@@ -1402,13 +1403,16 @@ relocate_entry(struct i915_vma *vma,
 		goto repeat;
 	}
 
-	return target->node.start | UPDATE;
+	if (pin_offset)
+		*pin_offset = target->node.start | UPDATE;
+	return 0;
 }
 
-static u64
+static int
 eb_relocate_entry(struct i915_execbuffer *eb,
 		  struct eb_vma *ev,
-		  const struct drm_i915_gem_relocation_entry *reloc)
+		  const struct drm_i915_gem_relocation_entry *reloc,
+		  u64 *offset)
 {
 	struct drm_i915_private *i915 = eb->i915;
 	struct eb_vma *target;
@@ -1505,7 +1509,7 @@ eb_relocate_entry(struct i915_execbuffer *eb,
 	ev->flags &= ~EXEC_OBJECT_ASYNC;
 
 	/* and update the user's relocation entry */
-	return relocate_entry(ev->vma, reloc, eb, target->vma);
+	return relocate_entry(ev->vma, reloc, eb, target->vma, offset);
 }
 
 static int eb_relocate_vma(struct i915_execbuffer *eb, struct eb_vma *ev)
@@ -1516,6 +1520,7 @@ static int eb_relocate_vma(struct i915_execbuffer *eb, struct eb_vma *ev)
 	struct drm_i915_gem_relocation_entry __user *urelocs =
 		u64_to_user_ptr(entry->relocs_ptr);
 	unsigned long remain = entry->relocation_count;
+	int err = 0;
 
 	if (unlikely(remain > N_RELOC(INT_MAX)))
 		return -EINVAL;
@@ -1546,21 +1551,21 @@ static int eb_relocate_vma(struct i915_execbuffer *eb, struct eb_vma *ev)
 		copied = __copy_from_user_inatomic(r, urelocs, count * sizeof(r[0]));
 		pagefault_enable();
 		if (unlikely(copied)) {
-			remain = -EFAULT;
+			err = -EFAULT;
 			goto out;
 		}
 
 		remain -= count;
 		do {
-			u64 offset = eb_relocate_entry(eb, ev, r);
+			u64 offset;
+
+			err = eb_relocate_entry(eb, ev, r, &offset);
 
 			if (likely(offset == 0))
 				continue;
 
-			if ((s64)offset < 0) {
-				remain = (int)offset;
+			if (err)
 				goto out;
-			}
 			/*
 			 * Note that reporting an error now
 			 * leaves everything in an inconsistent
@@ -1589,7 +1594,7 @@ static int eb_relocate_vma(struct i915_execbuffer *eb, struct eb_vma *ev)
 	} while (remain);
 out:
 	reloc_cache_reset(&eb->reloc_cache, eb);
-	return remain;
+	return err;
 }
 
 static int
@@ -1599,18 +1604,14 @@ eb_relocate_vma_slow(struct i915_execbuffer *eb, struct eb_vma *ev)
 	struct drm_i915_gem_relocation_entry *relocs =
 		u64_to_ptr(typeof(*relocs), entry->relocs_ptr);
 	unsigned int i;
-	int err;
+	int err = 0;
 
 	for (i = 0; i < entry->relocation_count; i++) {
-		u64 offset = eb_relocate_entry(eb, ev, &relocs[i]);
-
-		if ((s64)offset < 0) {
-			err = (int)offset;
-			goto err;
-		}
+		err = eb_relocate_entry(eb, ev, &relocs[i], NULL);
+		if (err)
+			break;
 	}
-	err = 0;
-err:
+
 	reloc_cache_reset(&eb->reloc_cache, eb);
 	return err;
 }
Signature · 1 line
2.43.0
#1 lore raw

✗ i915.CI.BAT: failure for drm/i915/gem: Explicitly return error value from eb_relocate helpers

== Series Details ==

== Series Details ==

Series: drm/i915/gem: Explicitly return error value from eb_relocate helpers
URL : https://patchwork.freedesktop.org/series/161167/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_17933 -> Patchwork_161167v1
====================================================

Summary
-------

**FAILURE**

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

If you think the reported changes have nothing to do with the changes
introduced in Patchwork_161167v1, please notify your bug team ([email protected]) 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_161167v1/index.html

Participating hosts (43 -> 41)
------------------------------

Missing (2): bat-dg2-13 fi-snb-2520m

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

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

### IGT changes ###

#### Possible regressions ####

* igt@gem_exec_gttfill@basic:
- bat-apl-1: [PASS][1] -> [ABORT][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17933/bat-apl-1/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v1/bat-apl-1/igt@[email protected]
- fi-bsw-nick: [PASS][3] -> [ABORT][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17933/fi-bsw-nick/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v1/fi-bsw-nick/igt@[email protected]

* igt@i915_module_load@load:
- bat-jsl-1: [PASS][5] -> [FAIL][6] +1 other test fail
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17933/bat-jsl-1/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v1/bat-jsl-1/igt@[email protected]
- fi-bsw-n3050: [PASS][7] -> [FAIL][8] +1 other test fail
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17933/fi-bsw-n3050/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v1/fi-bsw-n3050/igt@[email protected]
- fi-kbl-8809g: [PASS][9] -> [FAIL][10] +1 other test fail
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17933/fi-kbl-8809g/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v1/fi-kbl-8809g/igt@[email protected]
- bat-apl-1: [PASS][11] -> [FAIL][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17933/bat-apl-1/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v1/bat-apl-1/igt@[email protected]
- fi-tgl-1115g4: [PASS][13] -> [FAIL][14] +1 other test fail
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17933/fi-tgl-1115g4/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v1/fi-tgl-1115g4/igt@[email protected]
- fi-bsw-nick: [PASS][15] -> [FAIL][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17933/fi-bsw-nick/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v1/fi-bsw-nick/igt@[email protected]

* igt@i915_module_load@reload:
- fi-glk-j4005: [PASS][17] -> [FAIL][18] +1 other test fail
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17933/fi-glk-j4005/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v1/fi-glk-j4005/igt@[email protected]
- fi-kbl-7567u: [PASS][19] -> [FAIL][20] +1 other test fail
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17933/fi-kbl-7567u/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v1/fi-kbl-7567u/igt@[email protected]
- bat-jsl-5: [PASS][21] -> [FAIL][22] +1 other test fail
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17933/bat-jsl-5/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v1/bat-jsl-5/igt@[email protected]
- fi-cfl-guc: [PASS][23] -> [FAIL][24] +1 other test fail
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17933/fi-cfl-guc/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v1/fi-cfl-guc/igt@[email protected]
- fi-kbl-x1275: [PASS][25] -> [FAIL][26] +1 other test fail
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17933/fi-kbl-x1275/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v1/fi-kbl-x1275/igt@[email protected]
- fi-cfl-8109u: [PASS][27] -> [FAIL][28] +1 other test fail
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17933/fi-cfl-8109u/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v1/fi-cfl-8109u/igt@[email protected]
- fi-skl-6600u: [PASS][29] -> [FAIL][30] +1 other test fail
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17933/fi-skl-6600u/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v1/fi-skl-6600u/igt@[email protected]
- fi-cfl-8700k: [PASS][31] -> [FAIL][32] +1 other test fail
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17933/fi-cfl-8700k/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v1/fi-cfl-8700k/igt@[email protected]
- bat-kbl-2: [PASS][33] -> [FAIL][34] +1 other test fail
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17933/bat-kbl-2/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v1/bat-kbl-2/igt@[email protected]

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

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

### IGT changes ###

#### Issues hit ####

* igt@i915_selftest@live:
- bat-arlh-3: [PASS][35] -> [INCOMPLETE][36] ([i915#15622])
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17933/bat-arlh-3/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v1/bat-arlh-3/igt@[email protected]

* igt@i915_selftest@live@memory_region:
- bat-arlh-3: [PASS][37] -> [INCOMPLETE][38] ([i915#15630])
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17933/bat-arlh-3/igt@i915_selftest@live@memory_region.html
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v1/bat-arlh-3/igt@i915_selftest@live@memory_region.html

* igt@i915_selftest@live@workarounds:
- bat-arlh-3: [PASS][39] -> [DMESG-FAIL][40] ([i915#12061])
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17933/bat-arlh-3/igt@i915_selftest@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v1/bat-arlh-3/igt@i915_selftest@[email protected]

[i915#12061]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12061
[i915#15622]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15622
[i915#15630]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15630

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

* Linux: CI_DRM_17933 -> Patchwork_161167v1

CI-20190529: 20190529
CI_DRM_17933: 55e3e3aeecf80d9fd2536acd8ed785282be5a7b3 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_8736: 8736
Patchwork_161167v1: 55e3e3aeecf80d9fd2536acd8ed785282be5a7b3 @ git://anongit.freedesktop.org/gfx-ci/linux

== Logs ==

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

#2 lore raw

✗ i915.CI.BAT: failure for drm/i915/gem: Explicitly return error value from eb_relocate helpers (rev2)

In reply to Jonathan Cavitt
== Series Details ==

== Series Details ==

Series: drm/i915/gem: Explicitly return error value from eb_relocate helpers (rev2)
URL : https://patchwork.freedesktop.org/series/161167/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_18015 -> Patchwork_161167v2
====================================================

Summary
-------

**FAILURE**

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

If you think the reported changes have nothing to do with the changes
introduced in Patchwork_161167v2, please notify your bug team ([email protected]) 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_161167v2/index.html

Participating hosts (43 -> 40)
------------------------------

Missing (3): bat-dg2-13 fi-snb-2520m bat-adls-6

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

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

### IGT changes ###

#### Possible regressions ####

* igt@gem_exec_gttfill@basic:
- bat-apl-1: [PASS][1] -> [ABORT][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18015/bat-apl-1/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v2/bat-apl-1/igt@[email protected]
- fi-bsw-nick: [PASS][3] -> [ABORT][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18015/fi-bsw-nick/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v2/fi-bsw-nick/igt@[email protected]

* igt@i915_module_load@load:
- bat-jsl-1: [PASS][5] -> [FAIL][6] +1 other test fail
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18015/bat-jsl-1/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v2/bat-jsl-1/igt@[email protected]
- fi-bsw-n3050: [PASS][7] -> [FAIL][8] +1 other test fail
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18015/fi-bsw-n3050/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v2/fi-bsw-n3050/igt@[email protected]
- fi-kbl-8809g: [PASS][9] -> [FAIL][10] +1 other test fail
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18015/fi-kbl-8809g/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v2/fi-kbl-8809g/igt@[email protected]
- bat-apl-1: [PASS][11] -> [FAIL][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18015/bat-apl-1/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v2/bat-apl-1/igt@[email protected]
- fi-tgl-1115g4: [PASS][13] -> [FAIL][14] +1 other test fail
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18015/fi-tgl-1115g4/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v2/fi-tgl-1115g4/igt@[email protected]
- fi-bsw-nick: [PASS][15] -> [FAIL][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18015/fi-bsw-nick/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v2/fi-bsw-nick/igt@[email protected]

* igt@i915_module_load@reload:
- fi-glk-j4005: [PASS][17] -> [FAIL][18] +1 other test fail
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18015/fi-glk-j4005/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v2/fi-glk-j4005/igt@[email protected]
- fi-kbl-7567u: [PASS][19] -> [FAIL][20] +1 other test fail
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18015/fi-kbl-7567u/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v2/fi-kbl-7567u/igt@[email protected]
- bat-jsl-5: [PASS][21] -> [FAIL][22] +1 other test fail
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18015/bat-jsl-5/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v2/bat-jsl-5/igt@[email protected]
- fi-cfl-guc: [PASS][23] -> [FAIL][24] +1 other test fail
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18015/fi-cfl-guc/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v2/fi-cfl-guc/igt@[email protected]
- fi-kbl-x1275: [PASS][25] -> [FAIL][26] +1 other test fail
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18015/fi-kbl-x1275/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v2/fi-kbl-x1275/igt@[email protected]
- fi-cfl-8109u: [PASS][27] -> [FAIL][28] +1 other test fail
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18015/fi-cfl-8109u/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v2/fi-cfl-8109u/igt@[email protected]
- fi-skl-6600u: [PASS][29] -> [FAIL][30] +1 other test fail
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18015/fi-skl-6600u/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v2/fi-skl-6600u/igt@[email protected]
- fi-cfl-8700k: [PASS][31] -> [FAIL][32] +1 other test fail
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18015/fi-cfl-8700k/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v2/fi-cfl-8700k/igt@[email protected]
- bat-kbl-2: [PASS][33] -> [FAIL][34] +1 other test fail
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18015/bat-kbl-2/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v2/bat-kbl-2/igt@[email protected]

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

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

### IGT changes ###

#### Issues hit ####

* igt@i915_selftest@live@workarounds:
- bat-arlh-3: [PASS][35] -> [DMESG-FAIL][36] ([i915#12061]) +1 other test dmesg-fail
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18015/bat-arlh-3/igt@i915_selftest@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v2/bat-arlh-3/igt@i915_selftest@[email protected]
- bat-dg2-14: [PASS][37] -> [DMESG-FAIL][38] ([i915#12061]) +1 other test dmesg-fail
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18015/bat-dg2-14/igt@i915_selftest@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v2/bat-dg2-14/igt@i915_selftest@[email protected]

#### Possible fixes ####

* igt@i915_selftest@live@workarounds:
- bat-arls-6: [DMESG-FAIL][39] ([i915#12061]) -> [PASS][40] +1 other test pass
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18015/bat-arls-6/igt@i915_selftest@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_161167v2/bat-arls-6/igt@i915_selftest@[email protected]

[i915#12061]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12061

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

* Linux: CI_DRM_18015 -> Patchwork_161167v2

CI-20190529: 20190529
CI_DRM_18015: 7c2ed7e89e283615b5f133d0205061934541e26d @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_8764: 8764
Patchwork_161167v2: 7c2ed7e89e283615b5f133d0205061934541e26d @ git://anongit.freedesktop.org/gfx-ci/linux

== Logs ==

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

#3 lore raw
In reply to Jonathan Cavitt

Hi Jonathan,

Quoted 9 lines · Jonathan Cavitt

Static analysis issue:

The current implementations of the eb_relocate_vma and eb_relocate_vma_slow functions cast the return value of eb_relocate_entry to a signed long in order to determine if an error has occurred. This is because the return value of eb_relocate_entry is a u64 offset value on a success and a negative error value on a failure.

While not mechanically incorrect,

This might lower the perceived need for this change, just leave that it is improper to cast stuff like this and that should be good.

Quoted 5 lines

it is improper to perform a cast like
this. So, just have eb_relocate_entry (and, by extension, its helper function relocate_entry) return the error value, storing the offset separately in a passed u64 pointer.

Quoted 7 lines

Interestingly, this value is only used for non-error-checking purposes in the eb_relocate_vma case. We can simplify the eb_relocate_vma_slow case by allowing the passed u64 pointer to be NULL because of this.

---

I think the code looks good, but you should address failures from i915 CI - both test runs on this patch look more or less the same, so this change might be breaking something.

Signature · 2 lines
Best Regards,
Krzysztof
#4 lore raw

-----Original Message-----
From: Karas, Krzysztof <[email protected]>
Sent: Tuesday, February 24, 2026 8:19 AM
To: Cavitt, Jonathan <[email protected]>
Cc: [email protected]; Gupta, Saurabhg <[email protected]>; Zuo, Alex <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/i915/gem: Explicitly return error value from eb_relocate helpers

Quoted 12 lines

Hi Jonathan,

Quoted 8 lines · Jonathan Cavitt

Static analysis issue:

The current implementations of the eb_relocate_vma and eb_relocate_vma_slow functions cast the return value of eb_relocate_entry to a signed long in order to determine if an error has occurred. This is because the return value of eb_relocate_entry is a u64 offset value on a success and a negative error value on a failure.

Quoted 3 lines
Quoted 1 line

While not mechanically incorrect,

This might lower the perceived need for this change, just leave that it is improper to cast stuff like this and that should be good.

Will do.

Quoted 10 lines
Quoted 10 lines

it is improper to perform a cast like
this. So, just have eb_relocate_entry (and, by extension, its helper function relocate_entry) return the error value, storing the offset separately in a passed u64 pointer.

Interestingly, this value is only used for non-error-checking purposes in the eb_relocate_vma case. We can simplify the eb_relocate_vma_slow case by allowing the passed u64 pointer to be NULL because of this.

Quoted 7 lines
Quoted 3 lines

---

I think the code looks good, but you should address failures from i915 CI - both test runs on this patch look more or less the same, so this change might be breaking something.

Found it: offset and error values were no longer correlated, so when an error would occur in eb_relocate_vma, it would be ignored due to offset == 0 hitting first. Reordering the two cases should repair the issue. Will submit an update shortly. -Jonathan Cavitt

Quoted 5 lines
Signature · 3 lines
-- 
Best Regards,
Krzysztof