* [igt-dev] [PATCH i-g-t] lib/igt_kms: Fix igt_display_drop_events() to work as intended
@ 2018-02-15 11:49 Maarten Lankhorst
2018-02-15 12:03 ` Chris Wilson
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Maarten Lankhorst @ 2018-02-15 11:49 UTC (permalink / raw)
To: igt-dev; +Cc: Jari Tahvanainen
Short reads don't work, you either read the whole event or nothing
at all, so follow the recommendations in the documentation and
allocate a buffer of 4096 bytes for the event, if we capture
multiple events read them all.
Cc: Jari Tahvanainen <jari.tahvanainen@intel.com>
Reported-by: Jari Tahvanainen <jari.tahvanainen@intel.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104538
---
lib/igt_kms.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 11f23fcaaa81..5a5df61c5856 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -3228,14 +3228,18 @@ int igt_display_drop_events(igt_display_t *display)
};
while (poll(&pfd, 1, 0) > 0) {
- struct drm_event ev;
- char buf[128];
-
- read(display->drm_fd, &ev, sizeof(ev));
- igt_info("Dropping event type %u length %u\n", ev.type, ev.length);
- igt_assert(ev.length <= sizeof(buf));
- read(display->drm_fd, buf, ev.length);
- ret++;
+ char buf[4096];
+ ssize_t retval;
+ struct drm_event *ev = (struct drm_event *)buf;
+
+ retval = read(display->drm_fd, &buf, sizeof(buf));
+ igt_assert_lt(0, retval);
+
+ for (int i = 0; i < retval; i += ev->length, ev = (struct drm_event *)&buf[i]) {
+ igt_info("Dropping event type %u length %u\n", ev->type, ev->length);
+ igt_assert(ev->length + i <= sizeof(buf));
+ ret++;
+ }
}
return ret;
--
2.16.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [igt-dev] [PATCH i-g-t] lib/igt_kms: Fix igt_display_drop_events() to work as intended
2018-02-15 11:49 [igt-dev] [PATCH i-g-t] lib/igt_kms: Fix igt_display_drop_events() to work as intended Maarten Lankhorst
@ 2018-02-15 12:03 ` Chris Wilson
2018-02-15 13:52 ` Maarten Lankhorst
2018-02-15 13:30 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-02-15 21:32 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2 siblings, 1 reply; 5+ messages in thread
From: Chris Wilson @ 2018-02-15 12:03 UTC (permalink / raw)
To: Maarten Lankhorst, igt-dev; +Cc: Jari Tahvanainen
Quoting Maarten Lankhorst (2018-02-15 11:49:17)
> Short reads don't work, you either read the whole event or nothing
> at all, so follow the recommendations in the documentation and
> allocate a buffer of 4096 bytes for the event, if we capture
> multiple events read them all.
>
> Cc: Jari Tahvanainen <jari.tahvanainen@intel.com>
> Reported-by: Jari Tahvanainen <jari.tahvanainen@intel.com>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104538
> ---
> lib/igt_kms.c | 20 ++++++++++++--------
> 1 file changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 11f23fcaaa81..5a5df61c5856 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -3228,14 +3228,18 @@ int igt_display_drop_events(igt_display_t *display)
> };
>
> while (poll(&pfd, 1, 0) > 0) {
> - struct drm_event ev;
> - char buf[128];
> -
> - read(display->drm_fd, &ev, sizeof(ev));
> - igt_info("Dropping event type %u length %u\n", ev.type, ev.length);
> - igt_assert(ev.length <= sizeof(buf));
> - read(display->drm_fd, buf, ev.length);
Fwiw ^ that was the bug.
> - ret++;
> + char buf[4096];
> + ssize_t retval;
> + struct drm_event *ev = (struct drm_event *)buf;
> +
> + retval = read(display->drm_fd, &buf, sizeof(buf));
> + igt_assert_lt(0, retval);
> +
> + for (int i = 0; i < retval; i += ev->length, ev = (struct drm_event *)&buf[i]) {
struct drm_event *ev = (struct drm_event *)(buf +i);
gets rid of the other two struct drm_event ev assignments
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 5+ messages in thread
* [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_kms: Fix igt_display_drop_events() to work as intended
2018-02-15 11:49 [igt-dev] [PATCH i-g-t] lib/igt_kms: Fix igt_display_drop_events() to work as intended Maarten Lankhorst
2018-02-15 12:03 ` Chris Wilson
@ 2018-02-15 13:30 ` Patchwork
2018-02-15 21:32 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2018-02-15 13:30 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: igt-dev
== Series Details ==
Series: lib/igt_kms: Fix igt_display_drop_events() to work as intended
URL : https://patchwork.freedesktop.org/series/38353/
State : success
== Summary ==
IGT patchset tested on top of latest successful build
0a700e095b2a47e99081b7bffce1e737863e0136 igt/gem_exec_fence: Test that the in-fence is not overwritten
with latest DRM-Tip kernel build CI_DRM_3777
bd16af128e78 drm-tip: 2018y-02m-15d-00h-22m-40s UTC integration manifest
No testlist changes.
Test prime_vgem:
Subgroup basic-fence-flip:
pass -> FAIL (fi-ilk-650) fdo#104008
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:419s
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:375s
fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:494s
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:488s
fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:475s
fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:463s
fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:582s
fi-elk-e7500 total:288 pass:229 dwarn:0 dfail:0 fail:0 skip:59 time:419s
fi-gdg-551 total:288 pass:179 dwarn:0 dfail:0 fail:1 skip:108 time:285s
fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:514s
fi-hsw-4770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:396s
fi-ilk-650 total:288 pass:227 dwarn:0 dfail:0 fail:1 skip:60 time:415s
fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:460s
fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:459s
fi-kbl-7560u total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:496s
fi-kbl-7567u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:452s
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:592s
fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:429s
fi-skl-6600u total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:507s
fi-skl-6700hq total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:526s
fi-skl-6700k2 total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:495s
fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:484s
fi-skl-guc total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:418s
fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:433s
fi-snb-2520m total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:527s
fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:402s
Blacklisted hosts:
fi-glk-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:476s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_924/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [igt-dev] [PATCH i-g-t] lib/igt_kms: Fix igt_display_drop_events() to work as intended
2018-02-15 12:03 ` Chris Wilson
@ 2018-02-15 13:52 ` Maarten Lankhorst
0 siblings, 0 replies; 5+ messages in thread
From: Maarten Lankhorst @ 2018-02-15 13:52 UTC (permalink / raw)
To: Chris Wilson, igt-dev; +Cc: Jari Tahvanainen
Op 15-02-18 om 13:03 schreef Chris Wilson:
> Quoting Maarten Lankhorst (2018-02-15 11:49:17)
>> Short reads don't work, you either read the whole event or nothing
>> at all, so follow the recommendations in the documentation and
>> allocate a buffer of 4096 bytes for the event, if we capture
>> multiple events read them all.
>>
>> Cc: Jari Tahvanainen <jari.tahvanainen@intel.com>
>> Reported-by: Jari Tahvanainen <jari.tahvanainen@intel.com>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104538
>> ---
>> lib/igt_kms.c | 20 ++++++++++++--------
>> 1 file changed, 12 insertions(+), 8 deletions(-)
>>
>> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
>> index 11f23fcaaa81..5a5df61c5856 100644
>> --- a/lib/igt_kms.c
>> +++ b/lib/igt_kms.c
>> @@ -3228,14 +3228,18 @@ int igt_display_drop_events(igt_display_t *display)
>> };
>>
>> while (poll(&pfd, 1, 0) > 0) {
>> - struct drm_event ev;
>> - char buf[128];
>> -
>> - read(display->drm_fd, &ev, sizeof(ev));
>> - igt_info("Dropping event type %u length %u\n", ev.type, ev.length);
>> - igt_assert(ev.length <= sizeof(buf));
>> - read(display->drm_fd, buf, ev.length);
> Fwiw ^ that was the bug.
>
>> - ret++;
>> + char buf[4096];
>> + ssize_t retval;
>> + struct drm_event *ev = (struct drm_event *)buf;
>> +
>> + retval = read(display->drm_fd, &buf, sizeof(buf));
>> + igt_assert_lt(0, retval);
>> +
>> + for (int i = 0; i < retval; i += ev->length, ev = (struct drm_event *)&buf[i]) {
> struct drm_event *ev = (struct drm_event *)(buf +i);
>
> gets rid of the other two struct drm_event ev assignments
>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> -Chris
Pushed with that change, thanks.
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 5+ messages in thread
* [igt-dev] ✗ Fi.CI.IGT: failure for lib/igt_kms: Fix igt_display_drop_events() to work as intended
2018-02-15 11:49 [igt-dev] [PATCH i-g-t] lib/igt_kms: Fix igt_display_drop_events() to work as intended Maarten Lankhorst
2018-02-15 12:03 ` Chris Wilson
2018-02-15 13:30 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
@ 2018-02-15 21:32 ` Patchwork
2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2018-02-15 21:32 UTC (permalink / raw)
To: Maarten Lankhorst; +Cc: igt-dev
== Series Details ==
Series: lib/igt_kms: Fix igt_display_drop_events() to work as intended
URL : https://patchwork.freedesktop.org/series/38353/
State : failure
== Summary ==
Test perf:
Subgroup oa-exponents:
pass -> FAIL (shard-apl) fdo#102254
Subgroup enable-disable:
fail -> PASS (shard-apl) fdo#103715
Test gem_exec_suspend:
Subgroup basic-s4:
fail -> SKIP (shard-snb) fdo#103375
Subgroup basic-s3:
skip -> PASS (shard-snb) fdo#103880
Test kms_universal_plane:
Subgroup cursor-fb-leak-pipe-b:
pass -> FAIL (shard-snb)
Test kms_sysfs_edid_timing:
pass -> WARN (shard-apl) fdo#100047
Test kms_rotation_crc:
Subgroup sprite-rotation-180:
pass -> FAIL (shard-snb) fdo#103925
fdo#102254 https://bugs.freedesktop.org/show_bug.cgi?id=102254
fdo#103715 https://bugs.freedesktop.org/show_bug.cgi?id=103715
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#103880 https://bugs.freedesktop.org/show_bug.cgi?id=103880
fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
shard-apl total:3356 pass:1741 dwarn:1 dfail:0 fail:21 skip:1591 time:14125s
shard-hsw total:3427 pass:1759 dwarn:1 dfail:0 fail:10 skip:1656 time:14566s
shard-snb total:3427 pass:1347 dwarn:1 dfail:0 fail:11 skip:2068 time:7744s
Blacklisted hosts:
shard-kbl total:3405 pass:1885 dwarn:1 dfail:0 fail:22 skip:1495 time:10467s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_924/shards.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-02-15 21:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-15 11:49 [igt-dev] [PATCH i-g-t] lib/igt_kms: Fix igt_display_drop_events() to work as intended Maarten Lankhorst
2018-02-15 12:03 ` Chris Wilson
2018-02-15 13:52 ` Maarten Lankhorst
2018-02-15 13:30 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-02-15 21:32 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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.