All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [i-g-t, 1/1] Uevent listener for fake gt reset failure.
@ 2023-06-05  5:50 Himal Prasad Ghimiray
  2023-06-05 17:44 ` [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [i-g-t,1/1] " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Himal Prasad Ghimiray @ 2023-06-05  5:50 UTC (permalink / raw)
  To: igt-dev; +Cc: Himal Prasad Ghimiray

This test is to cause the fake reset failure and capture the uevent
sent in case of gt reset failure.

The sending of Uevent is taken care by series:
drm/xe: Notify Userspace when engine/gt reset fails.

The infra to cause fake reset failure is in series:
drm/xe: Add a debugfs for faking gt reset failure.

Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
---
 tests/meson.build                             |   1 +
 .../xe_uevent_listener_fake_reset_failure.c   | 128 ++++++++++++++++++
 2 files changed, 129 insertions(+)
 create mode 100644 tests/xe/xe_uevent_listener_fake_reset_failure.c

diff --git a/tests/meson.build b/tests/meson.build
index f71be1db..cc5843d7 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -268,6 +268,7 @@ xe_progs = [
 	'xe_query',
 	'xe_vm',
 	'xe_waitfence',
+	'xe_uevent_listener_fake_reset_failure',
 ]
 
 msm_progs = [
diff --git a/tests/xe/xe_uevent_listener_fake_reset_failure.c b/tests/xe/xe_uevent_listener_fake_reset_failure.c
new file mode 100644
index 00000000..dd22e4c2
--- /dev/null
+++ b/tests/xe/xe_uevent_listener_fake_reset_failure.c
@@ -0,0 +1,128 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+/**
+ * TEST: cause fake gt reset failure and listen uevent from KMD
+ * SUBTEST:fake_reset_uevent_listener
+ * Description:
+ *		Test creates uevent listener and causes fake reset failure for gt0
+ *		and returns success if uevent is sent by driver and listened by listener.
+ */
+
+#include "igt.h"
+#include "xe_drm.h"
+#include "xe/xe_query.h"
+#include <string.h>
+#include <libudev.h>
+#include <sys/stat.h>
+
+static bool xe_force_gt_fake_reset(int fd, int gt)
+{
+	char reset_string[128];
+	struct stat st;
+
+	igt_assert_eq(fstat(fd, &st), 0);
+	snprintf(reset_string, sizeof(reset_string),
+		 "cat /sys/kernel/debug/dri/%d/gt%d/fake_reset_failure", minor(st.st_rdev), gt);
+
+	if (system(reset_string))
+		return false;
+
+	return true;
+}
+
+static bool listen_reset_fail_uevent(struct udev_device *device, const char *source, int gt_id)
+{
+	struct udev_list_entry *list_entry;
+	bool reset_failed = false;
+	bool reset_unit_is_gt = false;
+	bool gt_id_matches = false;
+	const char *name, *val;
+
+	udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(device))
+	{
+		name = udev_list_entry_get_name(list_entry);
+		val = udev_list_entry_get_value(list_entry);
+
+		if (!strcmp(name, "RESET_FAILED") && !strcmp(val, "1")) {
+			printf("%s = %s\n", name, val);
+			reset_failed = true;
+			continue;
+		}
+
+		if (!strcmp(name, "RESET_UNIT") && !strcmp(val, "gt")) {
+			printf("%s = %s\n", name, val);
+			reset_unit_is_gt = true;
+			continue;
+		}
+
+		if (!strcmp(name, "RESET_ID") && (atoi(val) == gt_id)) {
+			printf("%s = %s\n", name, val);
+			gt_id_matches = true;
+			continue;
+		}
+	}
+
+	return (reset_failed && reset_unit_is_gt && gt_id_matches);
+}
+
+static void fake_reset_uevent_listener(int fd, int gt_id)
+{
+	struct udev *udev;
+	struct udev_device *dev;
+	struct udev_monitor *mon;
+	bool event_recieved = false;
+	bool event_sent = false;
+
+	/* create udev object */
+	udev = udev_new();
+	if (!udev) {
+		fprintf(stderr, "Can't create udev\n");
+		goto no_udev;
+	}
+
+	mon = udev_monitor_new_from_netlink(udev, "kernel");
+	udev_monitor_filter_add_match_subsystem_devtype(mon, "drm", "drm_minor");
+	udev_monitor_enable_receiving(mon);
+	igt_until_timeout(5) {
+			dev = udev_monitor_receive_device(mon);
+
+			if (dev) {
+				event_recieved = listen_reset_fail_uevent(dev, "kernel", gt_id);
+				udev_device_unref(dev);
+			}
+
+			if (event_sent)
+				goto free_udev;
+
+		event_sent = xe_force_gt_fake_reset(fd, gt_id);
+		usleep(50 * 1000);
+	}
+
+free_udev:
+	udev_unref(udev);
+no_udev:
+	igt_assert(event_recieved);
+}
+
+igt_main
+{
+	int fd;
+
+	igt_fixture {
+		fd = drm_open_driver(DRIVER_XE);
+		xe_device_get(fd);
+	}
+
+	usleep(50 * 1000);
+
+	igt_subtest("fake_reset_uevent_listener")
+		fake_reset_uevent_listener(fd, 0);
+
+	igt_fixture {
+		xe_device_put(fd);
+		close(fd);
+	}
+}
-- 
2.25.1

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

* [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [i-g-t,1/1] Uevent listener for fake gt reset failure.
  2023-06-05  5:50 [igt-dev] [i-g-t, 1/1] Uevent listener for fake gt reset failure Himal Prasad Ghimiray
@ 2023-06-05 17:44 ` Patchwork
  2023-06-05 18:10 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2023-06-05 17:44 UTC (permalink / raw)
  To: Himal Prasad Ghimiray; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,1/1] Uevent listener for fake gt reset failure.
URL   : https://patchwork.freedesktop.org/series/118877/
State : warning

== Summary ==

Pipeline status: FAILED.

see https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/pipelines/899899 for the overview.

build:tests-debian-meson-arm64 has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/43122298):
  Pulling docker image registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-79704081 ...
  Using docker image sha256:f30fc6cc2c3a3c5f3ae052ef95ae06faaf8878f0f9f58ddad81986525d03775e for registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-79704081 with digest registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper@sha256:bb764179fa955138995229ea5deeaa77d171aa4bcc10e0f0b0233b1f2e1eb1c2 ...
  Authenticating with credentials from job payload (GitLab Registry)
  Pulling docker image registry.freedesktop.org/gfx-ci/igt-ci-tags/build-debian-arm64:commit-4a5ace7cbaa36ee552040e9e7f3fcbc60dbd13f7 ...
  Using docker image sha256:7360075a71dacfc66f0b49b3271b9a459904dbe51c5760efac48fe52da27946c for registry.freedesktop.org/gfx-ci/igt-ci-tags/build-debian-arm64:commit-4a5ace7cbaa36ee552040e9e7f3fcbc60dbd13f7 with digest registry.freedesktop.org/gfx-ci/igt-ci-tags/build-debian-arm64@sha256:df8438cd0e218646c3bdc2eb6abccb43c4e884bfd40a1a4dd0365f1f8031d21f ...
  section_end:1685986918:prepare_executor
  section_start:1685986918:prepare_script
  Preparing environment
  Running on runner-yyhtcik-project-3185-concurrent-3 via 650f0182b086...
  section_end:1685986919:prepare_script
  section_start:1685986919:get_sources
  Getting source from Git repository
  $ /host/bin/curl -s -L --cacert /host/ca-certificates.crt --retry 4 -f --retry-delay 60 https://gitlab.freedesktop.org/freedesktop/helm-gitlab-infra/-/raw/main/runner-gating/runner-gating.sh | sh -s -- pre_get_sources_script
  /bin/bash: line 142: /host/bin/curl: cannot execute binary file: Exec format error
  section_end:1685986920:get_sources
  section_start:1685986920:cleanup_file_variables
  Cleaning up project directory and file based variables
  section_end:1685986921:cleanup_file_variables
  ERROR: Job failed: exit code 1
  

build:tests-fedora has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/43122290):
  Pulling docker image registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-79704081 ...
  Using docker image sha256:f30fc6cc2c3a3c5f3ae052ef95ae06faaf8878f0f9f58ddad81986525d03775e for registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-79704081 with digest registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper@sha256:bb764179fa955138995229ea5deeaa77d171aa4bcc10e0f0b0233b1f2e1eb1c2 ...
  Authenticating with credentials from job payload (GitLab Registry)
  Pulling docker image registry.freedesktop.org/gfx-ci/igt-ci-tags/build-fedora:commit-4a5ace7cbaa36ee552040e9e7f3fcbc60dbd13f7 ...
  Using docker image sha256:4b3054d89ef79f9be95501786fbbbe22857d02c867fff99693808cd80909939f for registry.freedesktop.org/gfx-ci/igt-ci-tags/build-fedora:commit-4a5ace7cbaa36ee552040e9e7f3fcbc60dbd13f7 with digest registry.freedesktop.org/gfx-ci/igt-ci-tags/build-fedora@sha256:17d64607d998df2bf29a56b88922d3a598e6f1daa3b51ece2a892c2f293daf83 ...
  section_end:1685986918:prepare_executor
  section_start:1685986918:prepare_script
  Preparing environment
  Running on runner-yyhtcik-project-3185-concurrent-0 via 650f0182b086...
  section_end:1685986919:prepare_script
  section_start:1685986919:get_sources
  Getting source from Git repository
  $ /host/bin/curl -s -L --cacert /host/ca-certificates.crt --retry 4 -f --retry-delay 60 https://gitlab.freedesktop.org/freedesktop/helm-gitlab-infra/-/raw/main/runner-gating/runner-gating.sh | sh -s -- pre_get_sources_script
  /bin/bash: line 142: /host/bin/curl: cannot execute binary file: Exec format error
  section_end:1685986920:get_sources
  section_start:1685986920:cleanup_file_variables
  Cleaning up project directory and file based variables
  section_end:1685986921:cleanup_file_variables
  ERROR: Job failed: exit code 1
  

build:tests-fedora-clang has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/43122294):
  Pulling docker image registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-79704081 ...
  Using docker image sha256:f30fc6cc2c3a3c5f3ae052ef95ae06faaf8878f0f9f58ddad81986525d03775e for registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-79704081 with digest registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper@sha256:bb764179fa955138995229ea5deeaa77d171aa4bcc10e0f0b0233b1f2e1eb1c2 ...
  Authenticating with credentials from job payload (GitLab Registry)
  Pulling docker image registry.freedesktop.org/gfx-ci/igt-ci-tags/build-fedora:commit-4a5ace7cbaa36ee552040e9e7f3fcbc60dbd13f7 ...
  Using docker image sha256:4b3054d89ef79f9be95501786fbbbe22857d02c867fff99693808cd80909939f for registry.freedesktop.org/gfx-ci/igt-ci-tags/build-fedora:commit-4a5ace7cbaa36ee552040e9e7f3fcbc60dbd13f7 with digest registry.freedesktop.org/gfx-ci/igt-ci-tags/build-fedora@sha256:17d64607d998df2bf29a56b88922d3a598e6f1daa3b51ece2a892c2f293daf83 ...
  section_end:1685986918:prepare_executor
  section_start:1685986918:prepare_script
  Preparing environment
  Running on runner-yyhtcik-project-3185-concurrent-2 via 650f0182b086...
  section_end:1685986919:prepare_script
  section_start:1685986919:get_sources
  Getting source from Git repository
  $ /host/bin/curl -s -L --cacert /host/ca-certificates.crt --retry 4 -f --retry-delay 60 https://gitlab.freedesktop.org/freedesktop/helm-gitlab-infra/-/raw/main/runner-gating/runner-gating.sh | sh -s -- pre_get_sources_script
  /bin/bash: line 143: /host/bin/curl: cannot execute binary file: Exec format error
  section_end:1685986920:get_sources
  section_start:1685986920:cleanup_file_variables
  Cleaning up project directory and file based variables
  section_end:1685986921:cleanup_file_variables
  ERROR: Job failed: exit code 1
  

build:tests-fedora-oldest-meson has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/43122292):
  Pulling docker image registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-79704081 ...
  Using docker image sha256:f30fc6cc2c3a3c5f3ae052ef95ae06faaf8878f0f9f58ddad81986525d03775e for registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-79704081 with digest registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper@sha256:bb764179fa955138995229ea5deeaa77d171aa4bcc10e0f0b0233b1f2e1eb1c2 ...
  Authenticating with credentials from job payload (GitLab Registry)
  Pulling docker image registry.freedesktop.org/gfx-ci/igt-ci-tags/build-fedora:commit-4a5ace7cbaa36ee552040e9e7f3fcbc60dbd13f7 ...
  Using docker image sha256:4b3054d89ef79f9be95501786fbbbe22857d02c867fff99693808cd80909939f for registry.freedesktop.org/gfx-ci/igt-ci-tags/build-fedora:commit-4a5ace7cbaa36ee552040e9e7f3fcbc60dbd13f7 with digest registry.freedesktop.org/gfx-ci/igt-ci-tags/build-fedora@sha256:17d64607d998df2bf29a56b88922d3a598e6f1daa3b51ece2a892c2f293daf83 ...
  section_end:1685986918:prepare_executor
  section_start:1685986918:prepare_script
  Preparing environment
  Running on runner-yyhtcik-project-3185-concurrent-1 via 650f0182b086...
  section_end:1685986919:prepare_script
  section_start:1685986919:get_sources
  Getting source from Git repository
  $ /host/bin/curl -s -L --cacert /host/ca-certificates.crt --retry 4 -f --retry-delay 60 https://gitlab.freedesktop.org/freedesktop/helm-gitlab-infra/-/raw/main/runner-gating/runner-gating.sh | sh -s -- pre_get_sources_script
  /bin/bash: line 142: /host/bin/curl: cannot execute binary file: Exec format error
  section_end:1685986920:get_sources
  section_start:1685986920:cleanup_file_variables
  Cleaning up project directory and file based variables
  section_end:1685986921:cleanup_file_variables
  ERROR: Job failed: exit code 1

== Logs ==

For more details see: https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/pipelines/899899

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

* [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/1] Uevent listener for fake gt reset failure.
  2023-06-05  5:50 [igt-dev] [i-g-t, 1/1] Uevent listener for fake gt reset failure Himal Prasad Ghimiray
  2023-06-05 17:44 ` [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [i-g-t,1/1] " Patchwork
@ 2023-06-05 18:10 ` Patchwork
  2023-06-06 12:23 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2023-06-05 18:10 UTC (permalink / raw)
  To: Himal Prasad Ghimiray; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 6044 bytes --]

== Series Details ==

Series: series starting with [i-g-t,1/1] Uevent listener for fake gt reset failure.
URL   : https://patchwork.freedesktop.org/series/118877/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_13231 -> IGTPW_9105
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/index.html

Participating hosts (38 -> 36)
------------------------------

  Missing    (2): fi-kbl-soraka fi-snb-2520m 

Known issues
------------

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

### IGT changes ###

#### Issues hit ####

  * igt@i915_pm_rpm@module-reload:
    - fi-blb-e6850:       NOTRUN -> [SKIP][1] ([fdo#109271]) +37 similar issues
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/fi-blb-e6850/igt@i915_pm_rpm@module-reload.html

  * igt@i915_selftest@live@slpc:
    - bat-rpls-2:         NOTRUN -> [DMESG-WARN][2] ([i915#6367])
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/bat-rpls-2/igt@i915_selftest@live@slpc.html

  * igt@i915_suspend@basic-s2idle-without-i915:
    - bat-rpls-2:         NOTRUN -> [ABORT][3] ([i915#6687])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/bat-rpls-2/igt@i915_suspend@basic-s2idle-without-i915.html

  * igt@kms_chamelium_hpd@common-hpd-after-suspend:
    - bat-adls-5:         NOTRUN -> [SKIP][4] ([i915#7828])
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/bat-adls-5/igt@kms_chamelium_hpd@common-hpd-after-suspend.html

  * igt@kms_pipe_crc_basic@suspend-read-crc:
    - bat-adls-5:         NOTRUN -> [SKIP][5] ([i915#1845])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/bat-adls-5/igt@kms_pipe_crc_basic@suspend-read-crc.html

  * igt@kms_setmode@basic-clone-single-crtc:
    - fi-blb-e6850:       NOTRUN -> [SKIP][6] ([fdo#109271] / [i915#4579])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/fi-blb-e6850/igt@kms_setmode@basic-clone-single-crtc.html

  
#### Possible fixes ####

  * igt@i915_selftest@live@gt_pm:
    - bat-rpls-2:         [DMESG-FAIL][7] ([i915#4258] / [i915#7913]) -> [PASS][8]
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13231/bat-rpls-2/igt@i915_selftest@live@gt_pm.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/bat-rpls-2/igt@i915_selftest@live@gt_pm.html

  * igt@i915_selftest@live@reset:
    - bat-rpls-2:         [ABORT][9] ([i915#4983] / [i915#7461] / [i915#7913] / [i915#8347]) -> [PASS][10]
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13231/bat-rpls-2/igt@i915_selftest@live@reset.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/bat-rpls-2/igt@i915_selftest@live@reset.html

  * igt@i915_selftest@live@slpc:
    - bat-rpls-1:         [DMESG-WARN][11] ([i915#6367]) -> [PASS][12]
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13231/bat-rpls-1/igt@i915_selftest@live@slpc.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/bat-rpls-1/igt@i915_selftest@live@slpc.html

  * igt@i915_suspend@basic-s3-without-i915:
    - bat-adls-5:         [ABORT][13] -> [PASS][14]
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13231/bat-adls-5/igt@i915_suspend@basic-s3-without-i915.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/bat-adls-5/igt@i915_suspend@basic-s3-without-i915.html

  * igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence@pipe-d-dp-1:
    - bat-dg2-8:          [FAIL][15] ([i915#7932]) -> [PASS][16]
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13231/bat-dg2-8/igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence@pipe-d-dp-1.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/bat-dg2-8/igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence@pipe-d-dp-1.html

  
#### Warnings ####

  * igt@kms_pipe_crc_basic@read-crc-frame-sequence@pipe-a-edp-1:
    - bat-adlp-6:         [ABORT][17] -> [ABORT][18] ([i915#8434])
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13231/bat-adlp-6/igt@kms_pipe_crc_basic@read-crc-frame-sequence@pipe-a-edp-1.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/bat-adlp-6/igt@kms_pipe_crc_basic@read-crc-frame-sequence@pipe-a-edp-1.html

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

  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
  [i915#4258]: https://gitlab.freedesktop.org/drm/intel/issues/4258
  [i915#4423]: https://gitlab.freedesktop.org/drm/intel/issues/4423
  [i915#4579]: https://gitlab.freedesktop.org/drm/intel/issues/4579
  [i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
  [i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
  [i915#6687]: https://gitlab.freedesktop.org/drm/intel/issues/6687
  [i915#7461]: https://gitlab.freedesktop.org/drm/intel/issues/7461
  [i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
  [i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
  [i915#7932]: https://gitlab.freedesktop.org/drm/intel/issues/7932
  [i915#8011]: https://gitlab.freedesktop.org/drm/intel/issues/8011
  [i915#8347]: https://gitlab.freedesktop.org/drm/intel/issues/8347
  [i915#8434]: https://gitlab.freedesktop.org/drm/intel/issues/8434


Build changes
-------------

  * CI: CI-20190529 -> None
  * IGT: IGT_7319 -> IGTPW_9105

  CI-20190529: 20190529
  CI_DRM_13231: 60f1f7c0a570a431f8ca8cc697f7fe8bc0badb83 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_9105: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/index.html
  IGT_7319: 2e1bcd49944452b5f9516eecee48e1fa3ae6a636 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git


Testlist changes
----------------

+igt@xe_uevent_listener_fake_reset_failure@fake_reset_uevent_listener

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/index.html

[-- Attachment #2: Type: text/html, Size: 6997 bytes --]

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

* [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/1] Uevent listener for fake gt reset failure.
  2023-06-05  5:50 [igt-dev] [i-g-t, 1/1] Uevent listener for fake gt reset failure Himal Prasad Ghimiray
  2023-06-05 17:44 ` [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [i-g-t,1/1] " Patchwork
  2023-06-05 18:10 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
@ 2023-06-06 12:23 ` Patchwork
  2023-06-09  9:05 ` [igt-dev] [i-g-t, 1/1] " Kumar, Janga Rahul
  2023-06-09  9:35 ` Kamil Konieczny
  4 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2023-06-06 12:23 UTC (permalink / raw)
  To: Ghimiray, Himal Prasad; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 12832 bytes --]

== Series Details ==

Series: series starting with [i-g-t,1/1] Uevent listener for fake gt reset failure.
URL   : https://patchwork.freedesktop.org/series/118877/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_13231_full -> IGTPW_9105_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/index.html

Participating hosts (7 -> 6)
------------------------------

  Missing    (1): shard-dg1 

Known issues
------------

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

### IGT changes ###

#### Issues hit ####

  * igt@gem_mmap_gtt@fault-concurrent-x:
    - shard-snb:          [PASS][1] -> [ABORT][2] ([i915#5161])
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13231/shard-snb2/igt@gem_mmap_gtt@fault-concurrent-x.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/shard-snb7/igt@gem_mmap_gtt@fault-concurrent-x.html

  * igt@i915_pm_dc@dc9-dpms:
    - shard-apl:          [PASS][3] -> [SKIP][4] ([fdo#109271])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13231/shard-apl2/igt@i915_pm_dc@dc9-dpms.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/shard-apl3/igt@i915_pm_dc@dc9-dpms.html

  * igt@kms_flip@2x-plain-flip:
    - shard-snb:          NOTRUN -> [SKIP][5] ([fdo#109271]) +14 similar issues
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/shard-snb5/igt@kms_flip@2x-plain-flip.html

  * igt@kms_flip@flip-vs-expired-vblank-interruptible@c-hdmi-a1:
    - shard-glk:          [PASS][6] -> [FAIL][7] ([i915#79])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13231/shard-glk5/igt@kms_flip@flip-vs-expired-vblank-interruptible@c-hdmi-a1.html
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/shard-glk5/igt@kms_flip@flip-vs-expired-vblank-interruptible@c-hdmi-a1.html

  * igt@kms_flip@flip-vs-suspend@c-dp1:
    - shard-apl:          [PASS][8] -> [ABORT][9] ([i915#180])
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13231/shard-apl1/igt@kms_flip@flip-vs-suspend@c-dp1.html
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/shard-apl4/igt@kms_flip@flip-vs-suspend@c-dp1.html

  * igt@kms_frontbuffer_tracking@fbc-2p-primscrn-indfb-plflip-blt:
    - shard-snb:          [PASS][10] -> [SKIP][11] ([fdo#109271])
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13231/shard-snb1/igt@kms_frontbuffer_tracking@fbc-2p-primscrn-indfb-plflip-blt.html
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/shard-snb2/igt@kms_frontbuffer_tracking@fbc-2p-primscrn-indfb-plflip-blt.html

  * igt@kms_plane_scaling@plane-upscale-with-modifiers-20x20@pipe-b-hdmi-a-1:
    - shard-snb:          NOTRUN -> [SKIP][12] ([fdo#109271] / [i915#4579]) +10 similar issues
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/shard-snb1/igt@kms_plane_scaling@plane-upscale-with-modifiers-20x20@pipe-b-hdmi-a-1.html

  * igt@perf@stress-open-close@0-rcs0:
    - shard-glk:          [PASS][13] -> [ABORT][14] ([i915#5213] / [i915#7941])
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13231/shard-glk5/igt@perf@stress-open-close@0-rcs0.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/shard-glk4/igt@perf@stress-open-close@0-rcs0.html

  
#### Possible fixes ####

  * igt@drm_fdinfo@most-busy-check-all@rcs0:
    - {shard-rkl}:        [FAIL][15] ([i915#7742]) -> [PASS][16]
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13231/shard-rkl-6/igt@drm_fdinfo@most-busy-check-all@rcs0.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/shard-rkl-1/igt@drm_fdinfo@most-busy-check-all@rcs0.html

  * igt@gem_ctx_exec@basic-nohangcheck:
    - {shard-rkl}:        [FAIL][17] ([i915#6268]) -> [PASS][18]
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13231/shard-rkl-6/igt@gem_ctx_exec@basic-nohangcheck.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/shard-rkl-4/igt@gem_ctx_exec@basic-nohangcheck.html

  * igt@gem_exec_fair@basic-none@vcs0:
    - {shard-rkl}:        [FAIL][19] ([i915#2842]) -> [PASS][20] +1 similar issue
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13231/shard-rkl-1/igt@gem_exec_fair@basic-none@vcs0.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/shard-rkl-6/igt@gem_exec_fair@basic-none@vcs0.html

  * igt@gem_exec_fair@basic-pace-share@rcs0:
    - shard-glk:          [FAIL][21] ([i915#2842]) -> [PASS][22]
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13231/shard-glk4/igt@gem_exec_fair@basic-pace-share@rcs0.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/shard-glk4/igt@gem_exec_fair@basic-pace-share@rcs0.html

  * igt@gem_exec_fair@basic-pace-solo@rcs0:
    - shard-apl:          [FAIL][23] ([i915#2842]) -> [PASS][24]
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13231/shard-apl7/igt@gem_exec_fair@basic-pace-solo@rcs0.html
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/shard-apl3/igt@gem_exec_fair@basic-pace-solo@rcs0.html

  * igt@gem_ppgtt@blt-vs-render-ctx0:
    - shard-snb:          [FAIL][25] ([i915#8295]) -> [PASS][26]
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13231/shard-snb6/igt@gem_ppgtt@blt-vs-render-ctx0.html
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/shard-snb6/igt@gem_ppgtt@blt-vs-render-ctx0.html

  * igt@i915_pm_lpsp@kms-lpsp@kms-lpsp-hdmi-a:
    - {shard-rkl}:        [SKIP][27] ([i915#1937] / [i915#4579]) -> [PASS][28]
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13231/shard-rkl-3/igt@i915_pm_lpsp@kms-lpsp@kms-lpsp-hdmi-a.html
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/shard-rkl-7/igt@i915_pm_lpsp@kms-lpsp@kms-lpsp-hdmi-a.html

  * igt@i915_suspend@basic-s3-without-i915:
    - {shard-rkl}:        [FAIL][29] ([fdo#103375]) -> [PASS][30]
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13231/shard-rkl-6/igt@i915_suspend@basic-s3-without-i915.html
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/shard-rkl-2/igt@i915_suspend@basic-s3-without-i915.html

  * igt@kms_big_fb@y-tiled-max-hw-stride-32bpp-rotate-0-async-flip:
    - {shard-rkl}:        [FAIL][31] ([i915#3743]) -> [PASS][32] +1 similar issue
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13231/shard-rkl-7/igt@kms_big_fb@y-tiled-max-hw-stride-32bpp-rotate-0-async-flip.html
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/shard-rkl-2/igt@kms_big_fb@y-tiled-max-hw-stride-32bpp-rotate-0-async-flip.html

  * igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size:
    - shard-apl:          [FAIL][33] ([i915#2346]) -> [PASS][34] +1 similar issue
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13231/shard-apl3/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/shard-apl4/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html

  * igt@kms_hdr@bpc-switch-dpms@pipe-a-dp-1:
    - shard-apl:          [FAIL][35] ([i915#1188]) -> [PASS][36]
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13231/shard-apl4/igt@kms_hdr@bpc-switch-dpms@pipe-a-dp-1.html
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/shard-apl1/igt@kms_hdr@bpc-switch-dpms@pipe-a-dp-1.html

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

  [fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
  [fdo#109279]: https://bugs.freedesktop.org/show_bug.cgi?id=109279
  [fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
  [fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
  [fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
  [fdo#109302]: https://bugs.freedesktop.org/show_bug.cgi?id=109302
  [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
  [fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
  [fdo#110723]: https://bugs.freedesktop.org/show_bug.cgi?id=110723
  [fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
  [fdo#111614]: https://bugs.freedesktop.org/show_bug.cgi?id=111614
  [fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
  [fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
  [i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
  [i915#1188]: https://gitlab.freedesktop.org/drm/intel/issues/1188
  [i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
  [i915#1825]: https://gitlab.freedesktop.org/drm/intel/issues/1825
  [i915#1937]: https://gitlab.freedesktop.org/drm/intel/issues/1937
  [i915#2346]: https://gitlab.freedesktop.org/drm/intel/issues/2346
  [i915#2435]: https://gitlab.freedesktop.org/drm/intel/issues/2435
  [i915#2527]: https://gitlab.freedesktop.org/drm/intel/issues/2527
  [i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
  [i915#2587]: https://gitlab.freedesktop.org/drm/intel/issues/2587
  [i915#2672]: https://gitlab.freedesktop.org/drm/intel/issues/2672
  [i915#2681]: https://gitlab.freedesktop.org/drm/intel/issues/2681
  [i915#280]: https://gitlab.freedesktop.org/drm/intel/issues/280
  [i915#2842]: https://gitlab.freedesktop.org/drm/intel/issues/2842
  [i915#2856]: https://gitlab.freedesktop.org/drm/intel/issues/2856
  [i915#3023]: https://gitlab.freedesktop.org/drm/intel/issues/3023
  [i915#3116]: https://gitlab.freedesktop.org/drm/intel/issues/3116
  [i915#3318]: https://gitlab.freedesktop.org/drm/intel/issues/3318
  [i915#3359]: https://gitlab.freedesktop.org/drm/intel/issues/3359
  [i915#3469]: https://gitlab.freedesktop.org/drm/intel/issues/3469
  [i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
  [i915#3591]: https://gitlab.freedesktop.org/drm/intel/issues/3591
  [i915#3637]: https://gitlab.freedesktop.org/drm/intel/issues/3637
  [i915#3689]: https://gitlab.freedesktop.org/drm/intel/issues/3689
  [i915#3734]: https://gitlab.freedesktop.org/drm/intel/issues/3734
  [i915#3743]: https://gitlab.freedesktop.org/drm/intel/issues/3743
  [i915#3778]: https://gitlab.freedesktop.org/drm/intel/issues/3778
  [i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
  [i915#4070]: https://gitlab.freedesktop.org/drm/intel/issues/4070
  [i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
  [i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
  [i915#4579]: https://gitlab.freedesktop.org/drm/intel/issues/4579
  [i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
  [i915#5161]: https://gitlab.freedesktop.org/drm/intel/issues/5161
  [i915#5176]: https://gitlab.freedesktop.org/drm/intel/issues/5176
  [i915#5213]: https://gitlab.freedesktop.org/drm/intel/issues/5213
  [i915#5235]: https://gitlab.freedesktop.org/drm/intel/issues/5235
  [i915#5286]: https://gitlab.freedesktop.org/drm/intel/issues/5286
  [i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
  [i915#6095]: https://gitlab.freedesktop.org/drm/intel/issues/6095
  [i915#6268]: https://gitlab.freedesktop.org/drm/intel/issues/6268
  [i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
  [i915#6768]: https://gitlab.freedesktop.org/drm/intel/issues/6768
  [i915#6953]: https://gitlab.freedesktop.org/drm/intel/issues/6953
  [i915#7707]: https://gitlab.freedesktop.org/drm/intel/issues/7707
  [i915#7711]: https://gitlab.freedesktop.org/drm/intel/issues/7711
  [i915#7742]: https://gitlab.freedesktop.org/drm/intel/issues/7742
  [i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
  [i915#79]: https://gitlab.freedesktop.org/drm/intel/issues/79
  [i915#7941]: https://gitlab.freedesktop.org/drm/intel/issues/7941
  [i915#8011]: https://gitlab.freedesktop.org/drm/intel/issues/8011
  [i915#8228]: https://gitlab.freedesktop.org/drm/intel/issues/8228
  [i915#8295]: https://gitlab.freedesktop.org/drm/intel/issues/8295
  [i915#8411]: https://gitlab.freedesktop.org/drm/intel/issues/8411


Build changes
-------------

  * CI: CI-20190529 -> None
  * IGT: IGT_7319 -> IGTPW_9105
  * Piglit: piglit_4509 -> None

  CI-20190529: 20190529
  CI_DRM_13231: 60f1f7c0a570a431f8ca8cc697f7fe8bc0badb83 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_9105: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/index.html
  IGT_7319: 2e1bcd49944452b5f9516eecee48e1fa3ae6a636 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9105/index.html

[-- Attachment #2: Type: text/html, Size: 10720 bytes --]

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

* Re: [igt-dev] [i-g-t, 1/1] Uevent listener for fake gt reset failure.
  2023-06-05  5:50 [igt-dev] [i-g-t, 1/1] Uevent listener for fake gt reset failure Himal Prasad Ghimiray
                   ` (2 preceding siblings ...)
  2023-06-06 12:23 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
@ 2023-06-09  9:05 ` Kumar, Janga Rahul
  2023-06-09  9:22   ` Ghimiray, Himal Prasad
  2023-06-09  9:35 ` Kamil Konieczny
  4 siblings, 1 reply; 8+ messages in thread
From: Kumar, Janga Rahul @ 2023-06-09  9:05 UTC (permalink / raw)
  To: Ghimiray, Himal Prasad, igt-dev; +Cc: Gandi, Ramadevi



> -----Original Message-----
> From: igt-dev <igt-dev-bounces@lists.freedesktop.org> On Behalf Of Himal
> Prasad Ghimiray
> Sent: 05 June 2023 11:21
> To: igt-dev@lists.freedesktop.org
> Cc: Ghimiray, Himal Prasad <himal.prasad.ghimiray@intel.com>
> Subject: [igt-dev] [i-g-t, 1/1] Uevent listener for fake gt reset failure.
> 
> This test is to cause the fake reset failure and capture the uevent sent in case of
> gt reset failure.
> 
> The sending of Uevent is taken care by series:
> drm/xe: Notify Userspace when engine/gt reset fails.
> 
> The infra to cause fake reset failure is in series:
> drm/xe: Add a debugfs for faking gt reset failure.
> 
> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
> ---
>  tests/meson.build                             |   1 +
>  .../xe_uevent_listener_fake_reset_failure.c   | 128 ++++++++++++++++++
>  2 files changed, 129 insertions(+)
>  create mode 100644 tests/xe/xe_uevent_listener_fake_reset_failure.c
> 
> diff --git a/tests/meson.build b/tests/meson.build index f71be1db..cc5843d7
> 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -268,6 +268,7 @@ xe_progs = [
>  	'xe_query',
>  	'xe_vm',
>  	'xe_waitfence',
> +	'xe_uevent_listener_fake_reset_failure',
Please maintain above list in alphabetically sorted order
>  ]
> 
>  msm_progs = [
> diff --git a/tests/xe/xe_uevent_listener_fake_reset_failure.c
> b/tests/xe/xe_uevent_listener_fake_reset_failure.c
> new file mode 100644
> index 00000000..dd22e4c2
> --- /dev/null
> +++ b/tests/xe/xe_uevent_listener_fake_reset_failure.c
> @@ -0,0 +1,128 @@
> +// SPDX-License-Identifier: MIT
> +/*
> + * Copyright © 2023 Intel Corporation
> + */
> +
> +/**
> + * TEST: cause fake gt reset failure and listen uevent from KMD
> + * SUBTEST:fake_reset_uevent_listener
> + * Description:
> + *		Test creates uevent listener and causes fake reset failure for gt0
> + *		and returns success if uevent is sent by driver and listened by
> listener.
> + */
> +
> +#include "igt.h"
> +#include "xe_drm.h"
> +#include "xe/xe_query.h"
> +#include <string.h>
> +#include <libudev.h>
> +#include <sys/stat.h>
> +
> +static bool xe_force_gt_fake_reset(int fd, int gt) {
Move this function to lib
> +	char reset_string[128];
> +	struct stat st;
> +
> +	igt_assert_eq(fstat(fd, &st), 0);
> +	snprintf(reset_string, sizeof(reset_string),
> +		 "cat /sys/kernel/debug/dri/%d/gt%d/fake_reset_failure",
> +minor(st.st_rdev), gt);
> +
> +	if (system(reset_string))
> +		return false;
> +
> +	return true;
> +}
> +
> +static bool listen_reset_fail_uevent(struct udev_device *device, const
> +char *source, int gt_id) {
> +	struct udev_list_entry *list_entry;
> +	bool reset_failed = false;
> +	bool reset_unit_is_gt = false;
> +	bool gt_id_matches = false;
> +	const char *name, *val;
> +
> +	udev_list_entry_foreach(list_entry,
> udev_device_get_properties_list_entry(device))
> +	{
> +		name = udev_list_entry_get_name(list_entry);
> +		val = udev_list_entry_get_value(list_entry);
> +
> +		if (!strcmp(name, "RESET_FAILED") && !strcmp(val, "1")) {
> +			printf("%s = %s\n", name, val);
> +			reset_failed = true;
> +			continue;
> +		}
> +
> +		if (!strcmp(name, "RESET_UNIT") && !strcmp(val, "gt")) {
> +			printf("%s = %s\n", name, val);
> +			reset_unit_is_gt = true;
> +			continue;
> +		}
> +
> +		if (!strcmp(name, "RESET_ID") && (atoi(val) == gt_id)) {
> +			printf("%s = %s\n", name, val);
> +			gt_id_matches = true;
> +			continue;
> +		}
> +	}
> +
> +	return (reset_failed && reset_unit_is_gt && gt_id_matches); }
> +
> +static void fake_reset_uevent_listener(int fd, int gt_id) {
> +	struct udev *udev;
> +	struct udev_device *dev;
> +	struct udev_monitor *mon;
> +	bool event_recieved = false;
> +	bool event_sent = false;
> +
> +	/* create udev object */
> +	udev = udev_new();
> +	if (!udev) {
> +		fprintf(stderr, "Can't create udev\n");
> +		goto no_udev;
> +	}
> +
> +	mon = udev_monitor_new_from_netlink(udev, "kernel");
> +	udev_monitor_filter_add_match_subsystem_devtype(mon, "drm",
> "drm_minor");
> +	udev_monitor_enable_receiving(mon);
> +	igt_until_timeout(5) {
> +			dev = udev_monitor_receive_device(mon);
> +
> +			if (dev) {
> +				event_recieved = listen_reset_fail_uevent(dev,
> "kernel", gt_id);
> +				udev_device_unref(dev);
> +			}
> +
> +			if (event_sent)
> +				goto free_udev;
> +
> +		event_sent = xe_force_gt_fake_reset(fd, gt_id);
> +		usleep(50 * 1000);
> +	}
> +
> +free_udev:
> +	udev_unref(udev);
> +no_udev:
> +	igt_assert(event_recieved);
> +}
> +
> +igt_main
> +{
> +	int fd;
> +
> +	igt_fixture {
> +		fd = drm_open_driver(DRIVER_XE);
> +		xe_device_get(fd);
> +	}
> +
> +	usleep(50 * 1000);
> +
> +	igt_subtest("fake_reset_uevent_listener")
> +		fake_reset_uevent_listener(fd, 0);
Check for all the available GT's available on the testing platform.


Thanks,
Rahul
> +
> +	igt_fixture {
> +		xe_device_put(fd);
> +		close(fd);
> +	}
> +}
> --
> 2.25.1


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

* Re: [igt-dev] [i-g-t, 1/1] Uevent listener for fake gt reset failure.
  2023-06-09  9:05 ` [igt-dev] [i-g-t, 1/1] " Kumar, Janga Rahul
@ 2023-06-09  9:22   ` Ghimiray, Himal Prasad
  0 siblings, 0 replies; 8+ messages in thread
From: Ghimiray, Himal Prasad @ 2023-06-09  9:22 UTC (permalink / raw)
  To: Kumar, Janga Rahul, igt-dev; +Cc: Gandi, Ramadevi



> -----Original Message-----
> From: Kumar, Janga Rahul <janga.rahul.kumar@intel.com>
> Sent: 09 June 2023 14:35
> To: Ghimiray, Himal Prasad <himal.prasad.ghimiray@intel.com>; igt-
> dev@lists.freedesktop.org
> Cc: Ghimiray, Himal Prasad <himal.prasad.ghimiray@intel.com>; Gandi,
> Ramadevi <ramadevi.gandi@intel.com>
> Subject: RE: [igt-dev] [i-g-t, 1/1] Uevent listener for fake gt reset failure.
> 
> 
> 
> > -----Original Message-----
> > From: igt-dev <igt-dev-bounces@lists.freedesktop.org> On Behalf Of
> > Himal Prasad Ghimiray
> > Sent: 05 June 2023 11:21
> > To: igt-dev@lists.freedesktop.org
> > Cc: Ghimiray, Himal Prasad <himal.prasad.ghimiray@intel.com>
> > Subject: [igt-dev] [i-g-t, 1/1] Uevent listener for fake gt reset failure.
> >
> > This test is to cause the fake reset failure and capture the uevent
> > sent in case of gt reset failure.
> >
> > The sending of Uevent is taken care by series:
> > drm/xe: Notify Userspace when engine/gt reset fails.
> >
> > The infra to cause fake reset failure is in series:
> > drm/xe: Add a debugfs for faking gt reset failure.
> >
> > Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
> > ---
> >  tests/meson.build                             |   1 +
> >  .../xe_uevent_listener_fake_reset_failure.c   | 128 ++++++++++++++++++
> >  2 files changed, 129 insertions(+)
> >  create mode 100644 tests/xe/xe_uevent_listener_fake_reset_failure.c
> >
> > diff --git a/tests/meson.build b/tests/meson.build index
> > f71be1db..cc5843d7
> > 100644
> > --- a/tests/meson.build
> > +++ b/tests/meson.build
> > @@ -268,6 +268,7 @@ xe_progs = [
> >  	'xe_query',
> >  	'xe_vm',
> >  	'xe_waitfence',
> > +	'xe_uevent_listener_fake_reset_failure',
> Please maintain above list in alphabetically sorted order
Sure. Will do in next patch. 
> >  ]
> >
> >  msm_progs = [
> > diff --git a/tests/xe/xe_uevent_listener_fake_reset_failure.c
> > b/tests/xe/xe_uevent_listener_fake_reset_failure.c
> > new file mode 100644
> > index 00000000..dd22e4c2
> > --- /dev/null
> > +++ b/tests/xe/xe_uevent_listener_fake_reset_failure.c
> > @@ -0,0 +1,128 @@
> > +// SPDX-License-Identifier: MIT
> > +/*
> > + * Copyright © 2023 Intel Corporation  */
> > +
> > +/**
> > + * TEST: cause fake gt reset failure and listen uevent from KMD
> > + * SUBTEST:fake_reset_uevent_listener
> > + * Description:
> > + *		Test creates uevent listener and causes fake reset failure for
> gt0
> > + *		and returns success if uevent is sent by driver and listened by
> > listener.
> > + */
> > +
> > +#include "igt.h"
> > +#include "xe_drm.h"
> > +#include "xe/xe_query.h"
> > +#include <string.h>
> > +#include <libudev.h>
> > +#include <sys/stat.h>
> > +
> > +static bool xe_force_gt_fake_reset(int fd, int gt) {
> Move this function to lib

This function shouldn't be used by any other test cases.
If in future we find any reasons to cause fake reset failure will move it to lib.
> > +	char reset_string[128];
> > +	struct stat st;
> > +
> > +	igt_assert_eq(fstat(fd, &st), 0);
> > +	snprintf(reset_string, sizeof(reset_string),
> > +		 "cat /sys/kernel/debug/dri/%d/gt%d/fake_reset_failure",
> > +minor(st.st_rdev), gt);
> > +
> > +	if (system(reset_string))
> > +		return false;
> > +
> > +	return true;
> > +}
> > +
> > +static bool listen_reset_fail_uevent(struct udev_device *device,
> > +const char *source, int gt_id) {
> > +	struct udev_list_entry *list_entry;
> > +	bool reset_failed = false;
> > +	bool reset_unit_is_gt = false;
> > +	bool gt_id_matches = false;
> > +	const char *name, *val;
> > +
> > +	udev_list_entry_foreach(list_entry,
> > udev_device_get_properties_list_entry(device))
> > +	{
> > +		name = udev_list_entry_get_name(list_entry);
> > +		val = udev_list_entry_get_value(list_entry);
> > +
> > +		if (!strcmp(name, "RESET_FAILED") && !strcmp(val, "1")) {
> > +			printf("%s = %s\n", name, val);
> > +			reset_failed = true;
> > +			continue;
> > +		}
> > +
> > +		if (!strcmp(name, "RESET_UNIT") && !strcmp(val, "gt")) {
> > +			printf("%s = %s\n", name, val);
> > +			reset_unit_is_gt = true;
> > +			continue;
> > +		}
> > +
> > +		if (!strcmp(name, "RESET_ID") && (atoi(val) == gt_id)) {
> > +			printf("%s = %s\n", name, val);
> > +			gt_id_matches = true;
> > +			continue;
> > +		}
> > +	}
> > +
> > +	return (reset_failed && reset_unit_is_gt && gt_id_matches); }
> > +
> > +static void fake_reset_uevent_listener(int fd, int gt_id) {
> > +	struct udev *udev;
> > +	struct udev_device *dev;
> > +	struct udev_monitor *mon;
> > +	bool event_recieved = false;
> > +	bool event_sent = false;
> > +
> > +	/* create udev object */
> > +	udev = udev_new();
> > +	if (!udev) {
> > +		fprintf(stderr, "Can't create udev\n");
> > +		goto no_udev;
> > +	}
> > +
> > +	mon = udev_monitor_new_from_netlink(udev, "kernel");
> > +	udev_monitor_filter_add_match_subsystem_devtype(mon, "drm",
> > "drm_minor");
> > +	udev_monitor_enable_receiving(mon);
> > +	igt_until_timeout(5) {
> > +			dev = udev_monitor_receive_device(mon);
> > +
> > +			if (dev) {
> > +				event_recieved =
> listen_reset_fail_uevent(dev,
> > "kernel", gt_id);
> > +				udev_device_unref(dev);
> > +			}
> > +
> > +			if (event_sent)
> > +				goto free_udev;
> > +
> > +		event_sent = xe_force_gt_fake_reset(fd, gt_id);
> > +		usleep(50 * 1000);
> > +	}
> > +
> > +free_udev:
> > +	udev_unref(udev);
> > +no_udev:
> > +	igt_assert(event_recieved);
> > +}
> > +
> > +igt_main
> > +{
> > +	int fd;
> > +
> > +	igt_fixture {
> > +		fd = drm_open_driver(DRIVER_XE);
> > +		xe_device_get(fd);
> > +	}
> > +
> > +	usleep(50 * 1000);
> > +
> > +	igt_subtest("fake_reset_uevent_listener")
> > +		fake_reset_uevent_listener(fd, 0);
> Check for all the available GT's available on the testing platform.
IMO requirement is to test whether uevents are coming from KMD in case of gt reset failure or not.
So testing one of the GT should be sufficient. 
But if recommendation is to do it for all gt, that can be done. 
> 
> 
> Thanks,
> Rahul
> > +
> > +	igt_fixture {
> > +		xe_device_put(fd);
> > +		close(fd);
> > +	}
> > +}
> > --
> > 2.25.1


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

* Re: [igt-dev] [i-g-t, 1/1] Uevent listener for fake gt reset failure.
  2023-06-05  5:50 [igt-dev] [i-g-t, 1/1] Uevent listener for fake gt reset failure Himal Prasad Ghimiray
                   ` (3 preceding siblings ...)
  2023-06-09  9:05 ` [igt-dev] [i-g-t, 1/1] " Kumar, Janga Rahul
@ 2023-06-09  9:35 ` Kamil Konieczny
  2023-06-13  8:46   ` Ghimiray, Himal Prasad
  4 siblings, 1 reply; 8+ messages in thread
From: Kamil Konieczny @ 2023-06-09  9:35 UTC (permalink / raw)
  To: igt-dev

Hi Himal,

please do not put dot at the end of subject:

Uevent listener for fake gt reset failure.
-----------------------------------------^

Remove this '.' from the end. Also please add at begin what
part of igt you modify, here it is adding new xe test so:

tests/xe/xe_uevent: add new test for uevent gt reset failure

On 2023-06-05 at 11:20:59 +0530, Himal Prasad Ghimiray wrote:
> This test is to cause the fake reset failure and capture the uevent
--------------------------- ^^^^
Describe why we need a fake one, not real one.

> sent in case of gt reset failure.
> 
> The sending of Uevent is taken care by series:
> drm/xe: Notify Userspace when engine/gt reset fails.

Please write here link to public patchwork or GitLab or, if you
prefer to not include it inot this description, put it after
signed-off-by line and afer "---" line, see below.

> 
> The infra to cause fake reset failure is in series:
> drm/xe: Add a debugfs for faking gt reset failure.

Same here, please also provide link.

> 
> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
> ---

---
Write here other comments or links which you do not want to be merged.


>  tests/meson.build                             |   1 +
>  .../xe_uevent_listener_fake_reset_failure.c   | 128 ++++++++++++++++++
>  2 files changed, 129 insertions(+)
>  create mode 100644 tests/xe/xe_uevent_listener_fake_reset_failure.c
> 
> diff --git a/tests/meson.build b/tests/meson.build
> index f71be1db..cc5843d7 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -268,6 +268,7 @@ xe_progs = [
>  	'xe_query',
>  	'xe_vm',
>  	'xe_waitfence',
> +	'xe_uevent_listener_fake_reset_failure',
----------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is too long for a name and also looks like one-only test,
so please make it short, something like:

	'xe_uevent',

This way we can extend it in future for new subtests.
Also, as noted by Rahul, keep it sorted alphabetiacally.

>  ]
>  
>  msm_progs = [
> diff --git a/tests/xe/xe_uevent_listener_fake_reset_failure.c b/tests/xe/xe_uevent_listener_fake_reset_failure.c
> new file mode 100644
> index 00000000..dd22e4c2
> --- /dev/null
> +++ b/tests/xe/xe_uevent_listener_fake_reset_failure.c
> @@ -0,0 +1,128 @@
> +// SPDX-License-Identifier: MIT
> +/*
> + * Copyright © 2023 Intel Corporation
> + */
> +
> +/**
> + * TEST: cause fake gt reset failure and listen uevent from KMD
> + * SUBTEST:fake_reset_uevent_listener
> + * Description:
> + *		Test creates uevent listener and causes fake reset failure for gt0
> + *		and returns success if uevent is sent by driver and listened by listener.
> + */
> +
> +#include "igt.h"
------------ ^
> +#include "xe_drm.h"
------------ ^
Keep includes sorted alphabetically, also please put system
includes first, then write one newline, then igt includes.
> +#include "xe/xe_query.h"

Newline here to separate system and igt includes.

> +#include <string.h>
------------ ^
> +#include <libudev.h>
------------ ^
> +#include <sys/stat.h>
------------ ^
Same here, sort them and swap (first system headers, then igt).

> +
> +static bool xe_force_gt_fake_reset(int fd, int gt)
> +{
> +	char reset_string[128];
> +	struct stat st;
> +
> +	igt_assert_eq(fstat(fd, &st), 0);
> +	snprintf(reset_string, sizeof(reset_string),
> +		 "cat /sys/kernel/debug/dri/%d/gt%d/fake_reset_failure", minor(st.st_rdev), gt);
----------------- ^
Just open and write to this file, search for igt helper in lib.

> +
> +	if (system(reset_string))
----------- ^
Direct write is better for error handling.

> +		return false;
> +
> +	return true;
> +}
> +
> +static bool listen_reset_fail_uevent(struct udev_device *device, const char *source, int gt_id)
> +{
> +	struct udev_list_entry *list_entry;
> +	bool reset_failed = false;
> +	bool reset_unit_is_gt = false;
> +	bool gt_id_matches = false;
> +	const char *name, *val;
> +
> +	udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(device))
> +	{
> +		name = udev_list_entry_get_name(list_entry);
> +		val = udev_list_entry_get_value(list_entry);
> +
> +		if (!strcmp(name, "RESET_FAILED") && !strcmp(val, "1")) {
> +			printf("%s = %s\n", name, val);
----------------------- ^
Do not use printf, use igt_debug or igt_info. Use of igt_debug
is preferable as to not clobber output.

> +			reset_failed = true;
> +			continue;
> +		}
> +
> +		if (!strcmp(name, "RESET_UNIT") && !strcmp(val, "gt")) {
> +			printf("%s = %s\n", name, val);
----------------------- ^
Same here.

> +			reset_unit_is_gt = true;
> +			continue;
> +		}
> +
> +		if (!strcmp(name, "RESET_ID") && (atoi(val) == gt_id)) {
> +			printf("%s = %s\n", name, val);
----------------------- ^
Same here.

> +			gt_id_matches = true;
> +			continue;
> +		}
> +	}
> +
> +	return (reset_failed && reset_unit_is_gt && gt_id_matches);
> +}
> +
> +static void fake_reset_uevent_listener(int fd, int gt_id)
> +{
> +	struct udev *udev;
> +	struct udev_device *dev;
> +	struct udev_monitor *mon;
> +	bool event_recieved = false;
> +	bool event_sent = false;
> +
> +	/* create udev object */
> +	udev = udev_new();
> +	if (!udev) {
> +		fprintf(stderr, "Can't create udev\n");
--------------- ^
use igt_debug

> +		goto no_udev;
--------------- ^
Instead of goto please use igt_assert_f(false, "describe fail here\n");

> +	}
> +
> +	mon = udev_monitor_new_from_netlink(udev, "kernel");
> +	udev_monitor_filter_add_match_subsystem_devtype(mon, "drm", "drm_minor");
> +	udev_monitor_enable_receiving(mon);
> +	igt_until_timeout(5) {
------------------------- ^
Write it as define or constant.

> +			dev = udev_monitor_receive_device(mon);
> +
> +			if (dev) {
> +				event_recieved = listen_reset_fail_uevent(dev, "kernel", gt_id);
> +				udev_device_unref(dev);
> +			}
> +
> +			if (event_sent)
> +				goto free_udev;
------------------------------- ^
Just
				break;

is imho better.

> +
> +		event_sent = xe_force_gt_fake_reset(fd, gt_id);
> +		usleep(50 * 1000);
---------------------- ^
Write it as define or constant also comment why you want to sleep here.

> +	}
> +
> +free_udev:
> +	udev_unref(udev);
> +no_udev:
> +	igt_assert(event_recieved);
> +}
> +
> +igt_main
> +{
> +	int fd;
> +
> +	igt_fixture {
> +		fd = drm_open_driver(DRIVER_XE);
> +		xe_device_get(fd);
> +	}
> +
> +	usleep(50 * 1000);
------- ^
Do not make such sleeps here, why do you need it here?

Regards,
Kamil

> +
> +	igt_subtest("fake_reset_uevent_listener")
> +		fake_reset_uevent_listener(fd, 0);
> +
> +	igt_fixture {
> +		xe_device_put(fd);
> +		close(fd);
> +	}
> +}
> -- 
> 2.25.1
> 

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

* Re: [igt-dev] [i-g-t, 1/1] Uevent listener for fake gt reset failure.
  2023-06-09  9:35 ` Kamil Konieczny
@ 2023-06-13  8:46   ` Ghimiray, Himal Prasad
  0 siblings, 0 replies; 8+ messages in thread
From: Ghimiray, Himal Prasad @ 2023-06-13  8:46 UTC (permalink / raw)
  To: Kamil Konieczny, igt-dev

Hi Kamil,
Thanks for the review. 

> -----Original Message-----
> From: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> Sent: 09 June 2023 15:06
> To: igt-dev@lists.freedesktop.org
> Cc: Ghimiray, Himal Prasad <himal.prasad.ghimiray@intel.com>; Kumar,
> Janga Rahul <janga.rahul.kumar@intel.com>
> Subject: Re: [igt-dev] [i-g-t, 1/1] Uevent listener for fake gt reset failure.
> 
> Hi Himal,
> 
> please do not put dot at the end of subject:
> 
> Uevent listener for fake gt reset failure.
> -----------------------------------------^
> 
> Remove this '.' from the end. Also please add at begin what part of igt you
> modify, here it is adding new xe test so:
> 
> tests/xe/xe_uevent: add new test for uevent gt reset failure

Will address in next patch.
> 
> On 2023-06-05 at 11:20:59 +0530, Himal Prasad Ghimiray wrote:
> > This test is to cause the fake reset failure and capture the uevent
> --------------------------- ^^^^
> Describe why we need a fake one, not real one.
Sure.
> 
> > sent in case of gt reset failure.
> >
> > The sending of Uevent is taken care by series:
> > drm/xe: Notify Userspace when engine/gt reset fails.
> 
Will upload the patchwork link in next patch.
> Please write here link to public patchwork or GitLab or, if you prefer to not
> include it inot this description, put it after signed-off-by line and afer "---"
> line, see below.
> 
> >
> > The infra to cause fake reset failure is in series:
> > drm/xe: Add a debugfs for faking gt reset failure.
> 
> Same here, please also provide link.

Will address.
> 
> >
> > Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
> > ---
> 
> ---
> Write here other comments or links which you do not want to be merged.
> 
> 
> >  tests/meson.build                             |   1 +
> >  .../xe_uevent_listener_fake_reset_failure.c   | 128 ++++++++++++++++++
> >  2 files changed, 129 insertions(+)
> >  create mode 100644 tests/xe/xe_uevent_listener_fake_reset_failure.c
> >
> > diff --git a/tests/meson.build b/tests/meson.build index
> > f71be1db..cc5843d7 100644
> > --- a/tests/meson.build
> > +++ b/tests/meson.build
> > @@ -268,6 +268,7 @@ xe_progs = [
> >  	'xe_query',
> >  	'xe_vm',
> >  	'xe_waitfence',
> > +	'xe_uevent_listener_fake_reset_failure',
> ----------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This is too long for a name
> and also looks like one-only test, so please make it short, something like:
> 
> 	'xe_uevent',
> 
> This way we can extend it in future for new subtests.
> Also, as noted by Rahul, keep it sorted alphabetiacally.
Sure. Will address it.
> 
> >  ]
> >
> >  msm_progs = [
> > diff --git a/tests/xe/xe_uevent_listener_fake_reset_failure.c
> > b/tests/xe/xe_uevent_listener_fake_reset_failure.c
> > new file mode 100644
> > index 00000000..dd22e4c2
> > --- /dev/null
> > +++ b/tests/xe/xe_uevent_listener_fake_reset_failure.c
> > @@ -0,0 +1,128 @@
> > +// SPDX-License-Identifier: MIT
> > +/*
> > + * Copyright © 2023 Intel Corporation  */
> > +
> > +/**
> > + * TEST: cause fake gt reset failure and listen uevent from KMD
> > + * SUBTEST:fake_reset_uevent_listener
> > + * Description:
> > + *		Test creates uevent listener and causes fake reset failure for
> gt0
> > + *		and returns success if uevent is sent by driver and listened by
> listener.
> > + */
> > +
> > +#include "igt.h"
> ------------ ^
> > +#include "xe_drm.h"
> ------------ ^
> Keep includes sorted alphabetically, also please put system includes first,
> then write one newline, then igt includes.
> > +#include "xe/xe_query.h"
> 
> Newline here to separate system and igt includes.
> 
> > +#include <string.h>
> ------------ ^
> > +#include <libudev.h>
> ------------ ^
> > +#include <sys/stat.h>
> ------------ ^
> Same here, sort them and swap (first system headers, then igt).

Will address them.
> 
> > +
> > +static bool xe_force_gt_fake_reset(int fd, int gt) {
> > +	char reset_string[128];
> > +	struct stat st;
> > +
> > +	igt_assert_eq(fstat(fd, &st), 0);
> > +	snprintf(reset_string, sizeof(reset_string),
> > +		 "cat /sys/kernel/debug/dri/%d/gt%d/fake_reset_failure",
> > +minor(st.st_rdev), gt);
> ----------------- ^
> Just open and write to this file, search for igt helper in lib.
Will look into it.
> 
> > +
> > +	if (system(reset_string))
> ----------- ^
> Direct write is better for error handling.
> 
> > +		return false;
> > +
> > +	return true;
> > +}
> > +
> > +static bool listen_reset_fail_uevent(struct udev_device *device,
> > +const char *source, int gt_id) {
> > +	struct udev_list_entry *list_entry;
> > +	bool reset_failed = false;
> > +	bool reset_unit_is_gt = false;
> > +	bool gt_id_matches = false;
> > +	const char *name, *val;
> > +
> > +	udev_list_entry_foreach(list_entry,
> udev_device_get_properties_list_entry(device))
> > +	{
> > +		name = udev_list_entry_get_name(list_entry);
> > +		val = udev_list_entry_get_value(list_entry);
> > +
> > +		if (!strcmp(name, "RESET_FAILED") && !strcmp(val, "1")) {
> > +			printf("%s = %s\n", name, val);
> ----------------------- ^
> Do not use printf, use igt_debug or igt_info. Use of igt_debug is preferable as
> to not clobber output.
Sure. Will address in next patch.
> 
> > +			reset_failed = true;
> > +			continue;
> > +		}
> > +
> > +		if (!strcmp(name, "RESET_UNIT") && !strcmp(val, "gt")) {
> > +			printf("%s = %s\n", name, val);
> ----------------------- ^
> Same here.
Will address in next patch.
> 
> > +			reset_unit_is_gt = true;
> > +			continue;
> > +		}
> > +
> > +		if (!strcmp(name, "RESET_ID") && (atoi(val) == gt_id)) {
> > +			printf("%s = %s\n", name, val);
> ----------------------- ^
> Same here.
Will address in next patch.
> 
> > +			gt_id_matches = true;
> > +			continue;
> > +		}
> > +	}
> > +
> > +	return (reset_failed && reset_unit_is_gt && gt_id_matches); }
> > +
> > +static void fake_reset_uevent_listener(int fd, int gt_id) {
> > +	struct udev *udev;
> > +	struct udev_device *dev;
> > +	struct udev_monitor *mon;
> > +	bool event_recieved = false;
> > +	bool event_sent = false;
> > +
> > +	/* create udev object */
> > +	udev = udev_new();
> > +	if (!udev) {
> > +		fprintf(stderr, "Can't create udev\n");
> --------------- ^
> use igt_debug
Sure.
> 
> > +		goto no_udev;
> --------------- ^
> Instead of goto please use igt_assert_f(false, "describe fail here\n");
Ok.
> 
> > +	}
> > +
> > +	mon = udev_monitor_new_from_netlink(udev, "kernel");
> > +	udev_monitor_filter_add_match_subsystem_devtype(mon, "drm",
> "drm_minor");
> > +	udev_monitor_enable_receiving(mon);
> > +	igt_until_timeout(5) {
> ------------------------- ^
> Write it as define or constant.
Sure.
> 
> > +			dev = udev_monitor_receive_device(mon);
> > +
> > +			if (dev) {
> > +				event_recieved =
> listen_reset_fail_uevent(dev, "kernel", gt_id);
> > +				udev_device_unref(dev);
> > +			}
> > +
> > +			if (event_sent)
> > +				goto free_udev;
> ------------------------------- ^
> Just
> 				break;
> 
> is imho better.
Makes sense.
> 
> > +
> > +		event_sent = xe_force_gt_fake_reset(fd, gt_id);
> > +		usleep(50 * 1000);
> ---------------------- ^
> Write it as define or constant also comment why you want to sleep here.
Sure.
> 
> > +	}
> > +
> > +free_udev:
> > +	udev_unref(udev);
> > +no_udev:
> > +	igt_assert(event_recieved);
> > +}
> > +
> > +igt_main
> > +{
> > +	int fd;
> > +
> > +	igt_fixture {
> > +		fd = drm_open_driver(DRIVER_XE);
> > +		xe_device_get(fd);
> > +	}
> > +
> > +	usleep(50 * 1000);
> ------- ^
> Do not make such sleeps here, why do you need it here?
drm_open_driver, loads driver incase it is not loaded already. Which will cause lot of uevents
and listener might interpret wrong events and cause failure. Above delay is to ensure uevents triggered during driver load are 
settled down before initiating listener for fake reset failure.
Will add the reason for delay in comment section. 
> 
> Regards,
> Kamil
> 
> > +
> > +	igt_subtest("fake_reset_uevent_listener")
> > +		fake_reset_uevent_listener(fd, 0);
> > +
> > +	igt_fixture {
> > +		xe_device_put(fd);
> > +		close(fd);
> > +	}
> > +}
> > --
> > 2.25.1
> >

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

end of thread, other threads:[~2023-06-13  8:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-05  5:50 [igt-dev] [i-g-t, 1/1] Uevent listener for fake gt reset failure Himal Prasad Ghimiray
2023-06-05 17:44 ` [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [i-g-t,1/1] " Patchwork
2023-06-05 18:10 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2023-06-06 12:23 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2023-06-09  9:05 ` [igt-dev] [i-g-t, 1/1] " Kumar, Janga Rahul
2023-06-09  9:22   ` Ghimiray, Himal Prasad
2023-06-09  9:35 ` Kamil Konieczny
2023-06-13  8:46   ` Ghimiray, Himal Prasad

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.