* [PATCH igt] lib: Assert that the internal gem_create interface matches the ioctl
@ 2017-10-03 14:05 Chris Wilson
2017-10-03 14:19 ` Mika Kuoppala
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Chris Wilson @ 2017-10-03 14:05 UTC (permalink / raw)
To: intel-gfx
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
lib/igt_core.h | 14 ++++++++++++++
lib/ioctl_wrappers.c | 4 ++++
2 files changed, 18 insertions(+)
diff --git a/lib/igt_core.h b/lib/igt_core.h
index f8543d65..f5f65984 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -932,4 +932,18 @@ int igt_system_quiet(const char *command);
free(buf); \
} while (0)
+/**
+ * igt_typecheck:
+ * @type: The intended type we expect the variable to be
+ * @x: The variable we wish to check
+ *
+ * Performs a *compile-time* check that a variable is of a particular type.
+ */
+#define igt_typecheck(type, x) ({ \
+ type __dummy; \
+ typeof(x) __dummy2; \
+ (void)(&__dummy == &__dummy2); \
+ 1; \
+})
+
#endif /* IGT_CORE_H */
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 87511fc6..0b523fac 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -558,6 +558,10 @@ int __gem_create(int fd, uint64_t size, uint32_t *handle)
};
int err = 0;
+ /* Ensure that our internal interface matches the kernel's */
+ igt_typecheck(typeof(create.size), size);
+ igt_typecheck(typeof(create.handle), *handle);
+
if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create) == 0)
*handle = create.handle;
else
--
2.14.2
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH igt] lib: Assert that the internal gem_create interface matches the ioctl
2017-10-03 14:05 [PATCH igt] lib: Assert that the internal gem_create interface matches the ioctl Chris Wilson
@ 2017-10-03 14:19 ` Mika Kuoppala
2017-10-03 14:29 ` Chris Wilson
2017-10-03 14:25 ` Chris Wilson
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Mika Kuoppala @ 2017-10-03 14:19 UTC (permalink / raw)
To: Chris Wilson, intel-gfx
Chris Wilson <chris@chris-wilson.co.uk> writes:
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> lib/igt_core.h | 14 ++++++++++++++
> lib/ioctl_wrappers.c | 4 ++++
> 2 files changed, 18 insertions(+)
>
> diff --git a/lib/igt_core.h b/lib/igt_core.h
> index f8543d65..f5f65984 100644
> --- a/lib/igt_core.h
> +++ b/lib/igt_core.h
> @@ -932,4 +932,18 @@ int igt_system_quiet(const char *command);
> free(buf); \
> } while (0)
>
> +/**
> + * igt_typecheck:
> + * @type: The intended type we expect the variable to be
> + * @x: The variable we wish to check
> + *
> + * Performs a *compile-time* check that a variable is of a particular type.
> + */
> +#define igt_typecheck(type, x) ({ \
> + type __dummy; \
> + typeof(x) __dummy2; \
> + (void)(&__dummy == &__dummy2); \
> + 1; \
> +})
> +
> #endif /* IGT_CORE_H */
> diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
> index 87511fc6..0b523fac 100644
> --- a/lib/ioctl_wrappers.c
> +++ b/lib/ioctl_wrappers.c
> @@ -558,6 +558,10 @@ int __gem_create(int fd, uint64_t size, uint32_t *handle)
> };
> int err = 0;
>
> + /* Ensure that our internal interface matches the kernel's */
> + igt_typecheck(typeof(create.size), size);
> + igt_typecheck(typeof(create.handle), *handle);
Seems to do what it is missing from the tin :)
Fill the commit message and sprinkle more on the ioctl_wrappers.c?
-Mika
> +
> if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create) == 0)
> *handle = create.handle;
> else
> --
> 2.14.2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH igt] lib: Assert that the internal gem_create interface matches the ioctl
2017-10-03 14:05 [PATCH igt] lib: Assert that the internal gem_create interface matches the ioctl Chris Wilson
2017-10-03 14:19 ` Mika Kuoppala
@ 2017-10-03 14:25 ` Chris Wilson
2017-10-03 20:33 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-10-03 22:27 ` ✓ Fi.CI.IGT: " Patchwork
3 siblings, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2017-10-03 14:25 UTC (permalink / raw)
To: intel-gfx
Quoting Chris Wilson (2017-10-03 15:05:18)
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> lib/igt_core.h | 14 ++++++++++++++
> lib/ioctl_wrappers.c | 4 ++++
> 2 files changed, 18 insertions(+)
>
> diff --git a/lib/igt_core.h b/lib/igt_core.h
> index f8543d65..f5f65984 100644
> --- a/lib/igt_core.h
> +++ b/lib/igt_core.h
> @@ -932,4 +932,18 @@ int igt_system_quiet(const char *command);
> free(buf); \
> } while (0)
>
> +/**
> + * igt_typecheck:
> + * @type: The intended type we expect the variable to be
> + * @x: The variable we wish to check
> + *
> + * Performs a *compile-time* check that a variable is of a particular type.
> + */
> +#define igt_typecheck(type, x) ({ \
> + type __dummy; \
> + typeof(x) __dummy2; \
> + (void)(&__dummy == &__dummy2); \
> + 1; \
> +})
> +
> #endif /* IGT_CORE_H */
> diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
> index 87511fc6..0b523fac 100644
> --- a/lib/ioctl_wrappers.c
> +++ b/lib/ioctl_wrappers.c
> @@ -558,6 +558,10 @@ int __gem_create(int fd, uint64_t size, uint32_t *handle)
> };
> int err = 0;
>
> + /* Ensure that our internal interface matches the kernel's */
> + igt_typecheck(typeof(create.size), size);
> + igt_typecheck(typeof(create.handle), *handle);
Hmm, gcc doesn't allow pointer conversion between unsigned long long and
uint64_t?
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH igt] lib: Assert that the internal gem_create interface matches the ioctl
2017-10-03 14:19 ` Mika Kuoppala
@ 2017-10-03 14:29 ` Chris Wilson
0 siblings, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2017-10-03 14:29 UTC (permalink / raw)
To: Mika Kuoppala, intel-gfx
Quoting Mika Kuoppala (2017-10-03 15:19:24)
> Chris Wilson <chris@chris-wilson.co.uk> writes:
>
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > ---
> > lib/igt_core.h | 14 ++++++++++++++
> > lib/ioctl_wrappers.c | 4 ++++
> > 2 files changed, 18 insertions(+)
> >
> > diff --git a/lib/igt_core.h b/lib/igt_core.h
> > index f8543d65..f5f65984 100644
> > --- a/lib/igt_core.h
> > +++ b/lib/igt_core.h
> > @@ -932,4 +932,18 @@ int igt_system_quiet(const char *command);
> > free(buf); \
> > } while (0)
> >
> > +/**
> > + * igt_typecheck:
> > + * @type: The intended type we expect the variable to be
> > + * @x: The variable we wish to check
> > + *
> > + * Performs a *compile-time* check that a variable is of a particular type.
> > + */
> > +#define igt_typecheck(type, x) ({ \
> > + type __dummy; \
> > + typeof(x) __dummy2; \
> > + (void)(&__dummy == &__dummy2); \
> > + 1; \
> > +})
> > +
> > #endif /* IGT_CORE_H */
> > diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
> > index 87511fc6..0b523fac 100644
> > --- a/lib/ioctl_wrappers.c
> > +++ b/lib/ioctl_wrappers.c
> > @@ -558,6 +558,10 @@ int __gem_create(int fd, uint64_t size, uint32_t *handle)
> > };
> > int err = 0;
> >
> > + /* Ensure that our internal interface matches the kernel's */
> > + igt_typecheck(typeof(create.size), size);
> > + igt_typecheck(typeof(create.handle), *handle);
>
> Seems to do what it is missing from the tin :)
>
> Fill the commit message and sprinkle more on the ioctl_wrappers.c?
Testing the waters. Looks sane but gcc doesn't like
igt_typecheck(unsigned long long, size);
and the kernel is using typedef unsigned long long __u64 not uint64_t.
A little bit of a conundrum.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 6+ messages in thread
* ✓ Fi.CI.BAT: success for lib: Assert that the internal gem_create interface matches the ioctl
2017-10-03 14:05 [PATCH igt] lib: Assert that the internal gem_create interface matches the ioctl Chris Wilson
2017-10-03 14:19 ` Mika Kuoppala
2017-10-03 14:25 ` Chris Wilson
@ 2017-10-03 20:33 ` Patchwork
2017-10-03 22:27 ` ✓ Fi.CI.IGT: " Patchwork
3 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2017-10-03 20:33 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: lib: Assert that the internal gem_create interface matches the ioctl
URL : https://patchwork.freedesktop.org/series/31329/
State : success
== Summary ==
IGT patchset tested on top of latest successful build
7fd0cae99630f954cfe0089b4b7e91576a353582 lib: Fixup __gem_create() to be 64b safe.
with latest DRM-Tip kernel build CI_DRM_3169
654360cf73fe drm-tip: 2017y-10m-03d-17h-55m-08s UTC integration manifest
No testlist changes.
Test gem_exec_suspend:
Subgroup basic-s3:
dmesg-warn -> PASS (fi-cfl-s) fdo#103026
fdo#103026 https://bugs.freedesktop.org/show_bug.cgi?id=103026
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:454s
fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:480s
fi-blb-e6850 total:289 pass:224 dwarn:1 dfail:0 fail:0 skip:64 time:398s
fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:592s
fi-bwr-2160 total:289 pass:184 dwarn:0 dfail:0 fail:0 skip:105 time:292s
fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:528s
fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:532s
fi-byt-j1900 total:289 pass:254 dwarn:1 dfail:0 fail:0 skip:34 time:553s
fi-byt-n2820 total:289 pass:250 dwarn:1 dfail:0 fail:0 skip:38 time:541s
fi-cfl-s total:289 pass:257 dwarn:0 dfail:0 fail:0 skip:32 time:566s
fi-cnl-y total:289 pass:261 dwarn:1 dfail:0 fail:0 skip:27 time:646s
fi-elk-e7500 total:289 pass:230 dwarn:0 dfail:0 fail:0 skip:59 time:438s
fi-glk-1 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:600s
fi-hsw-4770 total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:439s
fi-hsw-4770r total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:416s
fi-ilk-650 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:474s
fi-ivb-3520m total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:515s
fi-ivb-3770 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:477s
fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:502s
fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:585s
fi-kbl-7567u total:289 pass:265 dwarn:4 dfail:0 fail:0 skip:20 time:498s
fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:595s
fi-pnv-d510 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:657s
fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:468s
fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:538s
fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:515s
fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:475s
fi-snb-2520m total:289 pass:251 dwarn:0 dfail:0 fail:0 skip:38 time:596s
fi-snb-2600 total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:435s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_292/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 6+ messages in thread
* ✓ Fi.CI.IGT: success for lib: Assert that the internal gem_create interface matches the ioctl
2017-10-03 14:05 [PATCH igt] lib: Assert that the internal gem_create interface matches the ioctl Chris Wilson
` (2 preceding siblings ...)
2017-10-03 20:33 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2017-10-03 22:27 ` Patchwork
3 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2017-10-03 22:27 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: lib: Assert that the internal gem_create interface matches the ioctl
URL : https://patchwork.freedesktop.org/series/31329/
State : success
== Summary ==
Test gem_pwrite:
Subgroup huge-cpu-fbr:
fail -> PASS (shard-hsw)
Subgroup huge-gtt-random:
fail -> PASS (shard-hsw)
Subgroup huge-gtt-fbr:
fail -> PASS (shard-hsw)
Subgroup big-gtt-fbr:
fail -> PASS (shard-hsw)
Subgroup big-gtt-backwards:
fail -> PASS (shard-hsw)
Subgroup huge-cpu-random:
fail -> PASS (shard-hsw)
Subgroup huge-gtt-backwards:
fail -> PASS (shard-hsw)
Subgroup big-gtt-random:
fail -> PASS (shard-hsw)
Subgroup huge-cpu-forwards:
fail -> PASS (shard-hsw)
Subgroup big-gtt-forwards:
fail -> PASS (shard-hsw)
Subgroup big-cpu-backwards:
fail -> PASS (shard-hsw)
Subgroup huge-gtt-forwards:
fail -> PASS (shard-hsw)
Subgroup big-cpu-random:
fail -> PASS (shard-hsw)
Subgroup big-cpu-fbr:
fail -> PASS (shard-hsw)
Subgroup huge-cpu-backwards:
fail -> PASS (shard-hsw)
Subgroup big-cpu-forwards:
fail -> PASS (shard-hsw)
Test gem_eio:
Subgroup wait:
dmesg-warn -> PASS (shard-hsw) fdo#102886
Test prime_self_import:
Subgroup reimport-vs-gem_close-race:
pass -> FAIL (shard-hsw) fdo#102655
Test kms_flip:
Subgroup flip-vs-expired-vblank-interruptible:
pass -> FAIL (shard-hsw) fdo#102887
Test perf:
Subgroup blocking:
pass -> FAIL (shard-hsw) fdo#102252
fdo#102886 https://bugs.freedesktop.org/show_bug.cgi?id=102886
fdo#102655 https://bugs.freedesktop.org/show_bug.cgi?id=102655
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
shard-hsw total:2429 pass:1330 dwarn:6 dfail:0 fail:10 skip:1083 time:10110s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_292/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-10-03 22:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-03 14:05 [PATCH igt] lib: Assert that the internal gem_create interface matches the ioctl Chris Wilson
2017-10-03 14:19 ` Mika Kuoppala
2017-10-03 14:29 ` Chris Wilson
2017-10-03 14:25 ` Chris Wilson
2017-10-03 20:33 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-10-03 22:27 ` ✓ Fi.CI.IGT: " Patchwork
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.