igt-dev.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/1] runner: Increase buffer size for reading outputs
@ 2018-09-14 11:21 Petri Latvala
  2018-09-14 11:31 ` Arkadiusz Hiler
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Petri Latvala @ 2018-09-14 11:21 UTC (permalink / raw)
  To: igt-dev

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.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
---
 runner/executor.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/runner/executor.c b/runner/executor.c
index 36117af6..701ca80d 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -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);
-- 
2.18.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 1/1] runner: Increase buffer size for reading outputs
  2018-09-14 11:21 [igt-dev] [PATCH i-g-t 1/1] runner: Increase buffer size for reading outputs Petri Latvala
@ 2018-09-14 11:31 ` Arkadiusz Hiler
  2018-09-14 11:39 ` Chris Wilson
  2018-09-14 19:32 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/1] " Patchwork
  2 siblings, 0 replies; 4+ messages in thread
From: Arkadiusz Hiler @ 2018-09-14 11:31 UTC (permalink / raw)
  To: Petri Latvala; +Cc: igt-dev

On Fri, Sep 14, 2018 at 02:21:39PM +0300, Petri Latvala wrote:
> 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.
> 
> Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>

Are you also cooking a patch for the kernel docs, to document this
undocumented behavior?

-- 
Cheers,
Arek
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 1/1] runner: Increase buffer size for reading outputs
  2018-09-14 11:21 [igt-dev] [PATCH i-g-t 1/1] runner: Increase buffer size for reading outputs Petri Latvala
  2018-09-14 11:31 ` Arkadiusz Hiler
@ 2018-09-14 11:39 ` Chris Wilson
  2018-09-14 19:32 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/1] " Patchwork
  2 siblings, 0 replies; 4+ messages in thread
From: Chris Wilson @ 2018-09-14 11:39 UTC (permalink / raw)
  To: Petri Latvala, igt-dev

Quoting Petri Latvala (2018-09-14 12:21:39)
> 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
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/1] runner: Increase buffer size for reading outputs
  2018-09-14 11:21 [igt-dev] [PATCH i-g-t 1/1] runner: Increase buffer size for reading outputs Petri Latvala
  2018-09-14 11:31 ` Arkadiusz Hiler
  2018-09-14 11:39 ` Chris Wilson
@ 2018-09-14 19:32 ` Patchwork
  2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2018-09-14 19:32 UTC (permalink / raw)
  To: Petri Latvala; +Cc: igt-dev

== 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
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-14 19:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-14 11:21 [igt-dev] [PATCH i-g-t 1/1] runner: Increase buffer size for reading outputs Petri Latvala
2018-09-14 11:31 ` Arkadiusz Hiler
2018-09-14 11:39 ` Chris Wilson
2018-09-14 19:32 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/1] " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).