From: Petri Latvala <petri.latvala@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t] tests/kms_flip: Fix comparison of unsigned integers
Date: Wed, 6 Mar 2019 13:17:29 +0200 [thread overview]
Message-ID: <20190306111729.GJ4038@platvala-desk.ger.corp.intel.com> (raw)
In-Reply-To: <155179097330.27405.360411089761673148@skylake-alporthouse-com>
On Tue, Mar 05, 2019 at 01:02:58PM +0000, Chris Wilson wrote:
> Quoting Petri Latvala (2019-03-05 12:55:01)
> > On Thu, Feb 07, 2019 at 04:02:12PM +0200, Ville Syrjälä wrote:
> > > On Thu, Feb 07, 2019 at 03:36:52PM +0200, Petri Latvala wrote:
> > > > Difference of unsigned ints is unsigned int, and therefore always
> > > > larger than zero.
> > > >
> > > > Signed-off-by: Petri Latvala <petri.latvala@intel.com>
> > > > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > > > ---
> > > > tests/kms_flip.c | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/tests/kms_flip.c b/tests/kms_flip.c
> > > > index 798fc4e8..96f4a2f7 100755
> > > > --- a/tests/kms_flip.c
> > > > +++ b/tests/kms_flip.c
> > > > @@ -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?
>
> /* 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.
--
Petri Latvala
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-03-06 11:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-07 13:36 [igt-dev] [PATCH i-g-t] tests/kms_flip: Fix comparison of unsigned integers Petri Latvala
2019-02-07 13:53 ` Daniel Vetter
2019-02-07 14:02 ` Ville Syrjälä
2019-03-05 12:55 ` Petri Latvala
2019-03-05 13:02 ` Chris Wilson
2019-03-06 11:17 ` Petri Latvala [this message]
2019-02-07 14:36 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190306111729.GJ4038@platvala-desk.ger.corp.intel.com \
--to=petri.latvala@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox