Skip to contentSkip to conversation

tests/kms_flip: Fix comparison of unsigned integers

PATCH In review Petri Latvala 5 participants 7 messages Feb 7, 2019 – Mar 6, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/kms_flip: Fix comparison of unsigned integers

Difference of unsigned ints is unsigned int, and therefore always larger than zero.

---
 tests/kms_flip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/kms_flip.c +1 -1
index 798fc4e8..96f4a2f7 100755
@@ -502,7 +502,7 @@ static void check_state(const struct test_output *o, const struct event_state *e
 	if (o->flags & TEST_TS_CONT) {
 		/* Ignore seq_step here since vblank waits time out immediately
 		 * when we kill the crtc. */
-		igt_assert_f(es->current_seq - es->last_seq >= 0,
+		igt_assert_f(es->current_seq >= es->last_seq,
 			     "unexpected %s seq %u, should be >= %u\n",
 			     es->name, es->current_seq, es->last_seq);
 		igt_assert_f(es->current_seq - es->last_seq <= 150,
Signature · 6 lines
2.19.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Petri Latvala

Difference of unsigned ints is unsigned int, and therefore always larger than zero.

I think we have some other tests for this, but this looks correct.

Quoted 20 lines
---
 tests/kms_flip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/kms_flip.c +1 -1
index 798fc4e8..96f4a2f7 100755
@@ -502,7 +502,7 @@ static void check_state(const struct test_output *o, const struct event_state *e
 	if (o->flags & TEST_TS_CONT) {
 		/* Ignore seq_step here since vblank waits time out immediately
 		 * when we kill the crtc. */
-		igt_assert_f(es->current_seq - es->last_seq >= 0,
+		igt_assert_f(es->current_seq >= es->last_seq,
 			     "unexpected %s seq %u, should be >= %u\n",
 			     es->name, es->current_seq, es->last_seq);
 		igt_assert_f(es->current_seq - es->last_seq <= 150,
Signature · 1 line
2.19.1
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#2 lore raw
In reply to Petri Latvala
Quoted 14 lines · Petri Latvala

Difference of unsigned ints is unsigned int, and therefore always larger than zero.

---
 tests/kms_flip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/kms_flip.c +0 -0
index 798fc4e8..96f4a2f7 100755

tests/kms_flip.c static void check_state(const struct test_output *o, const struct event_state *e · line 505

Quoted 5 lines
tests/kms_flip.c +1 -1
@@ -502,7 +502,7 @@ static void check_state(const struct test_output *o, const struct event_state *e
 	if (o->flags & TEST_TS_CONT) {
 		/* Ignore seq_step here since vblank waits time out immediately
 		 * when we kill the crtc. */
-		igt_assert_f(es->current_seq - es->last_seq >= 0,
+		igt_assert_f(es->current_seq >= es->last_seq,

That won't handle wraparound. I guess I should actually push my vblank_before/after() stuff and extend its use a bit.

Assuming I can still find it...

Quoted 10 lines
tests/kms_flip.c +0 -0
 			     "unexpected %s seq %u, should be >= %u\n",
 			     es->name, es->current_seq, es->last_seq);
 		igt_assert_f(es->current_seq - es->last_seq <= 150,
Signature · 6 lines
2.19.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#3 lore raw
Quoted 10 lines · Ville Syrjälä
Quoted 9 lines · Petri Latvala

Difference of unsigned ints is unsigned int, and therefore always larger than zero.

---
 tests/kms_flip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines

tests/kms_flip.c static void check_state(const struct test_output *o, const struct event_state *e · line 505

Quoted 10 lines
tests/kms_flip.c +1 -1
index 798fc4e8..96f4a2f7 100755
@@ -502,7 +502,7 @@ static void check_state(const struct test_output *o, const struct event_state *e
 	if (o->flags & TEST_TS_CONT) {
 		/* Ignore seq_step here since vblank waits time out immediately
 		 * when we kill the crtc. */
-		igt_assert_f(es->current_seq - es->last_seq >= 0,
+		igt_assert_f(es->current_seq >= es->last_seq,

That won't handle wraparound.

Are you referring to something other than the checked overflow? Or in other words, are you objecting to this patch?

Signature · 5 lines
Petri Latvala
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#4 lore raw

Quoting Petri Latvala (2019-03-05 12:55:01)

Quoted 24 lines · Ville Syrjälä
Quoted 10 lines · Petri Latvala
Quoted 9 lines

Difference of unsigned ints is unsigned int, and therefore always larger than zero.

---
 tests/kms_flip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines

tests/kms_flip.c static void check_state(const struct test_output *o, const struct event_state *e · line 505

Quoted 10 lines
tests/kms_flip.c +1 -1
index 798fc4e8..96f4a2f7 100755
@@ -502,7 +502,7 @@ static void check_state(const struct test_output *o, const struct event_state *e
    if (o->flags & TEST_TS_CONT) {
            /* Ignore seq_step here since vblank waits time out immediately
             * when we kill the crtc. */
-           igt_assert_f(es->current_seq - es->last_seq >= 0,
+           igt_assert_f(es->current_seq >= es->last_seq,

That won't handle wraparound.

Quoted 2 lines

Are you referring to something other than the checked overflow? Or in other words, are you objecting to this patch?

/* a is later than b */
static bool seqno_later(u32 a, u32 b) { return (s32)(a - b) >= 0; } -Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#5 lore raw
Quoted 25 lines · Chris Wilson

Quoting Petri Latvala (2019-03-05 12:55:01)

Quoted 24 lines · Ville Syrjälä
Quoted 22 lines · Petri Latvala
Quoted 14 lines

Difference of unsigned ints is unsigned int, and therefore always larger than zero.

---
 tests/kms_flip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/kms_flip.c +0 -0
index 798fc4e8..96f4a2f7 100755

tests/kms_flip.c static void check_state(const struct test_output *o, const struct event_state *e · line 505

Quoted 5 lines
tests/kms_flip.c +1 -1
@@ -502,7 +502,7 @@ static void check_state(const struct test_output *o, const struct event_state *e
    if (o->flags & TEST_TS_CONT) {
            /* Ignore seq_step here since vblank waits time out immediately
             * when we kill the crtc. */
-           igt_assert_f(es->current_seq - es->last_seq >= 0,
+           igt_assert_f(es->current_seq >= es->last_seq,

That won't handle wraparound.

Quoted 5 lines
Quoted 2 lines

Are you referring to something other than the checked overflow? Or in other words, are you objecting to this patch?

/* a is later than b */
static bool seqno_later(u32 a, u32 b) { return (s32)(a - b) >= 0; }

I see now! My mental gymnastics failed to process the combined overflows and the type conversion, and how that leads to correct results but some quick testing made me see the truth.

Although it might be moot anyway if we end up removing this code altogether.

Signature · 5 lines
Petri Latvala
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#6 lore raw

[igt-dev] ✗ Fi.CI.BAT: failure for tests/kms_flip: Fix comparison of unsigned integers

In reply to Petri Latvala
== Series Details ==

== Series Details ==

Series: tests/kms_flip: Fix comparison of unsigned integers
URL : https://patchwork.freedesktop.org/series/56343/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_5559 -> IGTPW_2351
====================================================

Summary
-------

**FAILURE**

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

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

External URL: https://patchwork.freedesktop.org/api/1.0/series/56343/revisions/1/mbox/

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

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

### IGT changes ###

#### Possible regressions ####

* igt@kms_chamelium@dp-crc-fast:
- fi-kbl-7500u: PASS -> DMESG-FAIL

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_suspend@basic-s3:
- fi-blb-e6850: PASS -> INCOMPLETE [fdo#107718]

* igt@kms_busy@basic-flip-b:
- fi-gdg-551: PASS -> FAIL [fdo#103182]

* igt@prime_vgem@basic-fence-flip:
- fi-ilk-650: PASS -> FAIL [fdo#104008]

#### Possible fixes ####

* igt@pm_rpm@basic-pci-d3-state:
- fi-bsw-kefka: {SKIP} [fdo#109271] -> PASS

* igt@pm_rpm@basic-rte:
- fi-bsw-kefka: FAIL [fdo#108800] -> PASS

* igt@prime_vgem@basic-fence-flip:
- fi-gdg-551: FAIL [fdo#103182] -> PASS

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#103182]: https://bugs.freedesktop.org/show_bug.cgi?id=103182
[fdo#103841]: https://bugs.freedesktop.org/show_bug.cgi?id=103841
[fdo#104008]: https://bugs.freedesktop.org/show_bug.cgi?id=104008
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#108800]: https://bugs.freedesktop.org/show_bug.cgi?id=108800
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109567]: https://bugs.freedesktop.org/show_bug.cgi?id=109567

Participating hosts (50 -> 45)
------------------------------

Missing (5): fi-kbl-soraka fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-bdw-samus

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

* IGT: IGT_4813 -> IGTPW_2351

CI_DRM_5559: 5426efb407f3d2c90c5020f9c87631058362379d @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2351: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2351/
IGT_4813: 09f506726d0e115ee7f4a1604ae71adcf9f12690 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

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