Skip to contentSkip to conversation

lib: Always set mismatching index for igt_find_crc_mismatch

PATCH In review Chris Wilson 3 participants 10 messages Feb 19, 2018 – Feb 20, 2018 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 lib: Always set mismatching index for igt_find_crc_mismatch

igt_debugfs.c: In function 'igt_assert_crc_equal':
igt_debugfs.c:353:3: warning: 'index' may be used uninitialized in this function [-Wmaybe-uninitialized] igt_debugfs.c: In function 'igt_check_crc_equal':
igt_debugfs.c:375:3: warning: 'index' may be used uninitialized in this function [-Wmaybe-uninitialized]

Fixes 7422d7540a3b ("lib/igt_debugfs: Introduce CRC check function, with logic made common")
---
 lib/igt_debugfs.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
lib/igt_debugfs.c +8 -4
index 4a119985..7399ae23 100644
@@ -315,12 +315,10 @@ bool igt_debugfs_search(int device, const char *filename, const char *substring)
 static bool igt_find_crc_mismatch(const igt_crc_t *a, const igt_crc_t *b,
 				  int *index)
 {
+	int nwords = min(a->n_words, b->n_words);
 	int i;
 
-	if (a->n_words != b->n_words)
-		return true;
-
-	for (i = 0; i < a->n_words; i++) {
+	for (i = 0; i < nwords; i++) {
 		if (a->crc[i] != b->crc[i]) {
 			if (index)
 				*index = i;
@@ -329,6 +327,12 @@ static bool igt_find_crc_mismatch(const igt_crc_t *a, const igt_crc_t *b,
 		}
 	}
 
+	if (a->n_words != b->n_words) {
+		if (index)
+			*index = i;
+		return true;
+	}
+
 	return false;
 }
 
Signature · 6 lines
2.16.1

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

PATCH 2/4 igt/gem_exec_flush: Silence old compiler warning

gem_exec_flush.c: In function ‘batch’:
gem_exec_flush.c:443:15: warning: ‘ptr’ may be used uninitialized in this function [-Wmaybe-uninitialized]

---
 tests/gem_exec_flush.c | 5 +++++
 1 file changed, 5 insertions(+)
tests/gem_exec_flush.c +5 -0
index c93eee4b..f820b2a8 100644
@@ -426,6 +426,11 @@ static void batch(int fd, unsigned ring, int nchild, int timeout,
 			ptr = mmap(0, 64<<10, PROT_WRITE,
 				   MAP_PRIVATE | MAP_ANON, -1, 0);
 			break;
+
+		default:
+			igt_assert(!"reachable");
+			ptr = NULL;
+			break;
 		}
 
 		memset(&reloc, 0, sizeof(reloc));
Signature · 6 lines
2.16.1

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

Re: [PATCH igt 2/4] igt/gem_exec_flush: Silence old compiler warning

Quoting Chris Wilson (2018-02-19 22:12:26)

Quoted 4 lines

gem_exec_flush.c: In function ‘batch’:
gem_exec_flush.c:443:15: warning: ‘ptr’ may be used uninitialized in this function [-Wmaybe-uninitialized]

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

#3 lore raw

PATCH 3/4 igt/syncobj: Tidy ye olde compiler warnings

In reply to Chris Wilson

syncobj_basic.c: In function ‘__real_main225’:
syncobj_basic.c:202:26: warning: ‘fd’ may be used uninitialized in this function [-Wmaybe-uninitialized] syncobj_basic.c:227:6: note: ‘fd’ was declared here
syncobj_wait.c: In function ‘test_wait_complex’:
syncobj_wait.c:702:3: warning: ‘first_signaled’ may be used uninitialized in this function [-Wmaybe-uninitialized] syncobj_wait.c: In function ‘__real_main758’:
syncobj_wait.c:492:24: warning: ‘timeline’ may be used uninitialized in this function [-Wmaybe-uninitialized] syncobj_wait.c:473:15: note: ‘timeline’ was declared here
syncobj_wait.c:326:23: warning: ‘timeline’ may be used uninitialized in this function [-Wmaybe-uninitialized] syncobj_wait.c:320:6: note: ‘timeline’ was declared here
syncobj_wait.c:406:31: warning: ‘fd’ may be used uninitialized in this function [-Wmaybe-uninitialized] syncobj_wait.c:760:6: note: ‘fd’ was declared here

---
 tests/syncobj_basic.c |  2 +-
 tests/syncobj_wait.c  | 12 +++++++-----
 2 files changed, 8 insertions(+), 6 deletions(-)
tests/syncobj_basic.c +1 -1
index acc4a641..44769d3b 100644
@@ -187,7 +187,7 @@ static bool has_syncobj(int fd)
 
 igt_main
 {
-	int fd;
+	int fd = -1;
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_ANY);
tests/syncobj_wait.c +7 -5
index 49e6d372..04d79de7 100644
@@ -317,7 +317,7 @@ test_single_wait(int fd, uint32_t test_flags, int expect)
 {
 	uint32_t syncobj = syncobj_create(fd, 0);
 	uint32_t flags = flags_for_test_flags(test_flags);
-	int timeline;
+	int timeline = -1;
 
 	if (test_flags & (WAIT_SUBMITTED | WAIT_SIGNALED))
 		timeline = syncobj_attach_sw_sync(fd, syncobj);
@@ -336,6 +336,8 @@ test_single_wait(int fd, uint32_t test_flags, int expect)
 	}
 
 	syncobj_destroy(fd, syncobj);
+	if (timeline != -1)
+		close(timeline);
 }
 
 static void
@@ -343,7 +345,7 @@ test_wait_delayed_signal(int fd, uint32_t test_flags)
 {
 	uint32_t syncobj = syncobj_create(fd, 0);
 	uint32_t flags = flags_for_test_flags(test_flags);
-	int timeline;
+	int timeline = -1;
 	timer_t timer;
 
 	if (test_flags & WAIT_FOR_SUBMIT) {
@@ -360,7 +362,7 @@ test_wait_delayed_signal(int fd, uint32_t test_flags)
 
 	timer_delete(timer);
 
-	if (!(test_flags & WAIT_FOR_SUBMIT))
+	if (timeline != -1)
 		close(timeline);
 
 	syncobj_destroy(fd, syncobj);
@@ -614,7 +616,7 @@ test_wait_complex(int fd, uint32_t test_flags)
 	uint32_t syncobjs[8];
 	enum syncobj_stage stage[8];
 	int i, j, timelines[8];
-	uint32_t first_signaled, num_signaled;
+	uint32_t first_signaled = -1, num_signaled = 0;
 	pthread_t thread;
 
 	for (i = 0; i < 8; i++) {
@@ -757,7 +759,7 @@ has_syncobj_wait(int fd)
 
 igt_main
 {
-	int fd;
+	int fd = -1;
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_ANY);
Signature · 6 lines
2.16.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 3/4
#4 lore raw

Re: [PATCH igt 3/4] igt/syncobj: Tidy ye olde compiler warnings

Quoting Chris Wilson (2018-02-19 22:12:27)

Quoted 13 lines

syncobj_basic.c: In function ‘__real_main225’:
syncobj_basic.c:202:26: warning: ‘fd’ may be used uninitialized in this function [-Wmaybe-uninitialized] syncobj_basic.c:227:6: note: ‘fd’ was declared here
syncobj_wait.c: In function ‘test_wait_complex’:
syncobj_wait.c:702:3: warning: ‘first_signaled’ may be used uninitialized in this function [-Wmaybe-uninitialized] syncobj_wait.c: In function ‘__real_main758’:
syncobj_wait.c:492:24: warning: ‘timeline’ may be used uninitialized in this function [-Wmaybe-uninitialized] syncobj_wait.c:473:15: note: ‘timeline’ was declared here
syncobj_wait.c:326:23: warning: ‘timeline’ may be used uninitialized in this function [-Wmaybe-uninitialized] syncobj_wait.c:320:6: note: ‘timeline’ was declared here
syncobj_wait.c:406:31: warning: ‘fd’ may be used uninitialized in this function [-Wmaybe-uninitialized] syncobj_wait.c:760:6: note: ‘fd’ was declared here

Quoted 1 line

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

#5 lore raw

PATCH 4/4 lib: Remove overzealous assertion on gem_set_caching()

In reply to Chris Wilson

When the asserts were added for the acceptable error codes for SET_CACHING ioctl, foresight was not given to the possibility that the device may not handle the caching mode and return -ENODEV. Remove the error code assertion from the library, that is the job for the ABI tests.

---
 lib/ioctl_wrappers.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
lib/ioctl_wrappers.c +3 -4
index 7b656cce..8748cfcf 100644
@@ -208,10 +208,10 @@ static int __gem_set_caching(int fd, uint32_t handle, uint32_t caching)
 	arg.caching = caching;
 
 	err = 0;
-	if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_SET_CACHING, &arg)) {
+	if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_SET_CACHING, &arg))
 		err = -errno;
-		igt_assert(errno == ENOTTY || errno == EINVAL);
-	}
+
+	errno = 0;
 	return err;
 }
 
@@ -229,7 +229,6 @@ static int __gem_set_caching(int fd, uint32_t handle, uint32_t caching)
 void gem_set_caching(int fd, uint32_t handle, uint32_t caching)
 {
 	igt_require(__gem_set_caching(fd, handle, caching) == 0);
-	errno = 0;
 }
 
 /**
Signature · 6 lines
2.16.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 4/4
#6 lore raw

Re: [PATCH igt 4/4] lib: Remove overzealous assertion on gem_set_caching()

Quoting Chris Wilson (2018-02-19 22:12:28)

Quoted 7 lines

When the asserts were added for the acceptable error codes for SET_CACHING ioctl, foresight was not given to the possibility that the device may not handle the caching mode and return -ENODEV. Remove the error code assertion from the library, that is the job for the ABI tests.

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

#7 lore raw

✓ Fi.CI.BAT: success for series starting with [1/4] lib: Always set mismatching index for igt_find_crc_mismatch

In reply to Chris Wilson
== Series Details ==

== Series Details ==

Series: series starting with [1/4] lib: Always set mismatching index for igt_find_crc_mismatch
URL : https://patchwork.freedesktop.org/series/38547/
State : success

== Summary ==

IGT patchset tested on top of latest successful build 6fc91dbb67eea6824100905a4ab1fb38f186dba0 perf_pmu: Fix some compile warnings with old compilers / 32-bit builds

with latest DRM-Tip kernel build CI_DRM_3801
6e9c17ec8ab6 drm-tip: 2018y-02m-19d-19h-44m-13s UTC integration manifest

No testlist changes.

Test kms_frontbuffer_tracking:

        Subgroup basic:
                fail       -> PASS       (fi-cnl-y3) fdo#103167
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-b:
                incomplete -> PASS       (fi-snb-2520m) fdo#103713
Test prime_vgem:
        Subgroup basic-fence-flip:
                pass       -> FAIL       (fi-ilk-650) fdo#104008

fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
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:427s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:377s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:487s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:288s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:481s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:486s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:474s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:462s
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:570s
fi-cnl-y3        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:583s
fi-elk-e7500     total:288  pass:229  dwarn:0   dfail:0   fail:0   skip:59  time:419s
fi-gdg-551       total:288  pass:180  dwarn:0   dfail:0   fail:0   skip:108 time:287s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:515s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:399s
fi-ilk-650       total:288  pass:227  dwarn:0   dfail:0   fail:1   skip:60  time:417s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:459s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:423s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:462s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:499s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:454s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:501s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:591s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:431s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:508s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:530s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:497s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:482s
fi-skl-guc       total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:420s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:431s
fi-snb-2520m     total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:519s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:400s

== Logs ==

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

#8 lore raw

✓ Fi.CI.IGT: success for series starting with [1/4] lib: Always set mismatching index for igt_find_crc_mismatch

In reply to Chris Wilson
== Series Details ==

== Series Details ==

Series: series starting with [1/4] lib: Always set mismatching index for igt_find_crc_mismatch
URL : https://patchwork.freedesktop.org/series/38547/
State : success

== Summary ==

Test kms_sysfs_edid_timing:

                pass       -> WARN       (shard-apl) fdo#100047
Test kms_plane_lowres:
        Subgroup pipe-b-tiling-y:
                pass       -> FAIL       (shard-apl) fdo#103166
Test perf:
        Subgroup buffer-fill:
                pass       -> FAIL       (shard-apl) fdo#103755
Test kms_setmode:
        Subgroup basic:
                pass       -> FAIL       (shard-hsw) fdo#99912
Test gem_softpin:
        Subgroup noreloc-s3:
                dmesg-warn -> PASS       (shard-snb) fdo#103375
Test gem_eio:
        Subgroup in-flight:
                fail       -> PASS       (shard-hsw) fdo#104676

fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#103755 https://bugs.freedesktop.org/show_bug.cgi?id=103755
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#104676 https://bugs.freedesktop.org/show_bug.cgi?id=104676

shard-apl        total:3345 pass:1747 dwarn:1   dfail:0   fail:14  skip:1581 time:12309s
shard-hsw        total:3434 pass:1762 dwarn:1   dfail:0   fail:2   skip:1668 time:11683s
shard-snb        total:3434 pass:1352 dwarn:1   dfail:0   fail:2   skip:2079 time:6625s

Blacklisted hosts:
shard-kbl total:3434 pass:1915 dwarn:10 dfail:0 fail:14 skip:1495 time:9752s

== Logs ==

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

Reviewed-by on v1 1/4
#9 lore raw
In reply to Chris Wilson

Quoting Chris Wilson (2018-02-19 22:12:25)

Quoted 7 lines

igt_debugfs.c: In function 'igt_assert_crc_equal':
igt_debugfs.c:353:3: warning: 'index' may be used uninitialized in this function [-Wmaybe-uninitialized] igt_debugfs.c: In function 'igt_check_crc_equal':
igt_debugfs.c:375:3: warning: 'index' may be used uninitialized in this function [-Wmaybe-uninitialized]

Fixes 7422d7540a3b ("lib/igt_debugfs: Introduce CRC check function, with logic made common")

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