Skip to contentSkip to conversation

drm/i915: fix rsvd2 mask when out-fence is returned

PATCH In review Daniele Ceraolo Spurio 3 participants 9 messages Feb 14, 2018 – Feb 15, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: fix rsvd2 mask when out-fence is returned

GENMASK_ULL wants the high bit of the mask first. The current value cancels the in-fence when an out-fence is returned

Fixes fec0445caa273 ("drm/i915: Support explicit fencing for execbuf")
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +1 -1
index b15305f2fb76..ed6e9db51e67 100644
@@ -2410,7 +2410,7 @@ i915_gem_do_execbuffer(struct drm_device *dev,
 	if (out_fence) {
 		if (err == 0) {
 			fd_install(out_fence_fd, out_fence->file);
-			args->rsvd2 &= GENMASK_ULL(0, 31); /* keep in-fence */
+			args->rsvd2 &= GENMASK_ULL(31, 0); /* keep in-fence */
 			args->rsvd2 |= (u64)out_fence_fd << 32;
 			out_fence_fd = -1;
 		} else {
Signature · 6 lines
2.16.1

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

PATCH 1/1 tests/gem_exec_fence: test that in-fence is not overwritten

When an out-fence is returned we expect that the in-fence is not overwritten. Add a test to check for that.

---
 tests/gem_exec_fence.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
tests/gem_exec_fence.c +39 -0
index bd7b1263..f7478c55 100644
@@ -586,6 +586,42 @@ static void test_parallel(int fd, unsigned int master)
 	gem_close(fd, handle[0]);
 }
 
+/* check that a fence in doesn't get clobbered when a fence out is returned */
+static void test_keep_fence_in(int fd, unsigned int engine)
+{
+	struct drm_i915_gem_execbuffer2 execbuf;
+	struct drm_i915_gem_exec_object2 obj;
+	const uint32_t bbe = MI_BATCH_BUFFER_END;
+	int fence;
+
+	memset(&obj, 0, sizeof(obj));
+	memset(&execbuf, 0, sizeof(execbuf));
+
+	obj.handle = gem_create(fd, 4096);
+	gem_write(fd, obj.handle, 0, &bbe, sizeof(bbe));
+
+	execbuf.buffers_ptr = to_user_pointer(&obj);
+	execbuf.buffer_count = 1;
+	execbuf.flags = engine | LOCAL_EXEC_FENCE_OUT;
+
+	gem_execbuf_wr(fd, &execbuf);
+	fence = execbuf.rsvd2 >> 32;
+
+	gem_close(fd, obj.handle);
+	obj.handle = gem_create(fd, 4096);
+	gem_write(fd, obj.handle, 0, &bbe, sizeof(bbe));
+
+	execbuf.flags |= LOCAL_EXEC_FENCE_IN;
+	execbuf.rsvd2 = fence;
+
+	gem_execbuf_wr(fd, &execbuf);
+	igt_assert_eq(fence, execbuf.rsvd2 & 0xFFFFFFFF);
+
+	gem_close(fd, obj.handle);
+	close(fence);
+	close(execbuf.rsvd2 >> 32);
+}
+
 #define EXPIRED 0x10000
 static void test_long_history(int fd, long ring_size, unsigned flags)
 {
@@ -1499,6 +1535,9 @@ igt_main
 					}
 				}
 
+				igt_subtest_f("keep-fence-in-%s", e->name)
+					test_keep_fence_in(i915, e->exec_id | e->flags);
+
 				igt_fixture {
 					igt_stop_hang_detector();
 				}
Signature · 6 lines
2.16.1

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

Re: [PATCH i-g-t] tests/gem_exec_fence: test that in-fence is not overwritten

Quoting Daniele Ceraolo Spurio (2018-02-14 19:18:26)

Quoted 31 lines

When an out-fence is returned we expect that the in-fence is not overwritten. Add a test to check for that.

---
 tests/gem_exec_fence.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
tests/gem_exec_fence.c +14 -0
index bd7b1263..f7478c55 100644
@@ -586,6 +586,42 @@ static void test_parallel(int fd, unsigned int master)
        gem_close(fd, handle[0]);
 }
 
+/* check that a fence in doesn't get clobbered when a fence out is returned */
+static void test_keep_fence_in(int fd, unsigned int engine)
+{
+       struct drm_i915_gem_execbuffer2 execbuf;
+       struct drm_i915_gem_exec_object2 obj;
+       const uint32_t bbe = MI_BATCH_BUFFER_END;
+       int fence;
+
+       memset(&obj, 0, sizeof(obj));
+       memset(&execbuf, 0, sizeof(execbuf));
+
+       obj.handle = gem_create(fd, 4096);
+       gem_write(fd, obj.handle, 0, &bbe, sizeof(bbe));
+

tests/gem_exec_fence.c static void test_parallel(int fd, unsigned int master) · line 612

Quoted 10 lines
tests/gem_exec_fence.c +10 -0
+       execbuf.buffers_ptr = to_user_pointer(&obj);
+       execbuf.buffer_count = 1;
+       execbuf.flags = engine | LOCAL_EXEC_FENCE_OUT;
+
+       gem_execbuf_wr(fd, &execbuf);
+       fence = execbuf.rsvd2 >> 32;
+
+       gem_close(fd, obj.handle);
+       obj.handle = gem_create(fd, 4096);
+       gem_write(fd, obj.handle, 0, &bbe, sizeof(bbe));

You don't need to recreate the batch here; just reusing the same handle will do (and avoid the extra complication).

tests/gem_exec_fence.c static void test_parallel(int fd, unsigned int master) · line 618

Quoted 6 lines
tests/gem_exec_fence.c +6 -0
+
+       execbuf.flags |= LOCAL_EXEC_FENCE_IN;
+       execbuf.rsvd2 = fence;
+
+       gem_execbuf_wr(fd, &execbuf);
+       igt_assert_eq(fence, execbuf.rsvd2 & 0xFFFFFFFF);

This would be a good one to throw to the interruptible wolves.

static void test_keep_fence_in(int fd, unsigned int engine, unsigned int flags) #define INTR 0x1

...

	igt_while_interruptible(flags & INTR)
		gem_execbuf_wr(fd, &execbuf);
	igt_assert_eq(fence, lower_32_bits(execbuf.rsvd2));

igt_subtest_f("keep-fence-in-%s", e->name)

	test_keep_fence_in(i915, e->exec_id | e->flags, 0);

igt_subtest_f("keep-fence-in-%s-interruptible", e->name)

	test_keep_fence_in(i915, e->exec_id | e->flags, INTR);

tests/gem_exec_fence.c static void test_parallel(int fd, unsigned int master) · line 623

Quoted 5 lines
tests/gem_exec_fence.c +5 -0
+
+       gem_close(fd, obj.handle);
+       close(fence);
+       close(execbuf.rsvd2 >> 32);
+}

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

#3 lore raw

Re: [PATCH i-g-t] tests/gem_exec_fence: test that in-fence is not overwritten

Quoting Chris Wilson (2018-02-14 19:29:29)

Quoted 46 lines

Quoting Daniele Ceraolo Spurio (2018-02-14 19:18:26)

Quoted 31 lines

When an out-fence is returned we expect that the in-fence is not overwritten. Add a test to check for that.

---
 tests/gem_exec_fence.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
tests/gem_exec_fence.c +14 -0
index bd7b1263..f7478c55 100644
@@ -586,6 +586,42 @@ static void test_parallel(int fd, unsigned int master)
        gem_close(fd, handle[0]);
 }
 
+/* check that a fence in doesn't get clobbered when a fence out is returned */
+static void test_keep_fence_in(int fd, unsigned int engine)
+{
+       struct drm_i915_gem_execbuffer2 execbuf;
+       struct drm_i915_gem_exec_object2 obj;
+       const uint32_t bbe = MI_BATCH_BUFFER_END;
+       int fence;
+
+       memset(&obj, 0, sizeof(obj));
+       memset(&execbuf, 0, sizeof(execbuf));
+
+       obj.handle = gem_create(fd, 4096);
+       gem_write(fd, obj.handle, 0, &bbe, sizeof(bbe));
+

tests/gem_exec_fence.c static void test_parallel(int fd, unsigned int master) · line 612

Quoted 10 lines
tests/gem_exec_fence.c +10 -0
+       execbuf.buffers_ptr = to_user_pointer(&obj);
+       execbuf.buffer_count = 1;
+       execbuf.flags = engine | LOCAL_EXEC_FENCE_OUT;
+
+       gem_execbuf_wr(fd, &execbuf);
+       fence = execbuf.rsvd2 >> 32;
+
+       gem_close(fd, obj.handle);
+       obj.handle = gem_create(fd, 4096);
+       gem_write(fd, obj.handle, 0, &bbe, sizeof(bbe));

You don't need to recreate the batch here; just reusing the same handle will do (and avoid the extra complication).

Quoted 8 lines

tests/gem_exec_fence.c static void test_parallel(int fd, unsigned int master) · line 618

Quoted 6 lines
tests/gem_exec_fence.c +6 -0
+
+       execbuf.flags |= LOCAL_EXEC_FENCE_IN;
+       execbuf.rsvd2 = fence;
+
+       gem_execbuf_wr(fd, &execbuf);
+       igt_assert_eq(fence, execbuf.rsvd2 & 0xFFFFFFFF);

This would be a good one to throw to the interruptible wolves.

Of course to actually interrupt it, we need to hit a wait. Hmm. I'd use a variant of the measure ring size approach, scrap the second test, and then repeatedly re-submit until it hit an EINTR. (Obviously requires a timer, and updating/checking the fences on each pass). -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 1/1
#4 lore raw
In reply to Daniele Ceraolo Spurio

Quoting Daniele Ceraolo Spurio (2018-02-14 19:18:25)

Quoted 4 lines

GENMASK_ULL wants the high bit of the mask first. The current value cancels the in-fence when an out-fence is returned

Fixes fec0445caa273 ("drm/i915: Support explicit fencing for execbuf")

Testcase: igt/gem_exec_fence/whatever-you-called-it

Quoted 11 lines
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +0 -0
index b15305f2fb76..ed6e9db51e67 100644

drivers/gpu/drm/i915/i915_gem_execbuffer.c i915_gem_do_execbuffer(struct drm_device *dev, · line 2413

Quoted 5 lines
drivers/gpu/drm/i915/i915_gem_execbuffer.c +1 -1
@@ -2410,7 +2410,7 @@ i915_gem_do_execbuffer(struct drm_device *dev,
        if (out_fence) {
                if (err == 0) {
                        fd_install(out_fence_fd, out_fence->file);
-                       args->rsvd2 &= GENMASK_ULL(0, 31); /* keep in-fence */
+                       args->rsvd2 &= GENMASK_ULL(31, 0); /* keep in-fence */

OMG.

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

#5 lore raw

✓ Fi.CI.BAT: success for drm/i915: fix rsvd2 mask when out-fence is returned

In reply to Daniele Ceraolo Spurio
== Series Details ==

== Series Details ==

Series: drm/i915: fix rsvd2 mask when out-fence is returned
URL : https://patchwork.freedesktop.org/series/38284/
State : success

== Summary ==

Series 38284v1 drm/i915: fix rsvd2 mask when out-fence is returned
https://patchwork.freedesktop.org/api/1.0/series/38284/revisions/1/mbox/

Test kms_force_connector_basic:

        Subgroup force-connector-state:
                skip       -> PASS       (fi-snb-2520m)
        Subgroup force-edid:
                skip       -> PASS       (fi-snb-2520m)
        Subgroup force-load-detect:
                skip       -> PASS       (fi-snb-2520m)
        Subgroup prune-stale-modes:
                skip       -> PASS       (fi-snb-2520m)
Test prime_vgem:
        Subgroup basic-fence-flip:
                fail       -> PASS       (fi-ilk-650) fdo#104008

fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:421s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:423s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:374s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:485s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:287s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:485s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:469s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:456s
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:568s
fi-cnl-y3        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:587s
fi-elk-e7500     total:288  pass:229  dwarn:0   dfail:0   fail:0   skip:59  time:417s
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:283s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:511s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:390s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:418s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:460s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:415s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:455s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:491s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:497s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:585s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:428s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:509s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:528s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:489s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:473s
fi-skl-guc       total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:416s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:429s
fi-snb-2520m     total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:520s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:398s
Blacklisted hosts:
fi-glk-dsi       total:246  pass:219  dwarn:0   dfail:0   fail:0   skip:26 
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:462s

fi-bxt-dsi failed to collect. IGT log at Patchwork_8029/fi-bxt-dsi/run0.log

1cf237a2160af1a670d75523e073ff8614780b99 drm-tip: 2018y-02m-14d-19h-43m-47s UTC integration manifest 4a48bcdaa057 drm/i915: fix rsvd2 mask when out-fence is returned

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8029/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw
In reply to Daniele Ceraolo Spurio

Quoting Daniele Ceraolo Spurio (2018-02-14 19:18:25)

Quoted 6 lines

GENMASK_ULL wants the high bit of the mask first. The current value cancels the in-fence when an out-fence is returned

Fixes fec0445caa273 ("drm/i915: Support explicit fencing for execbuf")
Cc Chris Wilson <[email protected]>

Pushed, thanks for the fix and the test case.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

✗ Fi.CI.BAT: failure for tests/gem_exec_fence: test that in-fence is not overwritten

In reply to Daniele Ceraolo Spurio
== Series Details ==

== Series Details ==

Series: tests/gem_exec_fence: test that in-fence is not overwritten
URL : https://patchwork.freedesktop.org/series/38283/
State : failure

== Summary ==

Applying: tests/gem_exec_fence: test that in-fence is not overwritten Using index info to reconstruct a base tree...
M tests/gem_exec_fence.c
Falling back to patching base and 3-way merge...
Auto-merging tests/gem_exec_fence.c
CONFLICT (content): Merge conflict in tests/gem_exec_fence.c
Patch failed at 0001 tests/gem_exec_fence: test that in-fence is not overwritten The copy of the patch that failed is found in: .git/rebase-apply/patch When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

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

#8 lore raw

✓ Fi.CI.IGT: success for drm/i915: fix rsvd2 mask when out-fence is returned

In reply to Daniele Ceraolo Spurio
== Series Details ==

== Series Details ==

Series: drm/i915: fix rsvd2 mask when out-fence is returned
URL : https://patchwork.freedesktop.org/series/38284/
State : success

== Summary ==

Test kms_flip:

        Subgroup plain-flip-ts-check-interruptible:
                fail       -> PASS       (shard-hsw) fdo#100368
        Subgroup flip-vs-expired-vblank:
                fail       -> PASS       (shard-apl) fdo#102887
Test gem_eio:
        Subgroup hibernate:
                incomplete -> PASS       (shard-hsw) fdo#103540
Test pm_rpm:
        Subgroup system-suspend-execbuf:
                pass       -> SKIP       (shard-hsw) fdo#103375
Test perf:
        Subgroup oa-exponents:
                pass       -> FAIL       (shard-apl) fdo#102254
Test kms_cursor_legacy:
        Subgroup 2x-long-flip-vs-cursor-legacy:
                pass       -> FAIL       (shard-hsw) fdo#104873
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-pri-indfb-multidraw:
                pass       -> FAIL       (shard-snb) fdo#103167

fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#103540 https://bugs.freedesktop.org/show_bug.cgi?id=103540
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#102254 https://bugs.freedesktop.org/show_bug.cgi?id=102254
fdo#104873 https://bugs.freedesktop.org/show_bug.cgi?id=104873
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167

shard-apl        total:3414 pass:1772 dwarn:1   dfail:0   fail:21  skip:1618 time:13728s
shard-hsw        total:3427 pass:1757 dwarn:1   dfail:0   fail:11  skip:1657 time:14495s
shard-snb        total:3427 pass:1346 dwarn:1   dfail:0   fail:12  skip:2068 time:7518s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8029/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx