Re: [igt-dev] ✗ Fi.CI.IGT: failure for tests/i915/gen_mmap: fix no-op loops

Daniel Vetter
2019-06-03T15:18:25Z

On Fri, May 31, 2019 at 11:52:45AM +0000, Ser, Simon wrote:
> On Fri, 2019-05-31 at 12:41 +0100, Chris Wilson wrote:
> > Quoting Ser, Simon (2019-05-31 12:36:26)
> > > Hi Martin,
> > >
> > > On Wed, 2019-05-08 at 09:54 +0000, Ser, Simon wrote:
> > > > These failures happen because of:
> > > >
> > > > (gem_mmap:5289) CRITICAL: Failed assertion: mmap_ioctl(fd, &arg) == -22
> > > > (gem_mmap:5289) CRITICAL: error: -2 != -22
> > > >
> > > > Is this a genuine driver bug? Is the driver supposed to fail with
> > > > ENOENT or EINVAL?
> > >
> > > The authors haven't replied, so could we file a bug for this? Discussed
> > > with Arek, the correct sequence of actions would be:
> >
> > Don't knowingly push a broken test purporting to fix one breakage. The
> > test is wrong.
>
> A test that fails is better than a test that silently does nothing. At
> least we know it's broken.
>
> > You have git and could have checked that ENOENT was the ABI we settled
> > on in
> >
> > commit bf79cb914dbfe848add8bb76cbb8ff89110d29ff
> > Author: Chris Wilson <chris@chris-wilson.co.uk>
> > Date: Wed Aug 4 14:19:46 2010 +0100
> >
> > drm: Use ENOENT consistently for the error return for an unmatched handle.
> >
> > This is consistent with trying to access a filename that not exist
> > within a directory which is a good analogy here. The main reason for the
> > change is that it is easy to confuse the error code of EBADF as an
> > performing an ioctl on an invalid file descriptor (rather than an
> > unknown object).
> >
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Signed-off-by: Dave Airlie <airlied@redhat.com>
> >
> > after being told not to EBADF.
>
> I have absolutely no idea how I could've find this 2010 commit. But,
> thanks to your reply, at least I can write a fix now. Thanks!

We documented error code best practices since then:

https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html#recommended-ioctl-return-values

Cheers, Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation