runner: Increase buffer size for reading outputs
PATCH 1/1 runner: Increase buffer size for reading outputs
The law of chosen magic numbers: The number selected is wrong.
Chose another magic number for the size of the buffer used to read test outputs and kernel log records. It's now 2048, up from 256. Also added a warning print if that's still not enough for kernel logs.
The lesson to learn here is that the /dev/kmsg interface does not give you a truncated log record as initially thought, but reports an undocumented EINVAL instead. Subsequent reads give the next record, so the failsafe added will make sure any future EINVALs will only drop the record that is too long instead of everything from that point onwards.
--- runner/executor.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
runner/executor.c +5 -3
@@ -242,7 +242,7 @@ static void dump_dmesg(int kmsgfd, int outfd)unsigned flags;unsigned long long seq, cmpseq, usec;char cont; -char buf[256 ]; +char buf[2048 ];ssize_t r;if (comparefd <0 )
@@ -323,7 +323,7 @@ static int monitor_output(pid_t child, struct settings *settings) {fd_set set; -char buf[256 ]; +char buf[2048 ];char *outbuf =NULL ;size_t outbufsize =0 ;char current_subtest[256 ] = {};
@@ -539,11 +539,13 @@ static int monitor_output(pid_t child,if (kmsgfd >=0 &&FD_ISSET (kmsgfd, &set)) { s =read (kmsgfd, buf,sizeof (buf));if (s <0 ) { -if (errno !=EPIPE ) { +if (errno !=EPIPE && errno !=EINVAL ) {fprintf (stderr,"Error reading from kmsg, stopping monitoring: %s\n" ,strerror (errno));close (kmsgfd); kmsgfd =-1 ; + }else if (errno ==EINVAL ) { +fprintf (stderr,"Warning: Buffer too small for kernel log record, record lost.\n" ); } }else {write (outputs[_F_DMESG], buf, s);
Signature · 6 lines
2.18.0 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 6 lines · Petri Latvala
The law of chosen magic numbers: The number selected is wrong.
Chose another magic number for the size of the buffer used to read test outputs and kernel log records. It's now 2048, up from 256. Also added a warning print if that's still not enough for kernel logs.
Quoted 8 lines
The lesson to learn here is that the
/dev/kmsginterface does not give you a truncated log record as initially thought, but reports an undocumented EINVAL instead. Subsequent reads give the next record, so the failsafe added will make sure any future EINVALs will only drop the record that is too long instead of everything from that point onwards.Signed-off-by Petri Latvala <[email protected]>
Are you also cooking a patch for the kernel docs, to document this undocumented behavior?
Signature · 6 lines
Cheers, Arek _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoting Petri Latvala (2018-09-14 12:21:39)
Quoted 1 line
The law of chosen magic numbers: The number selected is wrong.
PAGE_SIZE is a good default for reads. It's typically tied into atomicity within the kernel fd interfaces, so works as a sensible minimum.
-Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/1] runner: Increase buffer size for reading outputs
In reply to Petri Latvala== Series Details ==
== Series Details ==
Series: series starting with [i-g-t,1/1] runner: Increase buffer size for reading outputs
URL : https://patchwork.freedesktop.org/series/49704/
State : success
== Summary ==
= CI Bug Log - changes from IGT_4641_full -> IGTPW_1842_full =
== Summary - SUCCESS ==
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/49704/revisions/1/mbox/
== Known issues ==
Here are the changes found in IGTPW_1842_full that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@kms_cursor_legacy@cursora-vs-flipa-toggle:
shard-glk: PASS -> DMESG-WARN (fdo#105763, fdo#106538)
igt@kms_frontbuffer_tracking@fbc-2p-primscrn-cur-indfb-draw-render:
shard-glk: PASS -> INCOMPLETE (k.org#198133, fdo#103359) +1
igt@kms_setmode@basic:
shard-apl: PASS -> FAIL (fdo#99912)
==== Possible fixes ====
igt@drv_suspend@shrink:
shard-kbl: INCOMPLETE (fdo#103665, fdo#106886) -> PASS
igt@gem_softpin@noreloc-s3:
shard-snb: DMESG-WARN (fdo#102365) -> PASS
igt@kms_cursor_crc@cursor-256x256-suspend:
shard-kbl: INCOMPLETE (fdo#103665) -> PASS +1
igt@kms_cursor_legacy@cursorb-vs-flipb-toggle:
shard-glk: DMESG-WARN (fdo#105763, fdo#106538) -> PASS
igt@kms_draw_crc@draw-method-xrgb8888-pwrite-xtiled:
shard-glk: FAIL -> PASS
igt@kms_flip@2x-flip-vs-expired-vblank-interruptible:
shard-glk: FAIL (fdo#105363) -> PASS
igt@kms_plane@pixel-format-pipe-a-planes:
shard-snb: FAIL (fdo#107749, fdo#103166) -> PASS
igt@kms_setmode@basic:
shard-kbl: FAIL (fdo#99912) -> PASS
igt@prime_busy@wait-hang-blt:
shard-snb: INCOMPLETE (fdo#105411) -> PASS fdo#102365 https://bugs.freedesktop.org/show_bug.cgi?id=102365
fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
fdo#105763 https://bugs.freedesktop.org/show_bug.cgi?id=105763
fdo#106538 https://bugs.freedesktop.org/show_bug.cgi?id=106538
fdo#106886 https://bugs.freedesktop.org/show_bug.cgi?id=106886
fdo#107749 https://bugs.freedesktop.org/show_bug.cgi?id=107749
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133
== Participating hosts (5 -> 5) ==
No changes in participating hosts
== Build changes ==
* IGT: IGT_4641 -> IGTPW_1842
* Linux: CI_DRM_4824 -> CI_DRM_4825
CI_DRM_4824: 110556c298bfe6ce81b453869e60dedbd4f0f182 @ git://anongit.freedesktop.org/gfx-ci/linux
CI_DRM_4825: b42528aaa961c0d469f381b4a5c3830fe46aedfa @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1842: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1842/
IGT_4641: 468febc4c746f168e885e0d662ec3adb0cca60f6 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1842/shards.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev