All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t v2] tests/gem_watchdog: GPU engine reset
@ 2018-10-06  1:05 Carlos Santa
  2018-10-06  1:05 ` [igt-dev] [PATCH i-g-t v2] tests/gem_watchdog: Initial set of tests for GPU watchdog Carlos Santa
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Carlos Santa @ 2018-10-06  1:05 UTC (permalink / raw)
  To: igt-dev

This IGT test complements the Gen8+ engine-reset feature patch
series aka Timeout Detection and Recovery (TDR) that Michel Thierry
submitted here: https://patchwork.freedesktop.org/series/21868/, specifically
the Watchdog timer feature of the original that is still not in
upstream.
	
There are several pieces that are required in order to
get (TDR) Watchdog timer in upstream:
	
(1) having a proper IGT set of tests that can exercise the feature
(2) but more imporantly, having a qualified user space client such
as a media driver that can trigger the watchdog timer after submitting
GPU work that could reset the media engine after encountering a
hung engine for example.
	
This IGT test is to cover requirement (1) above.

Carlos Santa (1):
  tests/gem_watchdog: Initial set of tests for GPU watchdog

 tests/Makefile.sources |   1 +
 tests/gem_watchdog.c   | 186 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/meson.build      |   1 +
 3 files changed, 188 insertions(+)
 create mode 100644 tests/gem_watchdog.c

-- 
2.7.4

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

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

* [igt-dev] [PATCH i-g-t v2] tests/gem_watchdog: Initial set of tests for GPU watchdog
  2018-10-06  1:05 [igt-dev] [PATCH i-g-t v2] tests/gem_watchdog: GPU engine reset Carlos Santa
@ 2018-10-06  1:05 ` Carlos Santa
  2018-10-08 21:43   ` Antonio Argenziano
  2018-10-06  2:39 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/gem_watchdog: Initial set of tests for GPU watchdog (rev2) Patchwork
  2018-10-06 11:28 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  2 siblings, 1 reply; 7+ messages in thread
From: Carlos Santa @ 2018-10-06  1:05 UTC (permalink / raw)
  To: igt-dev; +Cc: Michel Thierry

This test adds basic set of tests to reset the different
GPU engines through the watchdog timer.

Credits to Antonio for the original codebase this is based on.

This was verified on SKL/ULT GT3:

$./gem_watchdog --run-subtest basic-vecs0
IGT-Version: 1.23-gaaeb2007206d (x86_64) (Linux: 4.18.0-rc7+ x86_64)
Starting subtest: basic-vecs0
Subtest basic-vecs0: SUCCESS (2.402s)
$ sudo cat /sys/kernel/debug/dri/0/i915_reset_info
full gpu reset = 0
GuC watchdog/media reset = 0
rcs0 = 0
bcs0 = 0
vcs0 = 0
vcs1 = 0
vecs0 = 1

v2: (Review comments from Chris Wilson)
 * Replace send_canary() by timestamps before/after the hang
   and measure dt. Use dt < 2*threshold + reset + submission
   to check watchdog vs hangcheck
 * Initialize drm_i915_gem_context_param args only once at
   the struct declaration
 * Avoid using MAX_ENGINES implicitly to declare engines_thresholds
   array
 * Remove unnecessary igt_assert(!check_error_state(fd))
 * Use the class:instance interface when looping through the engines

  (Review by Petri Latvala)
 * Update the correct patch's year timestamp
 * Include IGT_DESCRIPTION() label

Cc: Antonio Argenziano <antonio.argenziano@intel.com>
Cc: Michel Thierry <michel.thierry@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Carlos Santa <carlos.santa@intel.com>
---
 tests/Makefile.sources |   1 +
 tests/gem_watchdog.c   | 186 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/meson.build      |   1 +
 3 files changed, 188 insertions(+)
 create mode 100644 tests/gem_watchdog.c

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index c84933f1d971..9b298886a2e1 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -155,6 +155,7 @@ TESTS_progs = \
 	gem_unref_active_buffers \
 	gem_userptr_blits \
 	gem_wait \
+        gem_watchdog \
 	gem_workarounds \
 	gem_write_read_ring_switch \
 	gen3_mixed_blits \
diff --git a/tests/gem_watchdog.c b/tests/gem_watchdog.c
new file mode 100644
index 000000000000..ba5b77766d4c
--- /dev/null
+++ b/tests/gem_watchdog.c
@@ -0,0 +1,186 @@
+/*
+ * Copyright © 2018 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+#include "igt.h"
+#include "igt_sysfs.h"
+
+#include <fcntl.h>
+#include <sys/time.h>
+
+IGT_TEST_DESCRIPTION("This test adds basic set of tests to reset the different,"
+                     " GPU engines through the watchdog timer.");
+
+#define WATCHDOG_THRESHOLD (1500)
+
+#define RENDER_CLASS 0
+#define VIDEO_DECODE_CLASS 1
+#define VIDEO_ENHANCEMENT_CLASS 2
+#define COPY_ENGINE_CLASS 3
+
+#define LOCAL_I915_CONTEXT_PARAM_WATCHDOG 0x7
+
+static void clear_error_state(int fd)
+{
+	int dir;
+
+	dir = igt_sysfs_open(fd, NULL);
+
+	if (dir < 0)
+		return;
+
+	/* Any write to the error state clears it */
+	igt_sysfs_set(dir, "error", "");
+	close(dir);
+}
+
+static bool check_error_state(int fd)
+{
+	char *error, *str;
+	bool found = false;
+	int dir;
+
+	dir = igt_sysfs_open(fd, NULL);
+
+	error = igt_sysfs_get(dir, "error");
+	igt_sysfs_set(dir, "error", "Begone!");
+
+	igt_assert(error);
+	igt_debug("Error: %s\n", error);
+
+	if ((str = strstr(error, "GPU HANG"))) {
+		igt_debug("Found error state! GPU hang triggered! %s\n", str);
+		found = true;
+	}
+
+	close(dir);
+
+	return found;
+}
+
+static void context_set_watchdog(int fd, const struct intel_execution_engine2 *e,
+                                 unsigned ctx, unsigned threshold)
+{
+	unsigned engines_threshold[16];
+	unsigned engine_id;
+	struct drm_i915_gem_context_param arg = {
+		.ctx_id = ctx,
+		.param = LOCAL_I915_CONTEXT_PARAM_WATCHDOG,
+		.value = (uint64_t)&engines_threshold,
+		.size = sizeof(arg.value)
+	};
+
+	memset(&engines_threshold, 0, sizeof(engines_threshold));
+
+	engine_id = gem_class_instance_to_eb_flags(fd, e->class, e->instance);
+
+	/* read existing values */
+	gem_context_get_param(fd, &arg);
+
+	switch (engine_id & I915_EXEC_RING_MASK) {
+	case I915_EXEC_RENDER:
+		engines_threshold[RENDER_CLASS] = threshold;
+		break;
+	case I915_EXEC_BSD:
+		engines_threshold[VIDEO_DECODE_CLASS] = threshold;
+		break;
+	case I915_EXEC_VEBOX:
+		engines_threshold[VIDEO_ENHANCEMENT_CLASS] = threshold;
+		break;
+	default:
+	break;
+	}
+
+	gem_context_set_param(fd, &arg);
+}
+
+static double elapsed(const struct timeval *start,
+		const struct timeval *end)
+{
+	return 1e6*(end->tv_sec - start->tv_sec) + (end->tv_usec - start->tv_usec);
+}
+
+static void inject_hang(uint32_t fd, uint32_t ctx, const struct intel_execution_engine2 *e, unsigned flags)
+{
+	igt_hang_t hang;
+	unsigned engine_id;
+
+	engine_id = gem_class_instance_to_eb_flags(fd, e->class, e->instance);
+	hang = igt_hang_ctx(fd, ctx, engine_id, flags);
+	gem_sync(fd, hang.spin->handle);
+}
+
+static void media_hang_simple(int fd, const struct intel_execution_engine2 *e)
+{
+	uint32_t ctx;
+	unsigned flags = HANG_ALLOW_CAPTURE;
+	struct timeval start, end;
+	double dt_msecs;
+
+	/* Submit on default context */
+	ctx = 0;
+	context_set_watchdog(fd, e, ctx, WATCHDOG_THRESHOLD);
+
+	clear_error_state(fd);
+
+	gettimeofday(&start, NULL);
+	inject_hang(fd, ctx, e, flags);
+	gettimeofday(&end, NULL);
+	dt_msecs = elapsed(&start, &end)/1000;
+
+	/* reset time for watchdog should be less than 2*threshold + engine reset time + submission */
+	igt_assert(dt_msecs < 2*WATCHDOG_THRESHOLD + 15);
+
+	/* Assert if error state is not clean */
+	igt_assert(!check_error_state(fd));
+}
+
+igt_main
+{
+	int fd = -1;
+
+	igt_skip_on_simulation();
+
+	igt_fixture {
+		fd = drm_open_driver(DRIVER_INTEL);
+		igt_require_gem(fd);
+	}
+
+	for (const struct intel_execution_engine2 *e = intel_execution_engines2; e->name; e++) {
+		igt_subtest_group {
+			igt_fixture {
+				gem_require_engine(fd, e->class, e->instance);
+			}
+
+			/* default exec-id is purely symbolic */
+			if (strcmp(e->name, "bcs0") == 0)
+				continue;
+
+			igt_subtest_f("basic-%s", e->name) {
+				media_hang_simple(fd, e);
+			}
+		}
+	}
+
+	igt_fixture {
+		close(fd);
+	}
+}
diff --git a/tests/meson.build b/tests/meson.build
index 17deb945ec95..3b864d891a08 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -130,6 +130,7 @@ test_progs = [
 	'gem_unref_active_buffers',
 	'gem_userptr_blits',
 	'gem_wait',
+        'gem_watchdog',
 	'gem_workarounds',
 	'gem_write_read_ring_switch',
 	'gen3_mixed_blits',
-- 
2.7.4

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

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

* [igt-dev] ✓ Fi.CI.BAT: success for tests/gem_watchdog: Initial set of tests for GPU watchdog (rev2)
  2018-10-06  1:05 [igt-dev] [PATCH i-g-t v2] tests/gem_watchdog: GPU engine reset Carlos Santa
  2018-10-06  1:05 ` [igt-dev] [PATCH i-g-t v2] tests/gem_watchdog: Initial set of tests for GPU watchdog Carlos Santa
@ 2018-10-06  2:39 ` Patchwork
  2018-10-06 11:28 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  2 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2018-10-06  2:39 UTC (permalink / raw)
  To: Carlos Santa; +Cc: igt-dev

== Series Details ==

Series: tests/gem_watchdog: Initial set of tests for GPU watchdog (rev2)
URL   : https://patchwork.freedesktop.org/series/50041/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4944 -> IGTPW_1921 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/50041/revisions/2/mbox/

== Known issues ==

  Here are the changes found in IGTPW_1921 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-bdw-samus:       NOTRUN -> INCOMPLETE (fdo#107773)
      fi-blb-e6850:       PASS -> INCOMPLETE (fdo#107718)

    
    ==== Possible fixes ====

    igt@gem_exec_suspend@basic-s3:
      fi-bdw-samus:       INCOMPLETE (fdo#107773) -> PASS

    igt@pm_rpm@module-reload:
      fi-glk-j4005:       DMESG-WARN (fdo#107726) -> PASS

    
  fdo#107718 https://bugs.freedesktop.org/show_bug.cgi?id=107718
  fdo#107726 https://bugs.freedesktop.org/show_bug.cgi?id=107726
  fdo#107773 https://bugs.freedesktop.org/show_bug.cgi?id=107773


== Participating hosts (45 -> 40) ==

  Missing    (5): fi-ctg-p8600 fi-bsw-cyan fi-ilk-m540 fi-byt-squawks fi-icl-u2 


== Build changes ==

    * IGT: IGT_4670 -> IGTPW_1921

  CI_DRM_4944: 66bd263b99fd264b57432c232756baf95b0a6255 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1921: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1921/
  IGT_4670: 7e066794d2ea860f4199fd67549080de17b6b852 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools



== Testlist changes ==

+igt@gem_watchdog@basic-rcs0
+igt@gem_watchdog@basic-vcs0
+igt@gem_watchdog@basic-vcs1
+igt@gem_watchdog@basic-vecs0

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1921/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] ✓ Fi.CI.IGT: success for tests/gem_watchdog: Initial set of tests for GPU watchdog (rev2)
  2018-10-06  1:05 [igt-dev] [PATCH i-g-t v2] tests/gem_watchdog: GPU engine reset Carlos Santa
  2018-10-06  1:05 ` [igt-dev] [PATCH i-g-t v2] tests/gem_watchdog: Initial set of tests for GPU watchdog Carlos Santa
  2018-10-06  2:39 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/gem_watchdog: Initial set of tests for GPU watchdog (rev2) Patchwork
@ 2018-10-06 11:28 ` Patchwork
  2 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2018-10-06 11:28 UTC (permalink / raw)
  To: Carlos Santa; +Cc: igt-dev

== Series Details ==

Series: tests/gem_watchdog: Initial set of tests for GPU watchdog (rev2)
URL   : https://patchwork.freedesktop.org/series/50041/
State : success

== Summary ==

= CI Bug Log - changes from IGT_4670_full -> IGTPW_1921_full =

== Summary - WARNING ==

  Minor unknown changes coming with IGTPW_1921_full need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_1921_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/50041/revisions/2/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in IGTPW_1921_full:

  === IGT changes ===

    ==== Possible regressions ====

    {igt@gem_watchdog@basic-rcs0}:
      shard-hsw:          NOTRUN -> FAIL +2

    {igt@gem_watchdog@basic-vcs0}:
      shard-glk:          NOTRUN -> FAIL +2
      shard-snb:          NOTRUN -> FAIL

    {igt@gem_watchdog@basic-vecs0}:
      shard-kbl:          NOTRUN -> FAIL +3
      shard-apl:          NOTRUN -> FAIL +2

    
    ==== Warnings ====

    igt@kms_chv_cursor_fail@pipe-a-64x64-top-edge:
      shard-apl:          PASS -> SKIP +29

    igt@pm_rc6_residency@rc6-accuracy:
      shard-kbl:          SKIP -> PASS
      shard-snb:          PASS -> SKIP

    
== Known issues ==

  Here are the changes found in IGTPW_1921_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@drv_suspend@debugfs-reader:
      shard-kbl:          PASS -> INCOMPLETE (fdo#103665)

    igt@drv_suspend@shrink:
      shard-glk:          PASS -> INCOMPLETE (fdo#106886, fdo#103359, k.org#198133)

    igt@gem_persistent_relocs@forked-thrashing:
      shard-apl:          PASS -> INCOMPLETE (fdo#103927)

    igt@kms_color@pipe-a-degamma:
      shard-apl:          PASS -> FAIL (fdo#108145, fdo#104782)

    igt@kms_cursor_crc@cursor-256x256-random:
      shard-apl:          PASS -> FAIL (fdo#103232) +2

    igt@kms_cursor_crc@cursor-256x256-sliding:
      shard-glk:          PASS -> FAIL (fdo#103232) +1

    igt@kms_cursor_crc@cursor-64x64-sliding:
      shard-kbl:          PASS -> FAIL (fdo#103232)

    igt@kms_flip@2x-busy-flip-interruptible:
      shard-glk:          PASS -> FAIL (fdo#103257)

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-blt:
      shard-glk:          PASS -> FAIL (fdo#103167) +6

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-mmap-gtt:
      shard-kbl:          PASS -> FAIL (fdo#103167) +2

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-cpu:
      shard-apl:          PASS -> FAIL (fdo#103167) +4

    igt@kms_frontbuffer_tracking@fbc-1p-rte:
      shard-glk:          PASS -> FAIL (fdo#103167, fdo#105682)
      shard-apl:          PASS -> FAIL (fdo#103167, fdo#105682)

    igt@kms_plane@pixel-format-pipe-a-planes:
      shard-kbl:          PASS -> FAIL (fdo#103166)

    igt@kms_plane@plane-panning-bottom-right-pipe-b-planes:
      shard-glk:          PASS -> DMESG-WARN (fdo#105763, fdo#106538)

    igt@kms_plane@plane-position-covered-pipe-a-planes:
      shard-glk:          PASS -> FAIL (fdo#103166) +1

    igt@kms_plane_multiple@atomic-pipe-c-tiling-y:
      shard-apl:          PASS -> FAIL (fdo#103166)

    
    ==== Possible fixes ====

    igt@kms_available_modes_crc@available_mode_test_crc:
      shard-apl:          FAIL (fdo#106641) -> PASS

    igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-c:
      shard-apl:          DMESG-WARN (fdo#107956) -> SKIP

    igt@kms_ccs@pipe-b-crc-sprite-planes-basic:
      shard-apl:          FAIL (fdo#105458, fdo#106510) -> SKIP

    igt@kms_cursor_crc@cursor-128x42-random:
      shard-glk:          FAIL (fdo#103232) -> PASS +1

    igt@kms_cursor_crc@cursor-64x21-random:
      shard-apl:          FAIL (fdo#103232) -> PASS +8

    igt@kms_cursor_crc@cursor-64x21-sliding:
      shard-kbl:          FAIL (fdo#103232) -> PASS

    igt@kms_cursor_crc@cursor-64x64-suspend:
      shard-apl:          FAIL (fdo#103232, fdo#103191) -> PASS

    igt@kms_cursor_legacy@cursorb-vs-flipb-toggle:
      shard-glk:          DMESG-WARN (fdo#105763, fdo#106538) -> PASS +1

    igt@kms_flip@2x-flip-vs-expired-vblank-interruptible:
      shard-glk:          FAIL (fdo#105363) -> PASS

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-mmap-cpu:
      shard-apl:          FAIL (fdo#103167) -> SKIP

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt:
      shard-apl:          FAIL (fdo#103167) -> PASS +4

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-move:
      shard-kbl:          FAIL (fdo#103167) -> PASS

    igt@kms_frontbuffer_tracking@fbc-2p-primscrn-cur-indfb-draw-blt:
      shard-glk:          FAIL (fdo#103167) -> PASS +2

    igt@kms_plane@pixel-format-pipe-a-planes:
      shard-snb:          FAIL (fdo#107749, fdo#103166) -> PASS

    {igt@kms_plane_alpha_blend@pipe-a-alpha-opaque-fb}:
      shard-apl:          FAIL (fdo#108145) -> SKIP

    {igt@kms_plane_alpha_blend@pipe-c-alpha-7efc}:
      shard-apl:          FAIL (fdo#108146) -> SKIP

    {igt@kms_plane_alpha_blend@pipe-c-constant-alpha-max}:
      shard-glk:          FAIL (fdo#108145) -> PASS +1
      shard-kbl:          FAIL (fdo#108145) -> PASS
      shard-apl:          FAIL (fdo#108145) -> PASS

    igt@kms_plane_multiple@atomic-pipe-c-tiling-x:
      shard-glk:          FAIL (fdo#103166) -> PASS +3

    igt@kms_plane_multiple@atomic-pipe-c-tiling-yf:
      shard-apl:          FAIL (fdo#103166) -> PASS +2
      shard-kbl:          FAIL (fdo#103166) -> PASS +2

    igt@kms_setmode@basic:
      shard-kbl:          FAIL (fdo#99912) -> PASS

    
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
  fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
  fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
  fdo#103232 https://bugs.freedesktop.org/show_bug.cgi?id=103232
  fdo#103257 https://bugs.freedesktop.org/show_bug.cgi?id=103257
  fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
  fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
  fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
  fdo#104782 https://bugs.freedesktop.org/show_bug.cgi?id=104782
  fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
  fdo#105458 https://bugs.freedesktop.org/show_bug.cgi?id=105458
  fdo#105682 https://bugs.freedesktop.org/show_bug.cgi?id=105682
  fdo#105763 https://bugs.freedesktop.org/show_bug.cgi?id=105763
  fdo#106510 https://bugs.freedesktop.org/show_bug.cgi?id=106510
  fdo#106538 https://bugs.freedesktop.org/show_bug.cgi?id=106538
  fdo#106641 https://bugs.freedesktop.org/show_bug.cgi?id=106641
  fdo#106886 https://bugs.freedesktop.org/show_bug.cgi?id=106886
  fdo#107749 https://bugs.freedesktop.org/show_bug.cgi?id=107749
  fdo#107956 https://bugs.freedesktop.org/show_bug.cgi?id=107956
  fdo#108145 https://bugs.freedesktop.org/show_bug.cgi?id=108145
  fdo#108146 https://bugs.freedesktop.org/show_bug.cgi?id=108146
  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 (6 -> 5) ==

  Missing    (1): shard-skl 


== Build changes ==

    * IGT: IGT_4670 -> IGTPW_1921
    * Linux: CI_DRM_4933 -> CI_DRM_4944

  CI_DRM_4933: 6b7a44d1597791524f46d7ea17620db54dffdc8c @ git://anongit.freedesktop.org/gfx-ci/linux
  CI_DRM_4944: 66bd263b99fd264b57432c232756baf95b0a6255 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1921: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1921/
  IGT_4670: 7e066794d2ea860f4199fd67549080de17b6b852 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1921/shards.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t v2] tests/gem_watchdog: Initial set of tests for GPU watchdog
  2018-10-06  1:05 ` [igt-dev] [PATCH i-g-t v2] tests/gem_watchdog: Initial set of tests for GPU watchdog Carlos Santa
@ 2018-10-08 21:43   ` Antonio Argenziano
  2018-10-09  8:27     ` Chris Wilson
  0 siblings, 1 reply; 7+ messages in thread
From: Antonio Argenziano @ 2018-10-08 21:43 UTC (permalink / raw)
  To: Carlos Santa, igt-dev; +Cc: Michel Thierry



On 05/10/18 18:05, Carlos Santa wrote:
> This test adds basic set of tests to reset the different
> GPU engines through the watchdog timer.
> 
> Credits to Antonio for the original codebase this is based on.
> 
> This was verified on SKL/ULT GT3:
> 
> $./gem_watchdog --run-subtest basic-vecs0
> IGT-Version: 1.23-gaaeb2007206d (x86_64) (Linux: 4.18.0-rc7+ x86_64)
> Starting subtest: basic-vecs0
> Subtest basic-vecs0: SUCCESS (2.402s)
> $ sudo cat /sys/kernel/debug/dri/0/i915_reset_info
> full gpu reset = 0
> GuC watchdog/media reset = 0
> rcs0 = 0
> bcs0 = 0
> vcs0 = 0
> vcs1 = 0
> vecs0 = 1
> 
> v2: (Review comments from Chris Wilson)
>   * Replace send_canary() by timestamps before/after the hang
>     and measure dt. Use dt < 2*threshold + reset + submission
>     to check watchdog vs hangcheck
>   * Initialize drm_i915_gem_context_param args only once at
>     the struct declaration
>   * Avoid using MAX_ENGINES implicitly to declare engines_thresholds
>     array
>   * Remove unnecessary igt_assert(!check_error_state(fd))
>   * Use the class:instance interface when looping through the engines
> 
>    (Review by Petri Latvala)
>   * Update the correct patch's year timestamp
>   * Include IGT_DESCRIPTION() label
> 
> Cc: Antonio Argenziano <antonio.argenziano@intel.com>
> Cc: Michel Thierry <michel.thierry@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Carlos Santa <carlos.santa@intel.com>
> ---
>   tests/Makefile.sources |   1 +
>   tests/gem_watchdog.c   | 186 +++++++++++++++++++++++++++++++++++++++++++++++++
>   tests/meson.build      |   1 +
>   3 files changed, 188 insertions(+)
>   create mode 100644 tests/gem_watchdog.c
> 


> +
> +static void media_hang_simple(int fd, const struct intel_execution_engine2 *e)
> +{
> +	uint32_t ctx;
> +	unsigned flags = HANG_ALLOW_CAPTURE;
> +	struct timeval start, end;
> +	double dt_msecs;
> +
> +	/* Submit on default context */
> +	ctx = 0;
> +	context_set_watchdog(fd, e, ctx, WATCHDOG_THRESHOLD);
> +
> +	clear_error_state(fd);
> +
> +	gettimeofday(&start, NULL);
> +	inject_hang(fd, ctx, e, flags);
> +	gettimeofday(&end, NULL);
> +	dt_msecs = elapsed(&start, &end)/1000;
> +
> +	/* reset time for watchdog should be less than 2*threshold + engine reset time + submission */
> +	igt_assert(dt_msecs < 2*WATCHDOG_THRESHOLD + 15);
> +
> +	/* Assert if error state is not clean */
> +	igt_assert(!check_error_state(fd));

If you have a small enough threshold you don't need the dmesg check for 
resets. IMO, ideally there would be a way to have the hang_detector 
running but that doesn't work because it would disable watchdog as well.

> +}
> +
> +igt_main
> +{
> +	int fd = -1;
> +
> +	igt_skip_on_simulation();
> +
> +	igt_fixture {
> +		fd = drm_open_driver(DRIVER_INTEL);
> +		igt_require_gem(fd);
> +	}
> +
> +	for (const struct intel_execution_engine2 *e = intel_execution_engines2; e->name; e++) {
> +		igt_subtest_group {
> +			igt_fixture {
> +				gem_require_engine(fd, e->class, e->instance);

Move the require inside the subtest to maintain a consistent test list 
across platforms.

Thanks,
Antonio

> +			}
> +
> +			/* default exec-id is purely symbolic */
> +			if (strcmp(e->name, "bcs0") == 0)
> +				continue;
> +
> +			igt_subtest_f("basic-%s", e->name) {
> +				media_hang_simple(fd, e);
> +			}
> +		}
> +	}
> +
> +	igt_fixture {
> +		close(fd);
> +	}
> +}
> diff --git a/tests/meson.build b/tests/meson.build
> index 17deb945ec95..3b864d891a08 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -130,6 +130,7 @@ test_progs = [
>   	'gem_unref_active_buffers',
>   	'gem_userptr_blits',
>   	'gem_wait',
> +        'gem_watchdog',
>   	'gem_workarounds',
>   	'gem_write_read_ring_switch',
>   	'gen3_mixed_blits',
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t v2] tests/gem_watchdog: Initial set of tests for GPU watchdog
  2018-10-08 21:43   ` Antonio Argenziano
@ 2018-10-09  8:27     ` Chris Wilson
  2018-10-09 16:12       ` Antonio Argenziano
  0 siblings, 1 reply; 7+ messages in thread
From: Chris Wilson @ 2018-10-09  8:27 UTC (permalink / raw)
  To: Antonio Argenziano, Carlos Santa, igt-dev; +Cc: Michel Thierry

Quoting Antonio Argenziano (2018-10-08 22:43:39)
> 
> 
> On 05/10/18 18:05, Carlos Santa wrote:
> > This test adds basic set of tests to reset the different
> > GPU engines through the watchdog timer.
> > 
> > Credits to Antonio for the original codebase this is based on.
> > 
> > This was verified on SKL/ULT GT3:
> > 
> > $./gem_watchdog --run-subtest basic-vecs0
> > IGT-Version: 1.23-gaaeb2007206d (x86_64) (Linux: 4.18.0-rc7+ x86_64)
> > Starting subtest: basic-vecs0
> > Subtest basic-vecs0: SUCCESS (2.402s)
> > $ sudo cat /sys/kernel/debug/dri/0/i915_reset_info
> > full gpu reset = 0
> > GuC watchdog/media reset = 0
> > rcs0 = 0
> > bcs0 = 0
> > vcs0 = 0
> > vcs1 = 0
> > vecs0 = 1
> > 
> > v2: (Review comments from Chris Wilson)
> >   * Replace send_canary() by timestamps before/after the hang
> >     and measure dt. Use dt < 2*threshold + reset + submission
> >     to check watchdog vs hangcheck
> >   * Initialize drm_i915_gem_context_param args only once at
> >     the struct declaration
> >   * Avoid using MAX_ENGINES implicitly to declare engines_thresholds
> >     array
> >   * Remove unnecessary igt_assert(!check_error_state(fd))
> >   * Use the class:instance interface when looping through the engines
> > 
> >    (Review by Petri Latvala)
> >   * Update the correct patch's year timestamp
> >   * Include IGT_DESCRIPTION() label
> > 
> > Cc: Antonio Argenziano <antonio.argenziano@intel.com>
> > Cc: Michel Thierry <michel.thierry@intel.com>
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > Signed-off-by: Carlos Santa <carlos.santa@intel.com>
> > ---
> >   tests/Makefile.sources |   1 +
> >   tests/gem_watchdog.c   | 186 +++++++++++++++++++++++++++++++++++++++++++++++++
> >   tests/meson.build      |   1 +
> >   3 files changed, 188 insertions(+)
> >   create mode 100644 tests/gem_watchdog.c
> > 
> 
> 
> > +
> > +static void media_hang_simple(int fd, const struct intel_execution_engine2 *e)
> > +{
> > +     uint32_t ctx;
> > +     unsigned flags = HANG_ALLOW_CAPTURE;
> > +     struct timeval start, end;
> > +     double dt_msecs;
> > +
> > +     /* Submit on default context */
> > +     ctx = 0;
> > +     context_set_watchdog(fd, e, ctx, WATCHDOG_THRESHOLD);
> > +
> > +     clear_error_state(fd);
> > +
> > +     gettimeofday(&start, NULL);
> > +     inject_hang(fd, ctx, e, flags);
> > +     gettimeofday(&end, NULL);
> > +     dt_msecs = elapsed(&start, &end)/1000;
> > +
> > +     /* reset time for watchdog should be less than 2*threshold + engine reset time + submission */
> > +     igt_assert(dt_msecs < 2*WATCHDOG_THRESHOLD + 15);
> > +
> > +     /* Assert if error state is not clean */
> > +     igt_assert(!check_error_state(fd));
> 
> If you have a small enough threshold you don't need the dmesg check for 
> resets. IMO, ideally there would be a way to have the hang_detector 
> running but that doesn't work because it would disable watchdog as well.

There will be no be capture. The stop_machine() employed there is the
antithesis of light and fast reset. There will be no uevent since that
is the global reset, so hang detector will not work. The way to detect
the failure is to check the fence status which will report the reset of
that particular request. inject_hang() needs to be reworked and
gettimeofday() can be replaced by any of the igt timers.
context_set_watchdog uapi is very wrong. The assert that dt is less than
2*threshold is intriguing since the kernel patches should require 2
evaluation intervals to detect a stuck seqno, and the arbitrary epsilon
will be upset by the slightest sneeze, let alone scheduler misbehaviour
and kasan.

> > +}
> > +
> > +igt_main
> > +{
> > +     int fd = -1;
> > +
> > +     igt_skip_on_simulation();

This is definitely suitable for sim as we are testing control of hw
features (which should help underline how far off dt asserts will be).

> > +     igt_fixture {
> > +             fd = drm_open_driver(DRIVER_INTEL);
> > +             igt_require_gem(fd);
> > +     }
> > +
> > +     for (const struct intel_execution_engine2 *e = intel_execution_engines2; e->name; e++) {
> > +             igt_subtest_group {
> > +                     igt_fixture {
> > +                             gem_require_engine(fd, e->class, e->instance);
> 
> Move the require inside the subtest to maintain a consistent test list 
> across platforms.
> 
> Thanks,
> Antonio
> 
> > +                     }
> > +
> > +                     /* default exec-id is purely symbolic */

And this is purely garbage.
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t v2] tests/gem_watchdog: Initial set of tests for GPU watchdog
  2018-10-09  8:27     ` Chris Wilson
@ 2018-10-09 16:12       ` Antonio Argenziano
  0 siblings, 0 replies; 7+ messages in thread
From: Antonio Argenziano @ 2018-10-09 16:12 UTC (permalink / raw)
  To: Chris Wilson, Carlos Santa, igt-dev; +Cc: Michel Thierry



On 09/10/18 01:27, Chris Wilson wrote:
> Quoting Antonio Argenziano (2018-10-08 22:43:39)
>>
>>
>> On 05/10/18 18:05, Carlos Santa wrote:
>>> This test adds basic set of tests to reset the different
>>> GPU engines through the watchdog timer.
>>>
>>> Credits to Antonio for the original codebase this is based on.
>>>
>>> This was verified on SKL/ULT GT3:
>>>
>>> $./gem_watchdog --run-subtest basic-vecs0
>>> IGT-Version: 1.23-gaaeb2007206d (x86_64) (Linux: 4.18.0-rc7+ x86_64)
>>> Starting subtest: basic-vecs0
>>> Subtest basic-vecs0: SUCCESS (2.402s)
>>> $ sudo cat /sys/kernel/debug/dri/0/i915_reset_info
>>> full gpu reset = 0
>>> GuC watchdog/media reset = 0
>>> rcs0 = 0
>>> bcs0 = 0
>>> vcs0 = 0
>>> vcs1 = 0
>>> vecs0 = 1
>>>
>>> v2: (Review comments from Chris Wilson)
>>>    * Replace send_canary() by timestamps before/after the hang
>>>      and measure dt. Use dt < 2*threshold + reset + submission
>>>      to check watchdog vs hangcheck
>>>    * Initialize drm_i915_gem_context_param args only once at
>>>      the struct declaration
>>>    * Avoid using MAX_ENGINES implicitly to declare engines_thresholds
>>>      array
>>>    * Remove unnecessary igt_assert(!check_error_state(fd))
>>>    * Use the class:instance interface when looping through the engines
>>>
>>>     (Review by Petri Latvala)
>>>    * Update the correct patch's year timestamp
>>>    * Include IGT_DESCRIPTION() label
>>>
>>> Cc: Antonio Argenziano <antonio.argenziano@intel.com>
>>> Cc: Michel Thierry <michel.thierry@intel.com>
>>> Cc: Chris Wilson <chris@chris-wilson.co.uk>
>>> Signed-off-by: Carlos Santa <carlos.santa@intel.com>
>>> ---
>>>    tests/Makefile.sources |   1 +
>>>    tests/gem_watchdog.c   | 186 +++++++++++++++++++++++++++++++++++++++++++++++++
>>>    tests/meson.build      |   1 +
>>>    3 files changed, 188 insertions(+)
>>>    create mode 100644 tests/gem_watchdog.c
>>>
>>
>>
>>> +
>>> +static void media_hang_simple(int fd, const struct intel_execution_engine2 *e)
>>> +{
>>> +     uint32_t ctx;
>>> +     unsigned flags = HANG_ALLOW_CAPTURE;
>>> +     struct timeval start, end;
>>> +     double dt_msecs;
>>> +
>>> +     /* Submit on default context */
>>> +     ctx = 0;
>>> +     context_set_watchdog(fd, e, ctx, WATCHDOG_THRESHOLD);
>>> +
>>> +     clear_error_state(fd);
>>> +
>>> +     gettimeofday(&start, NULL);
>>> +     inject_hang(fd, ctx, e, flags);
>>> +     gettimeofday(&end, NULL);
>>> +     dt_msecs = elapsed(&start, &end)/1000;
>>> +
>>> +     /* reset time for watchdog should be less than 2*threshold + engine reset time + submission */
>>> +     igt_assert(dt_msecs < 2*WATCHDOG_THRESHOLD + 15);
>>> +
>>> +     /* Assert if error state is not clean */
>>> +     igt_assert(!check_error_state(fd));
>>
>> If you have a small enough threshold you don't need the dmesg check for
>> resets. IMO, ideally there would be a way to have the hang_detector
>> running but that doesn't work because it would disable watchdog as well.
> 
> There will be no be capture. The stop_machine() employed there is the
> antithesis of light and fast reset. There will be no uevent since that
> is the global reset, so hang detector will not work. The way to detect
> the failure is to check the fence status which will report the reset of
> that particular request. inject_hang() needs to be reworked and
> gettimeofday() can be replaced by any of the igt timers.

What I was trying to say is that if we had the interface to say have 
watchdog and global reset we could use the hang detector to fail the 
test but, I guess the fence would make things simpler.

> context_set_watchdog uapi is very wrong. The assert that dt is less than
> 2*threshold is intriguing since the kernel patches should require 2
> evaluation intervals to detect a stuck seqno, and the arbitrary epsilon
> will be upset by the slightest sneeze, let alone scheduler misbehaviour
> and kasan.

Would making the process realtime solve the problem? I think you 
originally were suggesting to use 3 batches with the hang sandwiched 
between timestamps. I wonder if we could do it with only one batch like:

TIMESTAMP
TIMESTAMP <--+
LOOP --------+

But I am not sure if the second timestamp might get corrupted in the reset.

> 
>>> +}
>>> +
>>> +igt_main
>>> +{
>>> +     int fd = -1;
>>> +
>>> +     igt_skip_on_simulation();
> 
> This is definitely suitable for sim as we are testing control of hw
> features (which should help underline how far off dt asserts will be).

I think an allow_hang() and a feature based igt_require() in the fixture 
below are needed.

> 
>>> +     igt_fixture {
>>> +             fd = drm_open_driver(DRIVER_INTEL);
>>> +             igt_require_gem(fd);
>>> +     }
>>> +
>>> +     for (const struct intel_execution_engine2 *e = intel_execution_engines2; e->name; e++) {
>>> +             igt_subtest_group {
>>> +                     igt_fixture {
>>> +                             gem_require_engine(fd, e->class, e->instance);
>>
>> Move the require inside the subtest to maintain a consistent test list
>> across platforms.
>>
>> Thanks,
>> Antonio
>>
>>> +                     }
>>> +
>>> +                     /* default exec-id is purely symbolic */
> 
> And this is purely garbage.

I think that was me, a long time ago...

Antonio

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

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

end of thread, other threads:[~2018-10-09 16:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-06  1:05 [igt-dev] [PATCH i-g-t v2] tests/gem_watchdog: GPU engine reset Carlos Santa
2018-10-06  1:05 ` [igt-dev] [PATCH i-g-t v2] tests/gem_watchdog: Initial set of tests for GPU watchdog Carlos Santa
2018-10-08 21:43   ` Antonio Argenziano
2018-10-09  8:27     ` Chris Wilson
2018-10-09 16:12       ` Antonio Argenziano
2018-10-06  2:39 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/gem_watchdog: Initial set of tests for GPU watchdog (rev2) Patchwork
2018-10-06 11:28 ` [igt-dev] ✓ 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.